Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
305 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.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.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 ExtraOrderInfo implements TBase<ExtraOrderInfo._Fields>, java.io.Serializable, Cloneable, Comparable<ExtraOrderInfo> {
27
  private static final TStruct STRUCT_DESC = new TStruct("ExtraOrderInfo");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField TRANSACTION_ID_FIELD_DESC = new TField("transaction_id", TType.I64, (short)2);
31
  private static final TField SKU_ID_FIELD_DESC = new TField("sku_id", TType.I64, (short)3);
32
  private static final TField MODEL_NAME_FIELD_DESC = new TField("model_name", TType.STRING, (short)4);
33
  private static final TField VENDOR_INFO_FIELD_DESC = new TField("vendor_info", TType.STRING, (short)5);
34
  private static final TField COLOUR_FIELD_DESC = new TField("colour", TType.STRING, (short)6);
35
 
36
  private long id;
37
  private long transaction_id;
38
  private long sku_id;
39
  private String model_name;
40
  private String vendor_info;
41
  private String colour;
42
 
43
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
44
  public enum _Fields implements TFieldIdEnum {
45
    ID((short)1, "id"),
46
    TRANSACTION_ID((short)2, "transaction_id"),
47
    SKU_ID((short)3, "sku_id"),
48
    MODEL_NAME((short)4, "model_name"),
49
    VENDOR_INFO((short)5, "vendor_info"),
50
    COLOUR((short)6, "colour");
51
 
52
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
53
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
54
 
55
    static {
56
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
57
        byId.put((int)field._thriftId, field);
58
        byName.put(field.getFieldName(), field);
59
      }
60
    }
61
 
62
    /**
63
     * Find the _Fields constant that matches fieldId, or null if its not found.
64
     */
65
    public static _Fields findByThriftId(int fieldId) {
66
      return byId.get(fieldId);
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __ID_ISSET_ID = 0;
105
  private static final int __TRANSACTION_ID_ISSET_ID = 1;
106
  private static final int __SKU_ID_ISSET_ID = 2;
107
  private BitSet __isset_bit_vector = new BitSet(3);
108
 
109
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
110
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.I64)));
112
    put(_Fields.TRANSACTION_ID, new FieldMetaData("transaction_id", TFieldRequirementType.DEFAULT, 
113
        new FieldValueMetaData(TType.I64)));
114
    put(_Fields.SKU_ID, new FieldMetaData("sku_id", TFieldRequirementType.DEFAULT, 
115
        new FieldValueMetaData(TType.I64)));
116
    put(_Fields.MODEL_NAME, new FieldMetaData("model_name", TFieldRequirementType.DEFAULT, 
117
        new FieldValueMetaData(TType.STRING)));
118
    put(_Fields.VENDOR_INFO, new FieldMetaData("vendor_info", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.STRING)));
120
    put(_Fields.COLOUR, new FieldMetaData("colour", TFieldRequirementType.DEFAULT, 
121
        new FieldValueMetaData(TType.STRING)));
122
  }});
123
 
124
  static {
125
    FieldMetaData.addStructMetaDataMap(ExtraOrderInfo.class, metaDataMap);
126
  }
127
 
128
  public ExtraOrderInfo() {
129
  }
130
 
131
  public ExtraOrderInfo(
132
    long id,
133
    long transaction_id,
134
    long sku_id,
135
    String model_name,
136
    String vendor_info,
137
    String colour)
138
  {
139
    this();
140
    this.id = id;
141
    setIdIsSet(true);
142
    this.transaction_id = transaction_id;
143
    setTransaction_idIsSet(true);
144
    this.sku_id = sku_id;
145
    setSku_idIsSet(true);
146
    this.model_name = model_name;
147
    this.vendor_info = vendor_info;
148
    this.colour = colour;
149
  }
150
 
151
  /**
152
   * Performs a deep copy on <i>other</i>.
153
   */
154
  public ExtraOrderInfo(ExtraOrderInfo other) {
155
    __isset_bit_vector.clear();
156
    __isset_bit_vector.or(other.__isset_bit_vector);
157
    this.id = other.id;
158
    this.transaction_id = other.transaction_id;
159
    this.sku_id = other.sku_id;
160
    if (other.isSetModel_name()) {
161
      this.model_name = other.model_name;
162
    }
163
    if (other.isSetVendor_info()) {
164
      this.vendor_info = other.vendor_info;
165
    }
166
    if (other.isSetColour()) {
167
      this.colour = other.colour;
168
    }
169
  }
