Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7080 anupam.sin 1
/**
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.order;
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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class FRC implements org.apache.thrift.TBase<FRC, FRC._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FRC");
25
 
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField OPERATOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("operatorId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField CIRCLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("circleId", org.apache.thrift.protocol.TType.I64, (short)3);
29
  private static final org.apache.thrift.protocol.TField DENOMINATION_FIELD_DESC = new org.apache.thrift.protocol.TField("denomination", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField MAX_DISCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("maxDiscount", org.apache.thrift.protocol.TType.I64, (short)5);
31
 
32
  private long id; // required
33
  private long operatorId; // required
34
  private long circleId; // required
35
  private long denomination; // required
36
  private long maxDiscount; // required
37
 
38
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
39
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
40
    ID((short)1, "id"),
41
    OPERATOR_ID((short)2, "operatorId"),
42
    CIRCLE_ID((short)3, "circleId"),
43
    DENOMINATION((short)4, "denomination"),
44
    MAX_DISCOUNT((short)5, "maxDiscount");
45
 
46
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
47
 
48
    static {
49
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
50
        byName.put(field.getFieldName(), field);
51
      }
52
    }
53
 
54
    /**
55
     * Find the _Fields constant that matches fieldId, or null if its not found.
56
     */
57
    public static _Fields findByThriftId(int fieldId) {
58
      switch(fieldId) {
59
        case 1: // ID
60
          return ID;
61
        case 2: // OPERATOR_ID
62
          return OPERATOR_ID;
63
        case 3: // CIRCLE_ID
64
          return CIRCLE_ID;
65
        case 4: // DENOMINATION
66
          return DENOMINATION;
67
        case 5: // MAX_DISCOUNT
68
          return MAX_DISCOUNT;
69
        default:
70
          return null;
71
      }
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches fieldId, throwing an exception
76
     * if it is not found.
77
     */
78
    public static _Fields findByThriftIdOrThrow(int fieldId) {
79
      _Fields fields = findByThriftId(fieldId);
80
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
81
      return fields;
82
    }
83
 
84
    /**
85
     * Find the _Fields constant that matches name, or null if its not found.
86
     */
87
    public static _Fields findByName(String name) {
88
      return byName.get(name);
89
    }
90
 
91
    private final short _thriftId;
92
    private final String _fieldName;
93
 
94
    _Fields(short thriftId, String fieldName) {
95
      _thriftId = thriftId;
96
      _fieldName = fieldName;
97
    }
98
 
99
    public short getThriftFieldId() {
100
      return _thriftId;
101
    }
102
 
103
    public String getFieldName() {
104
      return _fieldName;
105
    }
106
  }
107
 
108
  // isset id assignments
109
  private static final int __ID_ISSET_ID = 0;
110
  private static final int __OPERATORID_ISSET_ID = 1;
111
  private static final int __CIRCLEID_ISSET_ID = 2;
112
  private static final int __DENOMINATION_ISSET_ID = 3;
113
  private static final int __MAXDISCOUNT_ISSET_ID = 4;
114
  private BitSet __isset_bit_vector = new BitSet(5);
115
 
