Subversion Repositories SmartDukaan

Rev

Rev 1013 | Rev 3430 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
553 chandransh 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 Cart implements TBase<Cart._Fields>, java.io.Serializable, Cloneable, Comparable<Cart> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Cart");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField LINES_FIELD_DESC = new TField("lines", TType.LIST, (short)2);
31
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)3);
32
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)4);
33
  private static final TField UPDATED_ON_FIELD_DESC = new TField("updatedOn", TType.I64, (short)5);
688 chandransh 34
  private static final TField CHECKED_OUT_ON_FIELD_DESC = new TField("checkedOutOn", TType.I64, (short)6);
553 chandransh 35
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)7);
36
  private static final TField ADDRESS_ID_FIELD_DESC = new TField("addressId", TType.I64, (short)8);
1982 varun.gupt 37
  private static final TField TOTAL_PRICE_FIELD_DESC = new TField("totalPrice", TType.DOUBLE, (short)9);
38
  private static final TField DISCOUNTED_PRICE_FIELD_DESC = new TField("discountedPrice", TType.DOUBLE, (short)10);
39
  private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)11);
553 chandransh 40
 
41
  private long id;
42
  private List<Line> lines;
43
  private CartStatus status;
44
  private long createdOn;
45
  private long updatedOn;
688 chandransh 46
  private long checkedOutOn;
553 chandransh 47
  private long userId;
48
  private long addressId;
1982 varun.gupt 49
  private double totalPrice;
50
  private double discountedPrice;
51
  private String couponCode;
553 chandransh 52
 
53
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
54
  public enum _Fields implements TFieldIdEnum {
55
    ID((short)1, "id"),
56
    LINES((short)2, "lines"),
57
    /**
58
     * 
59
     * @see CartStatus
60
     */
61
    STATUS((short)3, "status"),
62
    CREATED_ON((short)4, "createdOn"),
63
    UPDATED_ON((short)5, "updatedOn"),
688 chandransh 64
    CHECKED_OUT_ON((short)6, "checkedOutOn"),
553 chandransh 65
    USER_ID((short)7, "userId"),
1982 varun.gupt 66
    ADDRESS_ID((short)8, "addressId"),
67
    TOTAL_PRICE((short)9, "totalPrice"),
68
    DISCOUNTED_PRICE((short)10, "discountedPrice"),
69
    COUPON_CODE((short)11, "couponCode");
553 chandransh 70
 
71
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
72
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
73
 
74
    static {
75
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
76
        byId.put((int)field._thriftId, field);
77
        byName.put(field.getFieldName(), field);
78
      }
79
    }
80
 
81
    /**
82
     * Find the _Fields constant that matches fieldId, or null if its not found.
83
     */
84
    public static _Fields findByThriftId(int fieldId) {
85
      return byId.get(fieldId);
86
    }
87
 
88
    /**
89
     * Find the _Fields constant that matches fieldId, throwing an exception
90
     * if it is not found.
91
     */
92
    public static _Fields findByThriftIdOrThrow(int fieldId) {
93
      _Fields fields = findByThriftId(fieldId);
94
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
95
      return fields;
96
    }
97
 
98
    /**
99
     * Find the _Fields constant that matches name, or null if its not found.
100
     */
101
    public static _Fields findByName(String name) {
102
      return byName.get(name);
103
    }
104
 
105
    private final short _thriftId;
106
    private final String _fieldName;
107
 
108
    _Fields(short thriftId, String fieldName) {
109
      _thriftId = thriftId;
110
      _fieldName = fieldName;
111
    }
112
 
113
    public short getThriftFieldId() {
114
      return _thriftId;
115
    }
116
 
117
    public String getFieldName() {
118
      return _fieldName;
119
    }
120
  }
121
 
122
  // isset id assignments
123
  private static final int __ID_ISSET_ID = 0;
124
  private static final int __CREATEDON_ISSET_ID = 1;
125
  private static final int __UPDATEDON_ISSET_ID = 2;
688 chandransh 126
  private static final int __CHECKEDOUTON_ISSET_ID = 3;
553 chandransh 127
  private static final int __USERID_ISSET_ID = 4;
128
  private static final int __ADDRESSID_ISSET_ID = 5;
1982 varun.gupt 129
  private static final int __TOTALPRICE_ISSET_ID = 6;
130
  private static final int __DISCOUNTEDPRICE_ISSET_ID = 7;
131
  private BitSet __isset_bit_vector = new BitSet(8);
553 chandransh 132
 
133
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
134
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
135
        new FieldValueMetaData(TType.I64)));
136
    put(_Fields.LINES, new FieldMetaData("lines", TFieldRequirementType.DEFAULT, 
137
        new ListMetaData(TType.LIST, 
138
            new StructMetaData(TType.STRUCT, Line.class))));
139
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
140
        new EnumMetaData(TType.ENUM, CartStatus.class)));
141
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
142
        new FieldValueMetaData(TType.I64)));