170
 
171
  public ExtraOrderInfo deepCopy() {
172
    return new ExtraOrderInfo(this);
173
  }
174
 
175
  @Deprecated
176
  public ExtraOrderInfo clone() {
177
    return new ExtraOrderInfo(this);
178
  }
179
 
180
  public long getId() {
181
    return this.id;
182
  }
183
 
184
  public ExtraOrderInfo setId(long id) {
185
    this.id = id;
186
    setIdIsSet(true);
187
    return this;
188
  }
189
 
190
  public void unsetId() {
191
    __isset_bit_vector.clear(__ID_ISSET_ID);
192
  }
193
 
194
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
195
  public boolean isSetId() {
196
    return __isset_bit_vector.get(__ID_ISSET_ID);
197
  }
198
 
199
  public void setIdIsSet(boolean value) {
200
    __isset_bit_vector.set(__ID_ISSET_ID, value);
201
  }
202
 
203
  public long getTransaction_id() {
204
    return this.transaction_id;
205
  }
206
 
207
  public ExtraOrderInfo setTransaction_id(long transaction_id) {
208
    this.transaction_id = transaction_id;
209
    setTransaction_idIsSet(true);
210
    return this;
211
  }
212
 
213
  public void unsetTransaction_id() {
214
    __isset_bit_vector.clear(__TRANSACTION_ID_ISSET_ID);
215
  }
216
 
217
  /** Returns true if field transaction_id is set (has been asigned a value) and false otherwise */
218
  public boolean isSetTransaction_id() {
219
    return __isset_bit_vector.get(__TRANSACTION_ID_ISSET_ID);
220
  }
221
 
222
  public void setTransaction_idIsSet(boolean value) {
223
    __isset_bit_vector.set(__TRANSACTION_ID_ISSET_ID, value);
224
  }
225
 
226
  public long getSku_id() {
227
    return this.sku_id;
228
  }
229
 
230
  public ExtraOrderInfo setSku_id(long sku_id) {
231
    this.sku_id = sku_id;
232
    setSku_idIsSet(true);
233
    return this;
234
  }
235
 
236
  public void unsetSku_id() {
237
    __isset_bit_vector.clear(__SKU_ID_ISSET_ID);
238
  }
239
 
240
  /** Returns true if field sku_id is set (has been asigned a value) and false otherwise */
241
  public boolean isSetSku_id() {
242
    return __isset_bit_vector.get(__SKU_ID_ISSET_ID);
243
  }
244
 
245
  public void setSku_idIsSet(boolean value) {
246
    __isset_bit_vector.set(__SKU_ID_ISSET_ID, value);
247
  }
248
 
249
  public String getModel_name() {
250
    return this.model_name;
251
  }
252
 
253
  public ExtraOrderInfo setModel_name(String model_name) {
254
    this.model_name = model_name;
255
    return this;
256
  }
257
 
258
  public void unsetModel_name() {
259
    this.model_name = null;
260
  }
261
 
262
  /** Returns true if field model_name is set (has been asigned a value) and false otherwise */
263
  public boolean isSetModel_name() {
264
    return this.model_name != null;
265
  }
266
 
267
  public void setModel_nameIsSet(boolean value) {
268
    if (!value) {
269
      this.model_name = null;
270
    }
271
  }
272
 
273
  public String getVendor_info() {
274
    return this.vendor_info;
275
  }
276
 
277
  public ExtraOrderInfo setVendor_info(String vendor_info) {
278
    this.vendor_info = vendor_info;
279
    return this;
280
  }
281
 
282
  public void unsetVendor_info() {
283
    this.vendor_info = null;
284
  }
285
 
286
  /** Returns true if field vendor_info is set (has been asigned a value) and false otherwise */
287
  public boolean isSetVendor_info() {
288
    return this.vendor_info != null;
289
  }
290
 
291
  public void setVendor_infoIsSet(boolean value) {
292
    if (!value) {
293
      this.vendor_info = null;
294
    }
295
  }
296
 
297
  public String getColour() {
298
    return this.colour;
299
  }
300
 
