Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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