143
    put(_Fields.UPDATED_ON, new FieldMetaData("updatedOn", TFieldRequirementType.DEFAULT, 
144
        new FieldValueMetaData(TType.I64)));
688 chandransh 145
    put(_Fields.CHECKED_OUT_ON, new FieldMetaData("checkedOutOn", TFieldRequirementType.DEFAULT, 
553 chandransh 146
        new FieldValueMetaData(TType.I64)));
147
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
148
        new FieldValueMetaData(TType.I64)));
149
    put(_Fields.ADDRESS_ID, new FieldMetaData("addressId", TFieldRequirementType.DEFAULT, 
150
        new FieldValueMetaData(TType.I64)));
1982 varun.gupt 151
    put(_Fields.TOTAL_PRICE, new FieldMetaData("totalPrice", TFieldRequirementType.DEFAULT, 
152
        new FieldValueMetaData(TType.DOUBLE)));
153
    put(_Fields.DISCOUNTED_PRICE, new FieldMetaData("discountedPrice", TFieldRequirementType.DEFAULT, 
154
        new FieldValueMetaData(TType.DOUBLE)));
155
    put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
156
        new FieldValueMetaData(TType.STRING)));
553 chandransh 157
  }});
158
 
159
  static {
160
    FieldMetaData.addStructMetaDataMap(Cart.class, metaDataMap);
161
  }
162
 
163
  public Cart() {
164
  }
165
 
166
  public Cart(
167
    long id,
168
    List<Line> lines,
169
    CartStatus status,
170
    long createdOn,
171
    long updatedOn,
688 chandransh 172
    long checkedOutOn,
553 chandransh 173
    long userId,
1982 varun.gupt 174
    long addressId,
175
    double totalPrice,
176
    double discountedPrice,
177
    String couponCode)
553 chandransh 178
  {
179
    this();
180
    this.id = id;
181
    setIdIsSet(true);
182
    this.lines = lines;
183
    this.status = status;
184
    this.createdOn = createdOn;
185
    setCreatedOnIsSet(true);
186
    this.updatedOn = updatedOn;
187
    setUpdatedOnIsSet(true);
688 chandransh 188
    this.checkedOutOn = checkedOutOn;
189
    setCheckedOutOnIsSet(true);
553 chandransh 190
    this.userId = userId;
191
    setUserIdIsSet(true);
192
    this.addressId = addressId;
193
    setAddressIdIsSet(true);
1982 varun.gupt 194
    this.totalPrice = totalPrice;
195
    setTotalPriceIsSet(true);
196
    this.discountedPrice = discountedPrice;
197
    setDiscountedPriceIsSet(true);
198
    this.couponCode = couponCode;
553 chandransh 199
  }
200
 
201
  /**
202
   * Performs a deep copy on <i>other</i>.
203
   */
204
  public Cart(Cart other) {
205
    __isset_bit_vector.clear();
206
    __isset_bit_vector.or(other.__isset_bit_vector);
207
    this.id = other.id;
208
    if (other.isSetLines()) {
209
      List<Line> __this__lines = new ArrayList<Line>();
210
      for (Line other_element : other.lines) {
211
        __this__lines.add(new Line(other_element));
212
      }
213
      this.lines = __this__lines;
214
    }
215
    if (other.isSetStatus()) {
216
      this.status = other.status;
217
    }
218
    this.createdOn = other.createdOn;
219
    this.updatedOn = other.updatedOn;
688 chandransh 220
    this.checkedOutOn = other.checkedOutOn;
553 chandransh 221
    this.userId = other.userId;
222
    this.addressId = other.addressId;
1982 varun.gupt 223
    this.totalPrice = other.totalPrice;
224
    this.discountedPrice = other.discountedPrice;
225
    if (other.isSetCouponCode()) {
226
      this.couponCode = other.couponCode;
227
    }
553 chandransh 228
  }
229
 
230
  public Cart deepCopy() {
231
    return new Cart(this);
232
  }
233
 
234
  @Deprecated
235
  public Cart clone() {
236
    return new Cart(this);
237
  }
238
 
239
  public long getId() {
240
    return this.id;
241
  }
242
 
243
  public Cart setId(long id) {
244
    this.id = id;
245
    setIdIsSet(true);
246
    return this;
247
  }
248
 
249
  public void unsetId() {
250
    __isset_bit_vector.clear(__ID_ISSET_ID);
251
  }
252
 
253
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
254
  public boolean isSetId() {
255
    return __isset_bit_vector.get(__ID_ISSET_ID);
256
  }
257
 
258
  public void setIdIsSet(boolean value) {
259
    __isset_bit_vector.set(__ID_ISSET_ID, value);
260
  }
261
 
262
  public int getLinesSize() {
263
    return (this.lines == null) ? 0 : this.lines.size();
264
  }
265
 
266
  public java.util.Iterator<Line> getLinesIterator() {
267
    return (this.lines == null) ? null : this.lines.iterator();
268
  }
269
 
