Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
123 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.user;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
/**
27
 * Internal information to be used by system. various variables which aid in serving the user are identified and put here
28
 * *
29
 */
30
public class UserInternalInfo implements TBase<UserInternalInfo._Fields>, java.io.Serializable, Cloneable, Comparable<UserInternalInfo> {
31
  private static final TStruct STRUCT_DESC = new TStruct("UserInternalInfo");
32
 
33
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
34
  private static final TField GEO_ZONE_FIELD_DESC = new TField("geoZone", TType.I64, (short)2);
35
  private static final TField SHIPMENT_ZONE_FIELD_DESC = new TField("shipmentZone", TType.I64, (short)3);
36
  private static final TField TAX_ZONE_FIELD_DESC = new TField("taxZone", TType.I64, (short)4);
37
  private static final TField USER_RANK_SCORE_FIELD_DESC = new TField("userRankScore", TType.DOUBLE, (short)5);
38
 
39
  private long userId;
40
  private long geoZone;
41
  private long shipmentZone;
42
  private long taxZone;
43
  private double userRankScore;
44
 
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
46
  public enum _Fields implements TFieldIdEnum {
47
    USER_ID((short)1, "userId"),
48
    GEO_ZONE((short)2, "geoZone"),
49
    SHIPMENT_ZONE((short)3, "shipmentZone"),
50
    TAX_ZONE((short)4, "taxZone"),
51
    USER_RANK_SCORE((short)5, "userRankScore");
52
 
53
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
54
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
55
 
56
    static {
57
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
58
        byId.put((int)field._thriftId, field);
59
        byName.put(field.getFieldName(), field);
60
      }
61
    }
62
 
63
    /**
64
     * Find the _Fields constant that matches fieldId, or null if its not found.
65
     */
66
    public static _Fields findByThriftId(int fieldId) {
67
      return byId.get(fieldId);
68
    }
69
 
70
    /**
71
     * Find the _Fields constant that matches fieldId, throwing an exception
72
     * if it is not found.
73
     */
74
    public static _Fields findByThriftIdOrThrow(int fieldId) {
75
      _Fields fields = findByThriftId(fieldId);
76
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
77
      return fields;
78
    }
79
 
80
    /**
81
     * Find the _Fields constant that matches name, or null if its not found.
82
     */
83
    public static _Fields findByName(String name) {
84
      return byName.get(name);
85
    }
86
 
87
    private final short _thriftId;
88
    private final String _fieldName;
89
 
90
    _Fields(short thriftId, String fieldName) {
91
      _thriftId = thriftId;
92
      _fieldName = fieldName;
93
    }
94
 
95
    public short getThriftFieldId() {
96
      return _thriftId;
97
    }
98
 
99
    public String getFieldName() {
100
      return _fieldName;
101
    }
102
  }
103
 
104
  // isset id assignments
105
  private static final int __USERID_ISSET_ID = 0;
106
  private static final int __GEOZONE_ISSET_ID = 1;
107
  private static final int __SHIPMENTZONE_ISSET_ID = 2;
108
  private static final int __TAXZONE_ISSET_ID = 3;
109
  private static final int __USERRANKSCORE_ISSET_ID = 4;
110
  private BitSet __isset_bit_vector = new BitSet(5);
111
 
112
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
113
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.I64)));
115
    put(_Fields.GEO_ZONE, new FieldMetaData("geoZone", TFieldRequirementType.DEFAULT, 
116
        new FieldValueMetaData(TType.I64)));
117
    put(_Fields.SHIPMENT_ZONE, new FieldMetaData("shipmentZone", TFieldRequirementType.DEFAULT, 
118
        new FieldValueMetaData(TType.I64)));
119
    put(_Fields.TAX_ZONE, new FieldMetaData("taxZone", TFieldRequirementType.DEFAULT, 
120
        new FieldValueMetaData(TType.I64)));
121
    put(_Fields.USER_RANK_SCORE, new FieldMetaData("userRankScore", TFieldRequirementType.DEFAULT, 
122
        new FieldValueMetaData(TType.DOUBLE)));
123
  }});
124
 