116
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
117
  static {
118
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
119
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
120
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
121
    tmpMap.put(_Fields.OPERATOR_ID, new org.apache.thrift.meta_data.FieldMetaData("operatorId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
122
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
123
    tmpMap.put(_Fields.CIRCLE_ID, new org.apache.thrift.meta_data.FieldMetaData("circleId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
124
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
125
    tmpMap.put(_Fields.DENOMINATION, new org.apache.thrift.meta_data.FieldMetaData("denomination", org.apache.thrift.TFieldRequirementType.DEFAULT, 
126
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
127
    tmpMap.put(_Fields.MAX_DISCOUNT, new org.apache.thrift.meta_data.FieldMetaData("maxDiscount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
128
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
129
    metaDataMap = Collections.unmodifiableMap(tmpMap);
130
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FRC.class, metaDataMap);
131
  }
132
 
133
  public FRC() {
134
  }
135
 
136
  public FRC(
137
    long id,
138
    long operatorId,
139
    long circleId,
140
    long denomination,
141
    long maxDiscount)
142
  {
143
    this();
144
    this.id = id;
145
    setIdIsSet(true);
146
    this.operatorId = operatorId;
147
    setOperatorIdIsSet(true);
148
    this.circleId = circleId;
149
    setCircleIdIsSet(true);
150
    this.denomination = denomination;
151
    setDenominationIsSet(true);
152
    this.maxDiscount = maxDiscount;
153
    setMaxDiscountIsSet(true);
154
  }
155
 
156
  /**
157
   * Performs a deep copy on <i>other</i>.
158
   */
159
  public FRC(FRC other) {
160
    __isset_bit_vector.clear();
161
    __isset_bit_vector.or(other.__isset_bit_vector);
162
    this.id = other.id;
163
    this.operatorId = other.operatorId;
164
    this.circleId = other.circleId;
165
    this.denomination = other.denomination;
166
    this.maxDiscount = other.maxDiscount;
167
  }
168
 
169
  public FRC deepCopy() {
170
    return new FRC(this);
171
  }
172
 
173
  @Override
174
  public void clear() {
175
    setIdIsSet(false);
176
    this.id = 0;
177
    setOperatorIdIsSet(false);
178
    this.operatorId = 0;
179
    setCircleIdIsSet(false);
180
    this.circleId = 0;
181
    setDenominationIsSet(false);
182
    this.denomination = 0;
183
    setMaxDiscountIsSet(false);
184
    this.maxDiscount = 0;
185
  }
186
 
187
  public long getId() {
188
    return this.id;
189
  }
190
 
191
  public void setId(long id) {
192
    this.id = id;
193
    setIdIsSet(true);
194
  }
195
 
196
  public void unsetId() {
197
    __isset_bit_vector.clear(__ID_ISSET_ID);
198
  }
199
 
200
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
201
  public boolean isSetId() {
202
    return __isset_bit_vector.get(__ID_ISSET_ID);
203
  }
204
 
205
  public void setIdIsSet(boolean value) {
206
    __isset_bit_vector.set(__ID_ISSET_ID, value);
207
  }
208
 
209
  public long getOperatorId() {
210
    return this.operatorId;
211
  }
212
 
213
  public void setOperatorId(long operatorId) {
214
    this.operatorId = operatorId;
215
    setOperatorIdIsSet(true);
216
  }
217
 
218
  public void unsetOperatorId() {
219
    __isset_bit_vector.clear(__OPERATORID_ISSET_ID);
220
  }
221
 
222
  /** Returns true if field operatorId is set (has been assigned a value) and false otherwise */
223
  public boolean isSetOperatorId() {
224
    return __isset_bit_vector.get(__OPERATORID_ISSET_ID);
225
  }
226
 
227
  public void setOperatorIdIsSet(boolean value) {
228
    __isset_bit_vector.set(__OPERATORID_ISSET_ID, value);
229
  }
230
 
231
  public long getCircleId() {
232
    return this.circleId;
233
  }
234
 
235
  public void setCircleId(long circleId) {
236
    this.circleId = circleId;
237
    setCircleIdIsSet(true);
238
  }
239
 
240
  public void unsetCircleId() {
241
    __isset_bit_vector.clear(__CIRCLEID_ISSET_ID);
242
  }
243
 
244
  /** Returns true if field circleId is set (has been assigned a value) and false otherwise */
245
  public boolean isSetCircleId() {
246
    return __isset_bit_vector.get(__CIRCLEID_ISSET_ID);
247
  }
248
 
249
  public void setCircleIdIsSet(boolean value) {
250
    __isset_bit_vector.set(__CIRCLEID_ISSET_ID, value);
251
  }
252
 
253
  public long getDenomination() {
254
    return this.denomination;
255
  }
256
 
257
  public void setDenomination(long denomination) {
258
    this.denomination = denomination;
259
    setDenominationIsSet(true);
260
  }
261
 
262
  public void unsetDenomination() {
263
    __isset_bit_vector.clear(__DENOMINATION_ISSET_ID);
264
  }
265
 
266
  /** Returns true if field denomination is set (has been assigned a value) and false otherwise */
267
  public boolean isSetDenomination() {
268
    return __isset_bit_vector.get(__DENOMINATION_ISSET_ID);
269
  }
270
 
271
  public void setDenominationIsSet(boolean value) {
272
    __isset_bit_vector.set(__DENOMINATION_ISSET_ID, value);
273
  }
274
 
275
  public long getMaxDiscount() {
276
    return this.maxDiscount;
277
  }
278
 
279
  public void setMaxDiscount(long maxDiscount) {
280
    this.maxDiscount = maxDiscount;
281
    setMaxDiscountIsSet(true);
282
  }
283
 
284
  public void unsetMaxDiscount() {
285
    __isset_bit_vector.clear(__MAXDISCOUNT_ISSET_ID);
286
  }
287
 
288
  /** Returns true if field maxDiscount is set (has been assigned a value) and false otherwise */
289
  public boolean isSetMaxDiscount() {
290
    return __isset_bit_vector.get(__MAXDISCOUNT_ISSET_ID);
291
  }
292
 
293
  public void setMaxDiscountIsSet(boolean value) {
294
    __isset_bit_vector.set(__MAXDISCOUNT_ISSET_ID, value);
295
  }
296
 
297
  public void setFieldValue(_Fields field, Object value) {
298
    switch (field) {
299
    case ID:
300
      if (value == null) {
301
        unsetId();
302
      } else {
303
        setId((Long)value);
304
      }
305
      break;
306
 
307
    case OPERATOR_ID:
308
      if (value == null) {
309
        unsetOperatorId();
310
      } else {
311
        setOperatorId((Long)value);
312
      }
313
      break;
314
 
315
    case CIRCLE_ID:
316
      if (value == null) {
317
        unsetCircleId();
318
      } else {
319
        setCircleId((Long)value);
320
      }
321
      break;
322
 
323
    case DENOMINATION:
324
      if (value == null) {
325
        unsetDenomination();
326
      } else {
327
        setDenomination((Long)value);
328
      }
329
      break;
330
 
331
    case MAX_DISCOUNT:
332
      if (value == null) {
333
        unsetMaxDiscount();
334
      } else {
335
        setMaxDiscount((Long)value);
336
      }
337
      break;
338
 
339
    }
340
  }
341
 
342
  public Object getFieldValue(_Fields field) {
343
    switch (field) {
344
    case ID:
345
      return Long.valueOf(getId());
346
 
347
    case OPERATOR_ID:
348
      return Long.valueOf(getOperatorId());
349
 
350
    case CIRCLE_ID:
351
      return Long.valueOf(getCircleId());
352
 
353
    case DENOMINATION:
354
      return Long.valueOf(getDenomination());
355
 
356
    case MAX_DISCOUNT:
357
      return Long.valueOf(getMaxDiscount());
358
 
359
    }
360
    throw new IllegalStateException();
361
  }
362
 
363
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
364
  public boolean isSet(_Fields field) {
365
    if (field == null) {
366
      throw new IllegalArgumentException();
367
    }
368
 
369
    switch (field) {
370
    case ID:
371
      return isSetId();
372
    case OPERATOR_ID:
373
      return isSetOperatorId();
374
    case CIRCLE_ID:
375
      return isSetCircleId();
376
    case DENOMINATION:
377
      return isSetDenomination();
378
    case MAX_DISCOUNT:
379
      return isSetMaxDiscount();
380
    }
381
    throw new IllegalStateException();
382
  }
383
 
384
  @Override
385
  public boolean equals(Object that) {
386
    if (that == null)
387
      return false;
388
    if (that instanceof FRC)
389
      return this.equals((FRC)that);
390
    return false;
391
  }
392
 
393
  public boolean equals(FRC that) {
394
    if (that == null)
395
      return false;
396
 
397
    boolean this_present_id = true;
398
    boolean that_present_id = true;
399
    if (this_present_id || that_present_id) {
400
      if (!(this_present_id && that_present_id))
401
        return false;
402
      if (this.id != that.id)
403
        return false;
404
    }
405
 
406
    boolean this_present_operatorId = true;
407
    boolean that_present_operatorId = true;
408
    if (this_present_operatorId || that_present_operatorId) {
409
      if (!(this_present_operatorId && that_present_operatorId))
410
        return false;
411
      if (this.operatorId != that.operatorId)
412
        return false;
413
    }
414
 
415
    boolean this_present_circleId = true;
416
    boolean that_present_circleId = true;
417
    if (this_present_circleId || that_present_circleId) {
418
      if (!(this_present_circleId && that_present_circleId))
419
        return false;
420
      if (this.circleId != that.circleId)
421
        return false;
422
    }
423
 
424
    boolean this_present_denomination = true;
425
    boolean that_present_denomination = true;
426
    if (this_present_denomination || that_present_denomination) {
427
      if (!(this_present_denomination && that_present_denomination))
428
        return false;
429
      if (this.denomination != that.denomination)
430
        return false;
431
    }
432
 
433
    boolean this_present_maxDiscount = true;
434
    boolean that_present_maxDiscount = true;
435
    if (this_present_maxDiscount || that_present_maxDiscount) {
436
      if (!(this_present_maxDiscount && that_present_maxDiscount))
437
        return false;
438
      if (this.maxDiscount != that.maxDiscount)
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(FRC other) {
451
    if (!getClass().equals(other.getClass())) {
452
      return getClass().getName().compareTo(other.getClass().getName());
453
    }
454
 
455
    int lastComparison = 0;
456
    FRC typedOther = (FRC)other;
457
 
458
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
459
    if (lastComparison != 0) {
460
      return lastComparison;
461
    }
462
    if (isSetId()) {
463
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
464
      if (lastComparison != 0) {
465
        return lastComparison;
466
      }
467
    }
468
    lastComparison = Boolean.valueOf(isSetOperatorId()).compareTo(typedOther.isSetOperatorId());
469
    if (lastComparison != 0) {
470
      return lastComparison;
471
    }
472
    if (isSetOperatorId()) {
473
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operatorId, typedOther.operatorId);
474
      if (lastComparison != 0) {
475
        return lastComparison;
476
      }
477
    }
478
    lastComparison = Boolean.valueOf(isSetCircleId()).compareTo(typedOther.isSetCircleId());
479
    if (lastComparison != 0) {
480
      return lastComparison;
481
    }
482
    if (isSetCircleId()) {
483
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.circleId, typedOther.circleId);
484
      if (lastComparison != 0) {
485
        return lastComparison;
486
      }
487
    }
488
    lastComparison = Boolean.valueOf(isSetDenomination()).compareTo(typedOther.isSetDenomination());
489
    if (lastComparison != 0) {
490
      return lastComparison;
491
    }
492
    if (isSetDenomination()) {
493
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.denomination, typedOther.denomination);
494
      if (lastComparison != 0) {
495
        return lastComparison;
496
      }
497
    }
498
    lastComparison = Boolean.valueOf(isSetMaxDiscount()).compareTo(typedOther.isSetMaxDiscount());
499
    if (lastComparison != 0) {
500
      return lastComparison;
501
    }
502
    if (isSetMaxDiscount()) {
503
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxDiscount, typedOther.maxDiscount);
504
      if (lastComparison != 0) {
505
        return lastComparison;
506
      }
507
    }
508
    return 0;
509
  }
510
 
511
  public _Fields fieldForId(int fieldId) {
512
    return _Fields.findByThriftId(fieldId);
513
  }
514
 
515
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
516
    org.apache.thrift.protocol.TField field;
517
    iprot.readStructBegin();
518
    while (true)
519
    {
520
      field = iprot.readFieldBegin();
521
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
522
        break;
523
      }
524
      switch (field.id) {
525
        case 1: // ID
526
          if (field.type == org.apache.thrift.protocol.TType.I64) {
527
            this.id = iprot.readI64();
528
            setIdIsSet(true);
529
          } else { 
530
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
531
          }
532
          break;
533
        case 2: // OPERATOR_ID
534
          if (field.type == org.apache.thrift.protocol.TType.I64) {
535
            this.operatorId = iprot.readI64();
536
            setOperatorIdIsSet(true);
537
          } else { 
538
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
539
          }
540
          break;
541
        case 3: // CIRCLE_ID
542
          if (field.type == org.apache.thrift.protocol.TType.I64) {
543
            this.circleId = iprot.readI64();
544
            setCircleIdIsSet(true);
545
          } else { 
546
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
547
          }
548
          break;
549
        case 4: // DENOMINATION
550
          if (field.type == org.apache.thrift.protocol.TType.I64) {
551
            this.denomination = iprot.readI64();
552
            setDenominationIsSet(true);
553
          } else { 
554
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
555
          }
556
          break;
557
        case 5: // MAX_DISCOUNT
558
          if (field.type == org.apache.thrift.protocol.TType.I64) {
559
            this.maxDiscount = iprot.readI64();
560
            setMaxDiscountIsSet(true);
561
          } else { 
562
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
563
          }
564
          break;
565
        default:
566
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
567
      }
568
      iprot.readFieldEnd();
569
    }
570
    iprot.readStructEnd();
571
    validate();
572
  }
573
 
574
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
575
    validate();
576
 
577
    oprot.writeStructBegin(STRUCT_DESC);
578
    oprot.writeFieldBegin(ID_FIELD_DESC);
579
    oprot.writeI64(this.id);
580
    oprot.writeFieldEnd();
581
    oprot.writeFieldBegin(OPERATOR_ID_FIELD_DESC);
582
    oprot.writeI64(this.operatorId);
583
    oprot.writeFieldEnd();
584
    oprot.writeFieldBegin(CIRCLE_ID_FIELD_DESC);
585
    oprot.writeI64(this.circleId);
586
    oprot.writeFieldEnd();
587
    oprot.writeFieldBegin(DENOMINATION_FIELD_DESC);
588
    oprot.writeI64(this.denomination);
589
    oprot.writeFieldEnd();
590
    oprot.writeFieldBegin(MAX_DISCOUNT_FIELD_DESC);
591
    oprot.writeI64(this.maxDiscount);
592
    oprot.writeFieldEnd();
593
    oprot.writeFieldStop();
594
    oprot.writeStructEnd();
595
  }
596
 
597
  @Override
598
  public String toString() {
599
    StringBuilder sb = new StringBuilder("FRC(");
600
    boolean first = true;
601
 
602
    sb.append("id:");
603
    sb.append(this.id);
604
    first = false;
605
    if (!first) sb.append(", ");
606
    sb.append("operatorId:");
607
    sb.append(this.operatorId);
608
    first = false;
609
    if (!first) sb.append(", ");
610
    sb.append("circleId:");
611
    sb.append(this.circleId);
612
    first = false;
613
    if (!first) sb.append(", ");
614
    sb.append("denomination:");
615
    sb.append(this.denomination);
616
    first = false;
617
    if (!first) sb.append(", ");
618
    sb.append("maxDiscount:");
619
    sb.append(this.maxDiscount);
620
    first = false;
621
    sb.append(")");
622
    return sb.toString();
623
  }
624
 
625
  public void validate() throws org.apache.thrift.TException {
626
    // check for required fields
627
  }
628
 
629
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
630
    try {
631
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
632
    } catch (org.apache.thrift.TException te) {
633
      throw new java.io.IOException(te);
634
    }
635
  }
636
 
637
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
638
    try {
639
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
640
      __isset_bit_vector = new BitSet(1);
641
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
642
    } catch (org.apache.thrift.TException te) {
643
      throw new java.io.IOException(te);
644
    }
645
  }
646
 
647
}
648