270
  public void addToLines(Line elem) {
271
    if (this.lines == null) {
272
      this.lines = new ArrayList<Line>();
273
    }
274
    this.lines.add(elem);
275
  }
276
 
277
  public List<Line> getLines() {
278
    return this.lines;
279
  }
280
 
281
  public Cart setLines(List<Line> lines) {
282
    this.lines = lines;
283
    return this;
284
  }
285
 
286
  public void unsetLines() {
287
    this.lines = null;
288
  }
289
 
290
  /** Returns true if field lines is set (has been asigned a value) and false otherwise */
291
  public boolean isSetLines() {
292
    return this.lines != null;
293
  }
294
 
295
  public void setLinesIsSet(boolean value) {
296
    if (!value) {
297
      this.lines = null;
298
    }
299
  }
300
 
301
  /**
302
   * 
303
   * @see CartStatus
304
   */
305
  public CartStatus getStatus() {
306
    return this.status;
307
  }
308
 
309
  /**
310
   * 
311
   * @see CartStatus
312
   */
313
  public Cart setStatus(CartStatus status) {
314
    this.status = status;
315
    return this;
316
  }
317
 
318
  public void unsetStatus() {
319
    this.status = null;
320
  }
321
 
322
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
323
  public boolean isSetStatus() {
324
    return this.status != null;
325
  }
326
 
327
  public void setStatusIsSet(boolean value) {
328
    if (!value) {
329
      this.status = null;
330
    }
331
  }
332
 
333
  public long getCreatedOn() {
334
    return this.createdOn;
335
  }
336
 
337
  public Cart setCreatedOn(long createdOn) {
338
    this.createdOn = createdOn;
339
    setCreatedOnIsSet(true);
340
    return this;
341
  }
342
 
343
  public void unsetCreatedOn() {
344
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
345
  }
346
 
347
  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
348
  public boolean isSetCreatedOn() {
349
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
350
  }
351
 
352
  public void setCreatedOnIsSet(boolean value) {
353
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
354
  }
355
 
356
  public long getUpdatedOn() {
357
    return this.updatedOn;
358
  }
359
 
360
  public Cart setUpdatedOn(long updatedOn) {
361
    this.updatedOn = updatedOn;
362
    setUpdatedOnIsSet(true);
363
    return this;
364
  }
365
 
366
  public void unsetUpdatedOn() {
367
    __isset_bit_vector.clear(__UPDATEDON_ISSET_ID);
368
  }
369
 
370
  /** Returns true if field updatedOn is set (has been asigned a value) and false otherwise */
371
  public boolean isSetUpdatedOn() {
372
    return __isset_bit_vector.get(__UPDATEDON_ISSET_ID);
373
  }
374
 
375
  public void setUpdatedOnIsSet(boolean value) {
376
    __isset_bit_vector.set(__UPDATEDON_ISSET_ID, value);
377
  }
378
 
688 chandransh 379
  public long getCheckedOutOn() {
380
    return this.checkedOutOn;
553 chandransh 381
  }
382
 
688 chandransh 383
  public Cart setCheckedOutOn(long checkedOutOn) {
384
    this.checkedOutOn = checkedOutOn;
385
    setCheckedOutOnIsSet(true);
553 chandransh 386
    return this;
387
  }
388
 
688 chandransh 389
  public void unsetCheckedOutOn() {
390
    __isset_bit_vector.clear(__CHECKEDOUTON_ISSET_ID);
553 chandransh 391
  }
392
 
688 chandransh 393
  /** Returns true if field checkedOutOn is set (has been asigned a value) and false otherwise */
394
  public boolean isSetCheckedOutOn() {
395
    return __isset_bit_vector.get(__CHECKEDOUTON_ISSET_ID);
553 chandransh 396
  }
397
 
688 chandransh 398
  public void setCheckedOutOnIsSet(boolean value) {
399
    __isset_bit_vector.set(__CHECKEDOUTON_ISSET_ID, value);
553 chandransh 400
  }
401
 
402
  public long getUserId() {
403
    return this.userId;
404
  }
405
 
406
  public Cart setUserId(long userId) {
407
    this.userId = userId;
408
    setUserIdIsSet(true);
409
    return this;
410
  }
411
 
412
  public void unsetUserId() {
413
    __isset_bit_vector.clear(__USERID_ISSET_ID);
414
  }
415
 
416
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
417
  public boolean isSetUserId() {
418
    return __isset_bit_vector.get(__USERID_ISSET_ID);
419
  }
420
 
421
  public void setUserIdIsSet(boolean value) {
422
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
423
  }
424
 
425
  public long getAddressId() {
426
    return this.addressId;
427
  }
428
 
429
  public Cart setAddressId(long addressId) {
430
    this.addressId = addressId;
431
    setAddressIdIsSet(true);
432
    return this;
433
  }
434
 
435
  public void unsetAddressId() {
436
    __isset_bit_vector.clear(__ADDRESSID_ISSET_ID);
437
  }
438
 