125
  static {
126
    FieldMetaData.addStructMetaDataMap(UserInternalInfo.class, metaDataMap);
127
  }
128
 
129
  public UserInternalInfo() {
130
  }
131
 
132
  public UserInternalInfo(
133
    long userId,
134
    long geoZone,
135
    long shipmentZone,
136
    long taxZone,
137
    double userRankScore)
138
  {
139
    this();
140
    this.userId = userId;
141
    setUserIdIsSet(true);
142
    this.geoZone = geoZone;
143
    setGeoZoneIsSet(true);
144
    this.shipmentZone = shipmentZone;
145
    setShipmentZoneIsSet(true);
146
    this.taxZone = taxZone;
147
    setTaxZoneIsSet(true);
148
    this.userRankScore = userRankScore;
149
    setUserRankScoreIsSet(true);
150
  }
151
 
152
  /**
153
   * Performs a deep copy on <i>other</i>.
154
   */
155
  public UserInternalInfo(UserInternalInfo other) {
156
    __isset_bit_vector.clear();
157
    __isset_bit_vector.or(other.__isset_bit_vector);
158
    this.userId = other.userId;
159
    this.geoZone = other.geoZone;
160
    this.shipmentZone = other.shipmentZone;
161
    this.taxZone = other.taxZone;
162
    this.userRankScore = other.userRankScore;
163
  }
164
 
165
  public UserInternalInfo deepCopy() {
166
    return new UserInternalInfo(this);
167
  }
168
 
169
  @Deprecated
170
  public UserInternalInfo clone() {
171
    return new UserInternalInfo(this);
172
  }
173
 
174
  public long getUserId() {
175
    return this.userId;
176
  }
177
 
178
  public UserInternalInfo setUserId(long userId) {
179
    this.userId = userId;
180
    setUserIdIsSet(true);
181
    return this;
182
  }
183
 
184
  public void unsetUserId() {
185
    __isset_bit_vector.clear(__USERID_ISSET_ID);
186
  }
187
 
188
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
189
  public boolean isSetUserId() {
190
    return __isset_bit_vector.get(__USERID_ISSET_ID);
191
  }
192
 
193
  public void setUserIdIsSet(boolean value) {
194
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
195
  }
196
 
197
  public long getGeoZone() {
198
    return this.geoZone;
199
  }
200
 
201
  public UserInternalInfo setGeoZone(long geoZone) {
202
    this.geoZone = geoZone;
203
    setGeoZoneIsSet(true);
204
    return this;
205
  }
206
 
207
  public void unsetGeoZone() {
208
    __isset_bit_vector.clear(__GEOZONE_ISSET_ID);
209
  }
210
 
211
  /** Returns true if field geoZone is set (has been asigned a value) and false otherwise */
212
  public boolean isSetGeoZone() {
213
    return __isset_bit_vector.get(__GEOZONE_ISSET_ID);
214
  }
215
 
216
  public void setGeoZoneIsSet(boolean value) {
217
    __isset_bit_vector.set(__GEOZONE_ISSET_ID, value);
218
  }
219
 
220
  public long getShipmentZone() {
221
    return this.shipmentZone;
222
  }
223
 
224
  public UserInternalInfo setShipmentZone(long shipmentZone) {
225
    this.shipmentZone = shipmentZone;
226
    setShipmentZoneIsSet(true);
227
    return this;
228
  }
229
 
230
  public void unsetShipmentZone() {
231
    __isset_bit_vector.clear(__SHIPMENTZONE_ISSET_ID);
232
  }
233
 
234
  /** Returns true if field shipmentZone is set (has been asigned a value) and false otherwise */
235
  public boolean isSetShipmentZone() {
236
    return __isset_bit_vector.get(__SHIPMENTZONE_ISSET_ID);
237
  }
238
 
239
  public void setShipmentZoneIsSet(boolean value) {
240
    __isset_bit_vector.set(__SHIPMENTZONE_ISSET_ID, value);
241
  }
242
 
243
  public long getTaxZone() {
244
    return this.taxZone;
245
  }
246
 