301
  public ExtraOrderInfo setColour(String colour) {
302
    this.colour = colour;
303
    return this;
304
  }
305
 
306
  public void unsetColour() {
307
    this.colour = null;
308
  }
309
 
310
  /** Returns true if field colour is set (has been asigned a value) and false otherwise */
311
  public boolean isSetColour() {
312
    return this.colour != null;
313
  }
314
 
315
  public void setColourIsSet(boolean value) {
316
    if (!value) {
317
      this.colour = null;
318
    }
319
  }
320
 
321
  public void setFieldValue(_Fields field, Object value) {
322
    switch (field) {
323
    case ID:
324
      if (value == null) {
325
        unsetId();
326
      } else {
327
        setId((Long)value);
328
      }
329
      break;
330
 
331
    case TRANSACTION_ID:
332
      if (value == null) {
333
        unsetTransaction_id();
334
      } else {
335
        setTransaction_id((Long)value);
336
      }
337
      break;
338
 
339
    case SKU_ID:
340
      if (value == null) {
341
        unsetSku_id();
342
      } else {
343
        setSku_id((Long)value);
344
      }
345
      break;
346
 
347
    case MODEL_NAME:
348
      if (value == null) {
349
        unsetModel_name();
350
      } else {
351
        setModel_name((String)value);
352
      }
353
      break;
354
 
355
    case VENDOR_INFO:
356
      if (value == null) {
357
        unsetVendor_info();
358
      } else {
359
        setVendor_info((String)value);
360
      }
361
      break;
362
 
363
    case COLOUR:
364
      if (value == null) {
365
        unsetColour();
366
      } else {
367
        setColour((String)value);
368
      }
369
      break;
370
 
371
    }
372
  }
373
 
374
  public void setFieldValue(int fieldID, Object value) {
375
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
376
  }
377
 
378
  public Object getFieldValue(_Fields field) {
379
    switch (field) {
380
    case ID:
381
      return new Long(getId());
382
 
383
    case TRANSACTION_ID:
384
      return new Long(getTransaction_id());
385
 
386
    case SKU_ID:
387
      return new Long(getSku_id());
388
 
389
    case MODEL_NAME:
390
      return getModel_name();
391
 
392
    case VENDOR_INFO:
393
      return getVendor_info();
394
 
395
    case COLOUR:
396
      return getColour();
397
 
398
    }
399
    throw new IllegalStateException();
400
  }
401
 
402
  public Object getFieldValue(int fieldId) {
403
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
404
  }
405
 
406
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
407
  public boolean isSet(_Fields field) {
408
    switch (field) {
409
    case ID:
410
      return isSetId();
411
    case TRANSACTION_ID:
412
      return isSetTransaction_id();
413
    case SKU_ID:
414
      return isSetSku_id();
415
    case MODEL_NAME:
416
      return isSetModel_name();
417
    case VENDOR_INFO:
418
      return isSetVendor_info();
419
    case COLOUR:
420
      return isSetColour();
421
    }
422
    throw new IllegalStateException();
423
  }
424
 
425
  public boolean isSet(int fieldID) {
426
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
427
  }
428
 
429
  @Override
430
  public boolean equals(Object that) {
431
    if (that == null)
432
      return false;
433
    if (that instanceof ExtraOrderInfo)
434
      return this.equals((ExtraOrderInfo)that);
435
    return false;
436
  }
437
 