439
  /** Returns true if field addressId is set (has been asigned a value) and false otherwise */
440
  public boolean isSetAddressId() {
441
    return __isset_bit_vector.get(__ADDRESSID_ISSET_ID);
442
  }
443
 
444
  public void setAddressIdIsSet(boolean value) {
445
    __isset_bit_vector.set(__ADDRESSID_ISSET_ID, value);
446
  }
447
 
1982 varun.gupt 448
  public double getTotalPrice() {
449
    return this.totalPrice;
450
  }
451
 
452
  public Cart setTotalPrice(double totalPrice) {
453
    this.totalPrice = totalPrice;
454
    setTotalPriceIsSet(true);
455
    return this;
456
  }
457
 
458
  public void unsetTotalPrice() {
459
    __isset_bit_vector.clear(__TOTALPRICE_ISSET_ID);
460
  }
461
 
462
  /** Returns true if field totalPrice is set (has been asigned a value) and false otherwise */
463
  public boolean isSetTotalPrice() {
464
    return __isset_bit_vector.get(__TOTALPRICE_ISSET_ID);
465
  }
466
 
467
  public void setTotalPriceIsSet(boolean value) {
468
    __isset_bit_vector.set(__TOTALPRICE_ISSET_ID, value);
469
  }
470
 
471
  public double getDiscountedPrice() {
472
    return this.discountedPrice;
473
  }
474
 
475
  public Cart setDiscountedPrice(double discountedPrice) {
476
    this.discountedPrice = discountedPrice;
477
    setDiscountedPriceIsSet(true);
478
    return this;
479
  }
480
 
481
  public void unsetDiscountedPrice() {
482
    __isset_bit_vector.clear(__DISCOUNTEDPRICE_ISSET_ID);
483
  }
484
 
485
  /** Returns true if field discountedPrice is set (has been asigned a value) and false otherwise */
486
  public boolean isSetDiscountedPrice() {
487
    return __isset_bit_vector.get(__DISCOUNTEDPRICE_ISSET_ID);
488
  }
489
 
490
  public void setDiscountedPriceIsSet(boolean value) {
491
    __isset_bit_vector.set(__DISCOUNTEDPRICE_ISSET_ID, value);
492
  }
493
 
494
  public String getCouponCode() {
495
    return this.couponCode;
496
  }
497
 
498
  public Cart setCouponCode(String couponCode) {
499
    this.couponCode = couponCode;
500
    return this;
501
  }
502
 
503
  public void unsetCouponCode() {
504
    this.couponCode = null;
505
  }
506
 
507
  /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
508
  public boolean isSetCouponCode() {
509
    return this.couponCode != null;
510
  }
511
 
512
  public void setCouponCodeIsSet(boolean value) {
513
    if (!value) {
514
      this.couponCode = null;
515
    }
516
  }
517
 
553 chandransh 518
  public void setFieldValue(_Fields field, Object value) {
519
    switch (field) {
520
    case ID:
521
      if (value == null) {
522
        unsetId();
523
      } else {
524
        setId((Long)value);
525
      }
526
      break;
527
 
528
    case LINES:
529
      if (value == null) {
530
        unsetLines();
531
      } else {
532
        setLines((List<Line>)value);
533
      }
534
      break;
535
 
536
    case STATUS:
537
      if (value == null) {
538
        unsetStatus();
539
      } else {
540
        setStatus((CartStatus)value);
541
      }
542
      break;
543
 
544
    case CREATED_ON:
545
      if (value == null) {
546
        unsetCreatedOn();
547
      } else {
548
        setCreatedOn((Long)value);
549
      }
550
      break;
551
 
552
    case UPDATED_ON:
553
      if (value == null) {
554
        unsetUpdatedOn();
555
      } else {
556
        setUpdatedOn((Long)value);
557
      }
558
      break;
559
 
688 chandransh 560
    case CHECKED_OUT_ON:
553 chandransh 561
      if (value == null) {
688 chandransh 562
        unsetCheckedOutOn();
553 chandransh 563
      } else {
688 chandransh 564
        setCheckedOutOn((Long)value);
553 chandransh 565
      }
566
      break;
567
 
568
    case USER_ID:
569
      if (value == null) {
570
        unsetUserId();
571
      } else {
572
        setUserId((Long)value);
573
      }
574
      break;
575
 
576
    case ADDRESS_ID:
577
      if (value == null) {
578
        unsetAddressId();
579
      } else {
580
        setAddressId((Long)value);
581
      }
582
      break;
583
 
1982 varun.gupt 584
    case TOTAL_PRICE:
585
      if (value == null) {
586
        unsetTotalPrice();
587
      } else {
588
        setTotalPrice((Double)value);
589
      }
590
      break;
591
 
592
    case DISCOUNTED_PRICE:
593
      if (value == null) {
594
        unsetDiscountedPrice();
595
      } else {
596
        setDiscountedPrice((Double)value);
597
      }
598
      break;
599
 
600
    case COUPON_CODE:
601
      if (value == null) {
602
        unsetCouponCode();
603
      } else {
604
        setCouponCode((String)value);
605
      }
606
      break;
607
 
553 chandransh 608
    }
609
  }