247
  public UserInternalInfo setTaxZone(long taxZone) {
248
    this.taxZone = taxZone;
249
    setTaxZoneIsSet(true);
250
    return this;
251
  }
252
 
253
  public void unsetTaxZone() {
254
    __isset_bit_vector.clear(__TAXZONE_ISSET_ID);
255
  }
256
 
257
  /** Returns true if field taxZone is set (has been asigned a value) and false otherwise */
258
  public boolean isSetTaxZone() {
259
    return __isset_bit_vector.get(__TAXZONE_ISSET_ID);
260
  }
261
 
262
  public void setTaxZoneIsSet(boolean value) {
263
    __isset_bit_vector.set(__TAXZONE_ISSET_ID, value);
264
  }
265
 
266
  public double getUserRankScore() {
267
    return this.userRankScore;
268
  }
269
 
270
  public UserInternalInfo setUserRankScore(double userRankScore) {
271
    this.userRankScore = userRankScore;
272
    setUserRankScoreIsSet(true);
273
    return this;
274
  }
275
 
276
  public void unsetUserRankScore() {
277
    __isset_bit_vector.clear(__USERRANKSCORE_ISSET_ID);
278
  }
279
 
280
  /** Returns true if field userRankScore is set (has been asigned a value) and false otherwise */
281
  public boolean isSetUserRankScore() {
282
    return __isset_bit_vector.get(__USERRANKSCORE_ISSET_ID);
283
  }
284
 
285
  public void setUserRankScoreIsSet(boolean value) {
286
    __isset_bit_vector.set(__USERRANKSCORE_ISSET_ID, value);
287
  }
288
 
289
  public void setFieldValue(_Fields field, Object value) {
290
    switch (field) {
291
    case USER_ID:
292
      if (value == null) {
293
        unsetUserId();
294
      } else {
295
        setUserId((Long)value);
296
      }
297
      break;
298
 
299
    case GEO_ZONE:
300
      if (value == null) {
301
        unsetGeoZone();
302
      } else {
303
        setGeoZone((Long)value);
304
      }
305
      break;
306
 
307
    case SHIPMENT_ZONE:
308
      if (value == null) {
309
        unsetShipmentZone();
310
      } else {
311
        setShipmentZone((Long)value);
312
      }
313
      break;
314
 
315
    case TAX_ZONE:
316
      if (value == null) {
317
        unsetTaxZone();
318
      } else {
319
        setTaxZone((Long)value);
320
      }
321
      break;
322
 
323
    case USER_RANK_SCORE:
324
      if (value == null) {
325
        unsetUserRankScore();
326
      } else {
327
        setUserRankScore((Double)value);
328
      }
329
      break;
330
 
331
    }
332
  }
333
 
334
  public void setFieldValue(int fieldID, Object value) {
335
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
336
  }
337
 
338
  public Object getFieldValue(_Fields field) {
339
    switch (field) {
340
    case USER_ID:
341
      return new Long(getUserId());
342
 
343
    case GEO_ZONE:
344
      return new Long(getGeoZone());
345
 
346
    case SHIPMENT_ZONE:
347
      return new Long(getShipmentZone());
348
 
349
    case TAX_ZONE:
350
      return new Long(getTaxZone());
351
 
352
    case USER_RANK_SCORE:
353
      return new Double(getUserRankScore());
354
 
355
    }
356
    throw new IllegalStateException();
357
  }
358
 
359
  public Object getFieldValue(int fieldId) {
360
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
361
  }
362
 
363
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
364
  public boolean isSet(_Fields field) {
365
    switch (field) {
366
    case USER_ID:
367
      return isSetUserId();
368
    case GEO_ZONE:
369
      return isSetGeoZone();
370
    case SHIPMENT_ZONE:
371
      return isSetShipmentZone();
372
    case TAX_ZONE:
373
      return isSetTaxZone();
374
    case USER_RANK_SCORE:
375
      return isSetUserRankScore();
376
    }
377
    throw new IllegalStateException();
378
  }
379
 
380
  public boolean isSet(int fieldID) {
381
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
382
  }
383
 
384
  @Override