438
  public boolean equals(ExtraOrderInfo that) {
439
    if (that == null)
440
      return false;
441
 
442
    boolean this_present_id = true;
443
    boolean that_present_id = true;
444
    if (this_present_id || that_present_id) {
445
      if (!(this_present_id && that_present_id))
446
        return false;
447
      if (this.id != that.id)
448
        return false;
449
    }
450
 
451
    boolean this_present_transaction_id = true;
452
    boolean that_present_transaction_id = true;
453
    if (this_present_transaction_id || that_present_transaction_id) {
454
      if (!(this_present_transaction_id && that_present_transaction_id))
455
        return false;
456
      if (this.transaction_id != that.transaction_id)
457
        return false;
458
    }
459
 
460
    boolean this_present_sku_id = true;
461
    boolean that_present_sku_id = true;
462
    if (this_present_sku_id || that_present_sku_id) {
463
      if (!(this_present_sku_id && that_present_sku_id))
464
        return false;
465
      if (this.sku_id != that.sku_id)
466
        return false;
467
    }
468
 
469
    boolean this_present_model_name = true && this.isSetModel_name();
470
    boolean that_present_model_name = true && that.isSetModel_name();
471
    if (this_present_model_name || that_present_model_name) {
472
      if (!(this_present_model_name && that_present_model_name))
473
        return false;
474
      if (!this.model_name.equals(that.model_name))
475
        return false;
476
    }
477
 
478
    boolean this_present_vendor_info = true && this.isSetVendor_info();
479
    boolean that_present_vendor_info = true && that.isSetVendor_info();
480
    if (this_present_vendor_info || that_present_vendor_info) {
481
      if (!(this_present_vendor_info && that_present_vendor_info))
482
        return false;
483
      if (!this.vendor_info.equals(that.vendor_info))
484
        return false;
485
    }
486
 
487
    boolean this_present_colour = true && this.isSetColour();
488
    boolean that_present_colour = true && that.isSetColour();
489
    if (this_present_colour || that_present_colour) {
490
      if (!(this_present_colour && that_present_colour))
491
        return false;
492
      if (!this.colour.equals(that.colour))
493
        return false;
494
    }
495
 
496
    return true;
497
  }
498
 
499
  @Override
500
  public int hashCode() {
501
    return 0;
502
  }
503
 
504
  public int compareTo(ExtraOrderInfo other) {
505
    if (!getClass().equals(other.getClass())) {
506
      return getClass().getName().compareTo(other.getClass().getName());
507
    }
508
 
509
    int lastComparison = 0;
510
    ExtraOrderInfo typedOther = (ExtraOrderInfo)other;
511
 
512
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
513
    if (lastComparison != 0) {
514
      return lastComparison;
515
    }
516
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
517
    if (lastComparison != 0) {
518
      return lastComparison;
519
    }
520
    lastComparison = Boolean.valueOf(isSetTransaction_id()).compareTo(isSetTransaction_id());
521
    if (lastComparison != 0) {
522
      return lastComparison;
523
    }
524
    lastComparison = TBaseHelper.compareTo(transaction_id, typedOther.transaction_id);
525
    if (lastComparison != 0) {
526
      return lastComparison;
527
    }
528
    lastComparison = Boolean.valueOf(isSetSku_id()).compareTo(isSetSku_id());
529
    if (lastComparison != 0) {
530
      return lastComparison;
531
    }
532
    lastComparison = TBaseHelper.compareTo(sku_id, typedOther.sku_id);
533
    if (lastComparison != 0) {
534
      return lastComparison;
535
    }
536
    lastComparison = Boolean.valueOf(isSetModel_name()).compareTo(isSetModel_name());
537
    if (lastComparison != 0) {
538
      return lastComparison;
539
    }
540
    lastComparison = TBaseHelper.compareTo(model_name, typedOther.model_name);
541
    if (lastComparison != 0) {
542
      return lastComparison;
543
    }
544
    lastComparison = Boolean.valueOf(isSetVendor_info()).compareTo(isSetVendor_info());
545
    if (lastComparison != 0) {
546
      return lastComparison;
547
    }
548
    lastComparison = TBaseHelper.compareTo(vendor_info, typedOther.vendor_info);
549
    if (lastComparison != 0) {
550
      return lastComparison;
551
    }
552
    lastComparison = Boolean.valueOf(isSetColour()).compareTo(isSetColour());
553
    if (lastComparison != 0) {
554
      return lastComparison;
555
    }
556
    lastComparison = TBaseHelper.compareTo(colour, typedOther.colour);
557
    if (lastComparison != 0) {
558
      return lastComparison;
559
    }
560
    return 0;
561
  }
562
 