610
 
611
  public void setFieldValue(int fieldID, Object value) {
612
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
613
  }
614
 
615
  public Object getFieldValue(_Fields field) {
616
    switch (field) {
617
    case ID:
618
      return new Long(getId());
619
 
620
    case LINES:
621
      return getLines();
622
 
623
    case STATUS:
624
      return getStatus();
625
 
626
    case CREATED_ON:
627
      return new Long(getCreatedOn());
628
 
629
    case UPDATED_ON:
630
      return new Long(getUpdatedOn());
631
 
688 chandransh 632
    case CHECKED_OUT_ON:
633
      return new Long(getCheckedOutOn());
553 chandransh 634
 
635
    case USER_ID:
636
      return new Long(getUserId());
637
 
638
    case ADDRESS_ID:
639
      return new Long(getAddressId());
640
 
1982 varun.gupt 641
    case TOTAL_PRICE:
642
      return new Double(getTotalPrice());
643
 
644
    case DISCOUNTED_PRICE:
645
      return new Double(getDiscountedPrice());
646
 
647
    case COUPON_CODE:
648
      return getCouponCode();
649
 
553 chandransh 650
    }
651
    throw new IllegalStateException();
652
  }
653
 
654
  public Object getFieldValue(int fieldId) {
655
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
656
  }
657
 
658
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
659
  public boolean isSet(_Fields field) {
660
    switch (field) {
661
    case ID:
662
      return isSetId();
663
    case LINES:
664
      return isSetLines();
665
    case STATUS:
666
      return isSetStatus();
667
    case CREATED_ON:
668
      return isSetCreatedOn();
669
    case UPDATED_ON:
670
      return isSetUpdatedOn();
688 chandransh 671
    case CHECKED_OUT_ON:
672
      return isSetCheckedOutOn();
553 chandransh 673
    case USER_ID:
674
      return isSetUserId();
675
    case ADDRESS_ID:
676
      return isSetAddressId();
1982 varun.gupt 677
    case TOTAL_PRICE:
678
      return isSetTotalPrice();
679
    case DISCOUNTED_PRICE:
680
      return isSetDiscountedPrice();
681
    case COUPON_CODE:
682
      return isSetCouponCode();
553 chandransh 683
    }
684
    throw new IllegalStateException();
685
  }
686
 
687
  public boolean isSet(int fieldID) {
688
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
689
  }
690
 
691
  @Override
692
  public boolean equals(Object that) {
693
    if (that == null)
694
      return false;
695
    if (that instanceof Cart)
696
      return this.equals((Cart)that);
697
    return false;
698
  }
699
 
700
  public boolean equals(Cart that) {
701
    if (that == null)
702
      return false;
703
 
704
    boolean this_present_id = true;
705
    boolean that_present_id = true;
706
    if (this_present_id || that_present_id) {
707
      if (!(this_present_id && that_present_id))
708
        return false;
709
      if (this.id != that.id)
710
        return false;
711
    }
712
 
713
    boolean this_present_lines = true && this.isSetLines();
714
    boolean that_present_lines = true && that.isSetLines();
715
    if (this_present_lines || that_present_lines) {
716
      if (!(this_present_lines && that_present_lines))
717
        return false;
718
      if (!this.lines.equals(that.lines))
719
        return false;
720
    }
721
 
722
    boolean this_present_status = true && this.isSetStatus();
723
    boolean that_present_status = true && that.isSetStatus();
724
    if (this_present_status || that_present_status) {
725
      if (!(this_present_status && that_present_status))
726
        return false;
727
      if (!this.status.equals(that.status))
728
        return false;
729
    }
730
 
731
    boolean this_present_createdOn = true;
732
    boolean that_present_createdOn = true;
733
    if (this_present_createdOn || that_present_createdOn) {
734
      if (!(this_present_createdOn && that_present_createdOn))
735
        return false;
736
      if (this.createdOn != that.createdOn)
737
        return false;
738
    }
739
 
740
    boolean this_present_updatedOn = true;
741
    boolean that_present_updatedOn = true;
742
    if (this_present_updatedOn || that_present_updatedOn) {
743
      if (!(this_present_updatedOn && that_present_updatedOn))
744
        return false;
745
      if (this.updatedOn != that.updatedOn)
746
        return false;
747
    }
748
 
688 chandransh 749
    boolean this_present_checkedOutOn = true;
750
    boolean that_present_checkedOutOn = true;
751
    if (this_present_checkedOutOn || that_present_checkedOutOn) {
752
      if (!(this_present_checkedOutOn && that_present_checkedOutOn))
553 chandransh 753
        return false;
688 chandransh 754
      if (this.checkedOutOn != that.checkedOutOn)
553 chandransh 755
        return false;
756
    }
757
 
758
    boolean this_present_userId = true;
759
    boolean that_present_userId = true;
760
    if (this_present_userId || that_present_userId) {
761
      if (!(this_present_userId && that_present_userId))
762
        return false;
763
      if (this.userId != that.userId)
764
        return false;
765
    }
766
 
767
    boolean this_present_addressId = true;
768
    boolean that_present_addressId = true;
769
    if (this_present_addressId || that_present_addressId) {
770
      if (!(this_present_addressId && that_present_addressId))
771
        return false;
772
      if (this.addressId != that.addressId)
773
        return false;
774
    }
775
 
1982 varun.gupt 776
    boolean this_present_totalPrice = true;
777
    boolean that_present_totalPrice = true;
778
    if (this_present_totalPrice || that_present_totalPrice) {
779
      if (!(this_present_totalPrice && that_present_totalPrice))
780
        return false;
781
      if (this.totalPrice != that.totalPrice)
782
        return false;
783
    }
784
 
785
    boolean this_present_discountedPrice = true;
786
    boolean that_present_discountedPrice = true;
787
    if (this_present_discountedPrice || that_present_discountedPrice) {
788
      if (!(this_present_discountedPrice && that_present_discountedPrice))
789
        return false;
790
      if (this.discountedPrice != that.discountedPrice)
791
        return false;
792
    }
793
 
794
    boolean this_present_couponCode = true && this.isSetCouponCode();
795
    boolean that_present_couponCode = true && that.isSetCouponCode();
796
    if (this_present_couponCode || that_present_couponCode) {
797
      if (!(this_present_couponCode && that_present_couponCode))
798
        return false;
799
      if (!this.couponCode.equals(that.couponCode))
800
        return false;
801
    }
802
 
553 chandransh 803
    return true;
804
  }