385
  public boolean equals(Object that) {
386
    if (that == null)
387
      return false;
388
    if (that instanceof UserInternalInfo)
389
      return this.equals((UserInternalInfo)that);
390
    return false;
391
  }
392
 
393
  public boolean equals(UserInternalInfo that) {
394
    if (that == null)
395
      return false;
396
 
397
    boolean this_present_userId = true;
398
    boolean that_present_userId = true;
399
    if (this_present_userId || that_present_userId) {
400
      if (!(this_present_userId && that_present_userId))
401
        return false;
402
      if (this.userId != that.userId)
403
        return false;
404
    }
405
 
406
    boolean this_present_geoZone = true;
407
    boolean that_present_geoZone = true;
408
    if (this_present_geoZone || that_present_geoZone) {
409
      if (!(this_present_geoZone && that_present_geoZone))
410
        return false;
411
      if (this.geoZone != that.geoZone)
412
        return false;
413
    }
414
 
415
    boolean this_present_shipmentZone = true;
416
    boolean that_present_shipmentZone = true;
417
    if (this_present_shipmentZone || that_present_shipmentZone) {
418
      if (!(this_present_shipmentZone && that_present_shipmentZone))
419
        return false;
420
      if (this.shipmentZone != that.shipmentZone)
421
        return false;
422
    }
423
 
424
    boolean this_present_taxZone = true;
425
    boolean that_present_taxZone = true;
426
    if (this_present_taxZone || that_present_taxZone) {
427
      if (!(this_present_taxZone && that_present_taxZone))
428
        return false;
429
      if (this.taxZone != that.taxZone)
430
        return false;
431
    }
432
 
433
    boolean this_present_userRankScore = true;
434
    boolean that_present_userRankScore = true;
435
    if (this_present_userRankScore || that_present_userRankScore) {
436
      if (!(this_present_userRankScore && that_present_userRankScore))
437
        return false;
438
      if (this.userRankScore != that.userRankScore)
439
        return false;
440
    }
441
 
442
    return true;
443
  }
444
 
445
  @Override
446
  public int hashCode() {
447
    return 0;
448
  }
449
 
450
  public int compareTo(UserInternalInfo other) {
451
    if (!getClass().equals(other.getClass())) {
452
      return getClass().getName().compareTo(other.getClass().getName());
453
    }
454
 
455
    int lastComparison = 0;
456
    UserInternalInfo typedOther = (UserInternalInfo)other;
457
 
458
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
459
    if (lastComparison != 0) {
460
      return lastComparison;
461
    }
462
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
463
    if (lastComparison != 0) {
464
      return lastComparison;
465
    }
466
    lastComparison = Boolean.valueOf(isSetGeoZone()).compareTo(isSetGeoZone());
467
    if (lastComparison != 0) {
468
      return lastComparison;
469
    }
470
    lastComparison = TBaseHelper.compareTo(geoZone, typedOther.geoZone);
471
    if (lastComparison != 0) {
472
      return lastComparison;
473
    }
474
    lastComparison = Boolean.valueOf(isSetShipmentZone()).compareTo(isSetShipmentZone());
475
    if (lastComparison != 0) {
476
      return lastComparison;
477
    }
478
    lastComparison = TBaseHelper.compareTo(shipmentZone, typedOther.shipmentZone);
479
    if (lastComparison != 0) {
480
      return lastComparison;
481
    }
482
    lastComparison = Boolean.valueOf(isSetTaxZone()).compareTo(isSetTaxZone());
483
    if (lastComparison != 0) {
484
      return lastComparison;
485
    }
486
    lastComparison = TBaseHelper.compareTo(taxZone, typedOther.taxZone);
487
    if (lastComparison != 0) {
488
      return lastComparison;
489
    }
490
    lastComparison = Boolean.valueOf(isSetUserRankScore()).compareTo(isSetUserRankScore());
491
    if (lastComparison != 0) {
492
      return lastComparison;
493
    }
494
    lastComparison = TBaseHelper.compareTo(userRankScore, typedOther.userRankScore);
495
    if (lastComparison != 0) {
496
      return lastComparison;
497
    }
498
    return 0;
499
  }
500
 