563
  public void read(TProtocol iprot) throws TException {
564
    TField field;
565
    iprot.readStructBegin();
566
    while (true)
567
    {
568
      field = iprot.readFieldBegin();
569
      if (field.type == TType.STOP) { 
570
        break;
571
      }
572
      _Fields fieldId = _Fields.findByThriftId(field.id);
573
      if (fieldId == null) {
574
        TProtocolUtil.skip(iprot, field.type);
575
      } else {
576
        switch (fieldId) {
577
          case ID:
578
            if (field.type == TType.I64) {
579
              this.id = iprot.readI64();
580
              setIdIsSet(true);
581
            } else { 
582
              TProtocolUtil.skip(iprot, field.type);
583
            }
584
            break;
585
          case TRANSACTION_ID:
586
            if (field.type == TType.I64) {
587
              this.transaction_id = iprot.readI64();
588
              setTransaction_idIsSet(true);
589
            } else { 
590
              TProtocolUtil.skip(iprot, field.type);
591
            }
592
            break;
593
          case SKU_ID:
594
            if (field.type == TType.I64) {
595
              this.sku_id = iprot.readI64();
596
              setSku_idIsSet(true);
597
            } else { 
598
              TProtocolUtil.skip(iprot, field.type);
599
            }
600
            break;
601
          case MODEL_NAME:
602
            if (field.type == TType.STRING) {
603
              this.model_name = iprot.readString();
604
            } else { 
605
              TProtocolUtil.skip(iprot, field.type);
606
            }
607
            break;
608
          case VENDOR_INFO:
609
            if (field.type == TType.STRING) {
610
              this.vendor_info = iprot.readString();
611
            } else { 
612
              TProtocolUtil.skip(iprot, field.type);
613
            }
614
            break;
615
          case COLOUR:
616
            if (field.type == TType.STRING) {
617
              this.colour = iprot.readString();
618
            } else { 
619
              TProtocolUtil.skip(iprot, field.type);
620
            }
621
            break;
622
        }
623
        iprot.readFieldEnd();
624
      }
625
    }
626
    iprot.readStructEnd();
627
    validate();
628
  }
629
 
630
  public void write(TProtocol oprot) throws TException {
631
    validate();
632
 
633
    oprot.writeStructBegin(STRUCT_DESC);
634
    oprot.writeFieldBegin(ID_FIELD_DESC);
635
    oprot.writeI64(this.id);
636
    oprot.writeFieldEnd();
637
    oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
638
    oprot.writeI64(this.transaction_id);
639
    oprot.writeFieldEnd();
640
    oprot.writeFieldBegin(SKU_ID_FIELD_DESC);
641
    oprot.writeI64(this.sku_id);
642
    oprot.writeFieldEnd();
643
    if (this.model_name != null) {
644
      oprot.writeFieldBegin(MODEL_NAME_FIELD_DESC);
645
      oprot.writeString(this.model_name);
646
      oprot.writeFieldEnd();
647
    }
648
    if (this.vendor_info != null) {
649
      oprot.writeFieldBegin(VENDOR_INFO_FIELD_DESC);
650
      oprot.writeString(this.vendor_info);
651
      oprot.writeFieldEnd();
652
    }
653
    if (this.colour != null) {
654
      oprot.writeFieldBegin(COLOUR_FIELD_DESC);
655
      oprot.writeString(this.colour);
656
      oprot.writeFieldEnd();
657
    }
658
    oprot.writeFieldStop();
659
    oprot.writeStructEnd();
660
  }
661
 
662
  @Override
663
  public String toString() {
664
    StringBuilder sb = new StringBuilder("ExtraOrderInfo(");
665
    boolean first = true;
666
 
667
    sb.append("id:");
668
    sb.append(this.id);
669
    first = false;
670
    if (!first) sb.append(", ");
671
    sb.append("transaction_id:");
672
    sb.append(this.transaction_id);
673
    first = false;
674
    if (!first) sb.append(", ");
675
    sb.append("sku_id:");
676
    sb.append(this.sku_id);
677
    first = false;
678
    if (!first) sb.append(", ");
679
    sb.append("model_name:");
680
    if (this.model_name == null) {
681
      sb.append("null");
682
    } else {
683
      sb.append(this.model_name);
684
    }
685
    first = false;
686
    if (!first) sb.append(", ");
687
    sb.append("vendor_info:");
688
    if (this.vendor_info == null) {
689
      sb.append("null");
690
    } else {
691
      sb.append(this.vendor_info);
692
    }
693
    first = false;
694
    if (!first) sb.append(", ");
695
    sb.append("colour:");
696
    if (this.colour == null) {
697
      sb.append("null");
698
    } else {
699
      sb.append(this.colour);
700
    }
701
    first = false;
702
    sb.append(")");
703
    return sb.toString();
704
  }
705
 
706
  public void validate() throws TException {
707
    // check for required fields
708
  }
709
 
710
}
711