805
 
806
  @Override
807
  public int hashCode() {
808
    return 0;
809
  }
810
 
811
  public int compareTo(Cart other) {
812
    if (!getClass().equals(other.getClass())) {
813
      return getClass().getName().compareTo(other.getClass().getName());
814
    }
815
 
816
    int lastComparison = 0;
817
    Cart typedOther = (Cart)other;
818
 
819
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
820
    if (lastComparison != 0) {
821
      return lastComparison;
822
    }
823
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
824
    if (lastComparison != 0) {
825
      return lastComparison;
826
    }
827
    lastComparison = Boolean.valueOf(isSetLines()).compareTo(isSetLines());
828
    if (lastComparison != 0) {
829
      return lastComparison;
830
    }
831
    lastComparison = TBaseHelper.compareTo(lines, typedOther.lines);
832
    if (lastComparison != 0) {
833
      return lastComparison;
834
    }
835
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
836
    if (lastComparison != 0) {
837
      return lastComparison;
838
    }
839
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
840
    if (lastComparison != 0) {
841
      return lastComparison;
842
    }
843
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(isSetCreatedOn());
844
    if (lastComparison != 0) {
845
      return lastComparison;
846
    }
847
    lastComparison = TBaseHelper.compareTo(createdOn, typedOther.createdOn);
848
    if (lastComparison != 0) {
849
      return lastComparison;
850
    }
851
    lastComparison = Boolean.valueOf(isSetUpdatedOn()).compareTo(isSetUpdatedOn());
852
    if (lastComparison != 0) {
853
      return lastComparison;
854
    }
855
    lastComparison = TBaseHelper.compareTo(updatedOn, typedOther.updatedOn);
856
    if (lastComparison != 0) {
857
      return lastComparison;
858
    }
688 chandransh 859
    lastComparison = Boolean.valueOf(isSetCheckedOutOn()).compareTo(isSetCheckedOutOn());
553 chandransh 860
    if (lastComparison != 0) {
861
      return lastComparison;
862
    }
688 chandransh 863
    lastComparison = TBaseHelper.compareTo(checkedOutOn, typedOther.checkedOutOn);
553 chandransh 864
    if (lastComparison != 0) {
865
      return lastComparison;
866
    }
867
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
868
    if (lastComparison != 0) {
869
      return lastComparison;
870
    }
871
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
872
    if (lastComparison != 0) {
873
      return lastComparison;
874
    }
875
    lastComparison = Boolean.valueOf(isSetAddressId()).compareTo(isSetAddressId());
876
    if (lastComparison != 0) {
877
      return lastComparison;
878
    }
879
    lastComparison = TBaseHelper.compareTo(addressId, typedOther.addressId);
880
    if (lastComparison != 0) {
881
      return lastComparison;
882
    }
1982 varun.gupt 883
    lastComparison = Boolean.valueOf(isSetTotalPrice()).compareTo(isSetTotalPrice());
884
    if (lastComparison != 0) {
885
      return lastComparison;
886
    }
887
    lastComparison = TBaseHelper.compareTo(totalPrice, typedOther.totalPrice);
888
    if (lastComparison != 0) {
889
      return lastComparison;
890
    }
891
    lastComparison = Boolean.valueOf(isSetDiscountedPrice()).compareTo(isSetDiscountedPrice());
892
    if (lastComparison != 0) {
893
      return lastComparison;
894
    }
895
    lastComparison = TBaseHelper.compareTo(discountedPrice, typedOther.discountedPrice);
896
    if (lastComparison != 0) {
897
      return lastComparison;
898
    }
899
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
900
    if (lastComparison != 0) {
901
      return lastComparison;
902
    }
903
    lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
904
    if (lastComparison != 0) {
905
      return lastComparison;
906
    }
553 chandransh 907
    return 0;
908
  }