501
  public void read(TProtocol iprot) throws TException {
502
    TField field;
503
    iprot.readStructBegin();
504
    while (true)
505
    {
506
      field = iprot.readFieldBegin();
507
      if (field.type == TType.STOP) { 
508
        break;
509
      }
510
      _Fields fieldId = _Fields.findByThriftId(field.id);
511
      if (fieldId == null) {
512
        TProtocolUtil.skip(iprot, field.type);
513
      } else {
514
        switch (fieldId) {
515
          case USER_ID:
516
            if (field.type == TType.I64) {
517
              this.userId = iprot.readI64();
518
              setUserIdIsSet(true);
519
            } else { 
520
              TProtocolUtil.skip(iprot, field.type);
521
            }
522
            break;
523
          case GEO_ZONE:
524
            if (field.type == TType.I64) {
525
              this.geoZone = iprot.readI64();
526
              setGeoZoneIsSet(true);
527
            } else { 
528
              TProtocolUtil.skip(iprot, field.type);
529
            }
530
            break;
531
          case SHIPMENT_ZONE:
532
            if (field.type == TType.I64) {
533
              this.shipmentZone = iprot.readI64();
534
              setShipmentZoneIsSet(true);
535
            } else { 
536
              TProtocolUtil.skip(iprot, field.type);
537
            }
538
            break;
539
          case TAX_ZONE:
540
            if (field.type == TType.I64) {
541
              this.taxZone = iprot.readI64();
542
              setTaxZoneIsSet(true);
543
            } else { 
544
              TProtocolUtil.skip(iprot, field.type);
545
            }
546
            break;
547
          case USER_RANK_SCORE:
548
            if (field.type == TType.DOUBLE) {
549
              this.userRankScore = iprot.readDouble();
550
              setUserRankScoreIsSet(true);
551
            } else { 
552
              TProtocolUtil.skip(iprot, field.type);
553
            }
554
            break;
555
        }
556
        iprot.readFieldEnd();
557
      }
558
    }
559
    iprot.readStructEnd();
560
    validate();
561
  }
562
 
563
  public void write(TProtocol oprot) throws TException {
564
    validate();
565
 
566
    oprot.writeStructBegin(STRUCT_DESC);
567
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
568
    oprot.writeI64(this.userId);
569
    oprot.writeFieldEnd();
570
    oprot.writeFieldBegin(GEO_ZONE_FIELD_DESC);
571
    oprot.writeI64(this.geoZone);
572
    oprot.writeFieldEnd();
573
    oprot.writeFieldBegin(SHIPMENT_ZONE_FIELD_DESC);
574
    oprot.writeI64(this.shipmentZone);
575
    oprot.writeFieldEnd();
576
    oprot.writeFieldBegin(TAX_ZONE_FIELD_DESC);
577
    oprot.writeI64(this.taxZone);
578
    oprot.writeFieldEnd();
579
    oprot.writeFieldBegin(USER_RANK_SCORE_FIELD_DESC);
580
    oprot.writeDouble(this.userRankScore);
581
    oprot.writeFieldEnd();
582
    oprot.writeFieldStop();
583
    oprot.writeStructEnd();
584
  }
585
 
586
  @Override
587
  public String toString() {
588
    StringBuilder sb = new StringBuilder("UserInternalInfo(");
589
    boolean first = true;
590
 
591
    sb.append("userId:");
592
    sb.append(this.userId);
593
    first = false;
594
    if (!first) sb.append(", ");
595
    sb.append("geoZone:");
596
    sb.append(this.geoZone);
597
    first = false;
598
    if (!first) sb.append(", ");
599
    sb.append("shipmentZone:");
600
    sb.append(this.shipmentZone);
601
    first = false;
602
    if (!first) sb.append(", ");
603
    sb.append("taxZone:");
604
    sb.append(this.taxZone);
605
    first = false;
606
    if (!first) sb.append(", ");
607
    sb.append("userRankScore:");
608
    sb.append(this.userRankScore);
609
    first = false;
610
    sb.append(")");
611
    return sb.toString();
612
  }
613
 
614
  public void validate() throws TException {
615
    // check for required fields
616
  }
617
 
618
}
619