909
 
910
  public void read(TProtocol iprot) throws TException {
911
    TField field;
912
    iprot.readStructBegin();
913
    while (true)
914
    {
915
      field = iprot.readFieldBegin();
916
      if (field.type == TType.STOP) { 
917
        break;
918
      }
919
      _Fields fieldId = _Fields.findByThriftId(field.id);
920
      if (fieldId == null) {
921
        TProtocolUtil.skip(iprot, field.type);
922
      } else {
923
        switch (fieldId) {
924
          case ID:
925
            if (field.type == TType.I64) {
926
              this.id = iprot.readI64();
927
              setIdIsSet(true);
928
            } else { 
929
              TProtocolUtil.skip(iprot, field.type);
930
            }
931
            break;
932
          case LINES:
933
            if (field.type == TType.LIST) {
934
              {
571 rajveer 935
                TList _list8 = iprot.readListBegin();
936
                this.lines = new ArrayList<Line>(_list8.size);
937
                for (int _i9 = 0; _i9 < _list8.size; ++_i9)
553 chandransh 938
                {
571 rajveer 939
                  Line _elem10;
940
                  _elem10 = new Line();
941
                  _elem10.read(iprot);
942
                  this.lines.add(_elem10);
553 chandransh 943
                }
944
                iprot.readListEnd();
945
              }
946
            } else { 
947
              TProtocolUtil.skip(iprot, field.type);
948
            }
949
            break;
950
          case STATUS:
951
            if (field.type == TType.I32) {
952
              this.status = CartStatus.findByValue(iprot.readI32());
953
            } else { 
954
              TProtocolUtil.skip(iprot, field.type);
955
            }
956
            break;
957
          case CREATED_ON:
958
            if (field.type == TType.I64) {
959
              this.createdOn = iprot.readI64();
960
              setCreatedOnIsSet(true);
961
            } else { 
962
              TProtocolUtil.skip(iprot, field.type);
963
            }
964
            break;
965
          case UPDATED_ON:
966
            if (field.type == TType.I64) {
967
              this.updatedOn = iprot.readI64();
968
              setUpdatedOnIsSet(true);
969
            } else { 
970
              TProtocolUtil.skip(iprot, field.type);
971
            }
972
            break;
688 chandransh 973
          case CHECKED_OUT_ON:
553 chandransh 974
            if (field.type == TType.I64) {
688 chandransh 975
              this.checkedOutOn = iprot.readI64();
976
              setCheckedOutOnIsSet(true);
553 chandransh 977
            } else { 
978
              TProtocolUtil.skip(iprot, field.type);
979
            }
980
            break;
981
          case USER_ID:
982
            if (field.type == TType.I64) {
983
              this.userId = iprot.readI64();
984
              setUserIdIsSet(true);
985
            } else { 
986
              TProtocolUtil.skip(iprot, field.type);
987
            }
988
            break;
989
          case ADDRESS_ID:
990
            if (field.type == TType.I64) {
991
              this.addressId = iprot.readI64();
992
              setAddressIdIsSet(true);
993
            } else { 
994
              TProtocolUtil.skip(iprot, field.type);
995
            }
996
            break;
1982 varun.gupt 997
          case TOTAL_PRICE:
998
            if (field.type == TType.DOUBLE) {
999
              this.totalPrice = iprot.readDouble();
1000
              setTotalPriceIsSet(true);
1001
            } else { 
1002
              TProtocolUtil.skip(iprot, field.type);
1003
            }
1004
            break;
1005
          case DISCOUNTED_PRICE:
1006
            if (field.type == TType.DOUBLE) {
1007
              this.discountedPrice = iprot.readDouble();
1008
              setDiscountedPriceIsSet(true);
1009
            } else { 
1010
              TProtocolUtil.skip(iprot, field.type);
1011
            }
1012
            break;
1013
          case COUPON_CODE:
1014
            if (field.type == TType.STRING) {
1015
              this.couponCode = iprot.readString();
1016
            } else { 
1017
              TProtocolUtil.skip(iprot, field.type);
1018
            }
1019
            break;
553 chandransh 1020
        }
1021
        iprot.readFieldEnd();
1022
      }
1023
    }
1024
    iprot.readStructEnd();
1025
    validate();
1026
  }
1027
 
1028
  public void write(TProtocol oprot) throws TException {
1029
    validate();
1030
 
1031
    oprot.writeStructBegin(STRUCT_DESC);
1032
    oprot.writeFieldBegin(ID_FIELD_DESC);
1033
    oprot.writeI64(this.id);
1034
    oprot.writeFieldEnd();
1035
    if (this.lines != null) {
1036
      oprot.writeFieldBegin(LINES_FIELD_DESC);
1037
      {
1038
        oprot.writeListBegin(new TList(TType.STRUCT, this.lines.size()));
571 rajveer 1039
        for (Line _iter11 : this.lines)
553 chandransh 1040
        {
571 rajveer 1041
          _iter11.write(oprot);
553 chandransh 1042
        }
1043
        oprot.writeListEnd();
1044
      }
1045
      oprot.writeFieldEnd();
1046
    }
1047
    if (this.status != null) {
1048
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
1049
      oprot.writeI32(this.status.getValue());
1050
      oprot.writeFieldEnd();
1051
    }
1052
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
1053
    oprot.writeI64(this.createdOn);
1054
    oprot.writeFieldEnd();
1055
    oprot.writeFieldBegin(UPDATED_ON_FIELD_DESC);
1056
    oprot.writeI64(this.updatedOn);
1057
    oprot.writeFieldEnd();
688 chandransh 1058
    oprot.writeFieldBegin(CHECKED_OUT_ON_FIELD_DESC);
1059
    oprot.writeI64(this.checkedOutOn);
553 chandransh 1060
    oprot.writeFieldEnd();
1061
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
1062
    oprot.writeI64(this.userId);
1063
    oprot.writeFieldEnd();
1064
    oprot.writeFieldBegin(ADDRESS_ID_FIELD_DESC);
1065
    oprot.writeI64(this.addressId);
1066
    oprot.writeFieldEnd();
1982 varun.gupt 1067
    oprot.writeFieldBegin(TOTAL_PRICE_FIELD_DESC);
1068
    oprot.writeDouble(this.totalPrice);
1069
    oprot.writeFieldEnd();
1070
    oprot.writeFieldBegin(DISCOUNTED_PRICE_FIELD_DESC);
1071
    oprot.writeDouble(this.discountedPrice);
1072
    oprot.writeFieldEnd();
1073
    if (this.couponCode != null) {
1074
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
1075
      oprot.writeString(this.couponCode);
1076
      oprot.writeFieldEnd();
1077
    }
553 chandransh 1078
    oprot.writeFieldStop();
1079
    oprot.writeStructEnd();
1080
  }
1081
 
1082
  @Override
1083
  public String toString() {
1084
    StringBuilder sb = new StringBuilder("Cart(");
1085
    boolean first = true;
1086
 
1087
    sb.append("id:");
1088
    sb.append(this.id);
1089
    first = false;
1090
    if (!first) sb.append(", ");
1091
    sb.append("lines:");
1092
    if (this.lines == null) {
1093
      sb.append("null");
1094
    } else {
1095
      sb.append(this.lines);
1096
    }
1097
    first = false;
1098
    if (!first) sb.append(", ");
1099
    sb.append("status:");
1100
    if (this.status == null) {
1101
      sb.append("null");
1102
    } else {
1103
      String status_name = status.name();
1104
      if (status_name != null) {
1105
        sb.append(status_name);
1106
        sb.append(" (");
1107
      }
1108
      sb.append(this.status);
1109
      if (status_name != null) {
1110
        sb.append(")");
1111
      }
1112
    }
1113
    first = false;
1114
    if (!first) sb.append(", ");
1115
    sb.append("createdOn:");
1116
    sb.append(this.createdOn);
1117
    first = false;
1118
    if (!first) sb.append(", ");
1119
    sb.append("updatedOn:");
1120
    sb.append(this.updatedOn);
1121
    first = false;
1122
    if (!first) sb.append(", ");
688 chandransh 1123
    sb.append("checkedOutOn:");
1124
    sb.append(this.checkedOutOn);
553 chandransh 1125
    first = false;
1126
    if (!first) sb.append(", ");
1127
    sb.append("userId:");
1128
    sb.append(this.userId);
1129
    first = false;
1130
    if (!first) sb.append(", ");
1131
    sb.append("addressId:");
1132
    sb.append(this.addressId);
1133
    first = false;
1982 varun.gupt 1134
    if (!first) sb.append(", ");
1135
    sb.append("totalPrice:");
1136
    sb.append(this.totalPrice);
1137
    first = false;
1138
    if (!first) sb.append(", ");
1139
    sb.append("discountedPrice:");
1140
    sb.append(this.discountedPrice);
1141
    first = false;
1142
    if (!first) sb.append(", ");
1143
    sb.append("couponCode:");
1144
    if (this.couponCode == null) {
1145
      sb.append("null");
1146
    } else {
1147
      sb.append(this.couponCode);
1148
    }
1149
    first = false;
553 chandransh 1150
    sb.append(")");
1151
    return sb.toString();
1152
  }
1153
 
1154
  public void validate() throws TException {
1155
    // check for required fields
1156
  }
1157
 
1158
}
1159