Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | 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);
37
 
38
  private long id;
39
  private List<Line> lines;
40
  private CartStatus status;
41
  private long createdOn;
42
  private long updatedOn;
688 chandransh 43
  private long checkedOutOn;
553 chandransh 44
  private long userId;
45
  private long addressId;
46
 
47
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
48
  public enum _Fields implements TFieldIdEnum {
49
    ID((short)1, "id"),
50
    LINES((short)2, "lines"),
51
    /**
52
     * 
53
     * @see CartStatus
54
     */
55
    STATUS((short)3, "status"),
56
    CREATED_ON((short)4, "createdOn"),
57
    UPDATED_ON((short)5, "updatedOn"),
688 chandransh 58
    CHECKED_OUT_ON((short)6, "checkedOutOn"),
553 chandransh 59
    USER_ID((short)7, "userId"),
614 chandransh 60
    ADDRESS_ID((short)8, "addressId");
553 chandransh 61
 
62
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
63
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
64
 
65
    static {
66
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
67
        byId.put((int)field._thriftId, field);
68
        byName.put(field.getFieldName(), field);
69
      }
70
    }
71
 
72
    /**
73
     * Find the _Fields constant that matches fieldId, or null if its not found.
74
     */
75
    public static _Fields findByThriftId(int fieldId) {
76
      return byId.get(fieldId);
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches fieldId, throwing an exception
81
     * if it is not found.
82
     */
83
    public static _Fields findByThriftIdOrThrow(int fieldId) {
84
      _Fields fields = findByThriftId(fieldId);
85
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
86
      return fields;
87
    }
88
 
89
    /**
90
     * Find the _Fields constant that matches name, or null if its not found.
91
     */
92
    public static _Fields findByName(String name) {
93
      return byName.get(name);
94
    }
95
 
96
    private final short _thriftId;
97
    private final String _fieldName;
98
 
99
    _Fields(short thriftId, String fieldName) {
100
      _thriftId = thriftId;
101
      _fieldName = fieldName;
102
    }
103
 
104
    public short getThriftFieldId() {
105
      return _thriftId;
106
    }
107
 
108
    public String getFieldName() {
109
      return _fieldName;
110
    }
111
  }
112
 
113
  // isset id assignments
114
  private static final int __ID_ISSET_ID = 0;
115
  private static final int __CREATEDON_ISSET_ID = 1;
116
  private static final int __UPDATEDON_ISSET_ID = 2;
688 chandransh 117
  private static final int __CHECKEDOUTON_ISSET_ID = 3;
553 chandransh 118
  private static final int __USERID_ISSET_ID = 4;
119
  private static final int __ADDRESSID_ISSET_ID = 5;
614 chandransh 120
  private BitSet __isset_bit_vector = new BitSet(6);
553 chandransh 121
 
122
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
123
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
124
        new FieldValueMetaData(TType.I64)));
125
    put(_Fields.LINES, new FieldMetaData("lines", TFieldRequirementType.DEFAULT, 
126
        new ListMetaData(TType.LIST, 
127
            new StructMetaData(TType.STRUCT, Line.class))));
128
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
129
        new EnumMetaData(TType.ENUM, CartStatus.class)));
130
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
131
        new FieldValueMetaData(TType.I64)));
132
    put(_Fields.UPDATED_ON, new FieldMetaData("updatedOn", TFieldRequirementType.DEFAULT, 
133
        new FieldValueMetaData(TType.I64)));
688 chandransh 134
    put(_Fields.CHECKED_OUT_ON, new FieldMetaData("checkedOutOn", TFieldRequirementType.DEFAULT, 
553 chandransh 135
        new FieldValueMetaData(TType.I64)));
136
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
137
        new FieldValueMetaData(TType.I64)));
138
    put(_Fields.ADDRESS_ID, new FieldMetaData("addressId", TFieldRequirementType.DEFAULT, 
139
        new FieldValueMetaData(TType.I64)));
140
  }});
141
 
142
  static {
143
    FieldMetaData.addStructMetaDataMap(Cart.class, metaDataMap);
144
  }
145
 
146
  public Cart() {
147
  }
148
 
149
  public Cart(
150
    long id,
151
    List<Line> lines,
152
    CartStatus status,
153
    long createdOn,
154
    long updatedOn,
688 chandransh 155
    long checkedOutOn,
553 chandransh 156
    long userId,
614 chandransh 157
    long addressId)
553 chandransh 158
  {
159
    this();
160
    this.id = id;
161
    setIdIsSet(true);
162
    this.lines = lines;
163
    this.status = status;
164
    this.createdOn = createdOn;
165
    setCreatedOnIsSet(true);
166
    this.updatedOn = updatedOn;
167
    setUpdatedOnIsSet(true);
688 chandransh 168
    this.checkedOutOn = checkedOutOn;
169
    setCheckedOutOnIsSet(true);
553 chandransh 170
    this.userId = userId;
171
    setUserIdIsSet(true);
172
    this.addressId = addressId;
173
    setAddressIdIsSet(true);
174
  }
175
 
176
  /**
177
   * Performs a deep copy on <i>other</i>.
178
   */
179
  public Cart(Cart other) {
180
    __isset_bit_vector.clear();
181
    __isset_bit_vector.or(other.__isset_bit_vector);
182
    this.id = other.id;
183
    if (other.isSetLines()) {
184
      List<Line> __this__lines = new ArrayList<Line>();
185
      for (Line other_element : other.lines) {
186
        __this__lines.add(new Line(other_element));
187
      }
188
      this.lines = __this__lines;
189
    }
190
    if (other.isSetStatus()) {
191
      this.status = other.status;
192
    }
193
    this.createdOn = other.createdOn;
194
    this.updatedOn = other.updatedOn;
688 chandransh 195
    this.checkedOutOn = other.checkedOutOn;
553 chandransh 196
    this.userId = other.userId;
197
    this.addressId = other.addressId;
198
  }
199
 
200
  public Cart deepCopy() {
201
    return new Cart(this);
202
  }
203
 
204
  @Deprecated
205
  public Cart clone() {
206
    return new Cart(this);
207
  }
208
 
209
  public long getId() {
210
    return this.id;
211
  }
212
 
213
  public Cart setId(long id) {
214
    this.id = id;
215
    setIdIsSet(true);
216
    return this;
217
  }
218
 
219
  public void unsetId() {
220
    __isset_bit_vector.clear(__ID_ISSET_ID);
221
  }
222
 
223
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
224
  public boolean isSetId() {
225
    return __isset_bit_vector.get(__ID_ISSET_ID);
226
  }
227
 
228
  public void setIdIsSet(boolean value) {
229
    __isset_bit_vector.set(__ID_ISSET_ID, value);
230
  }
231
 
232
  public int getLinesSize() {
233
    return (this.lines == null) ? 0 : this.lines.size();
234
  }
235
 
236
  public java.util.Iterator<Line> getLinesIterator() {
237
    return (this.lines == null) ? null : this.lines.iterator();
238
  }
239
 
240
  public void addToLines(Line elem) {
241
    if (this.lines == null) {
242
      this.lines = new ArrayList<Line>();
243
    }
244
    this.lines.add(elem);
245
  }
246
 
247
  public List<Line> getLines() {
248
    return this.lines;
249
  }
250
 
251
  public Cart setLines(List<Line> lines) {
252
    this.lines = lines;
253
    return this;
254
  }
255
 
256
  public void unsetLines() {
257
    this.lines = null;
258
  }
259
 
260
  /** Returns true if field lines is set (has been asigned a value) and false otherwise */
261
  public boolean isSetLines() {
262
    return this.lines != null;
263
  }
264
 
265
  public void setLinesIsSet(boolean value) {
266
    if (!value) {
267
      this.lines = null;
268
    }
269
  }
270
 
271
  /**
272
   * 
273
   * @see CartStatus
274
   */
275
  public CartStatus getStatus() {
276
    return this.status;
277
  }
278
 
279
  /**
280
   * 
281
   * @see CartStatus
282
   */
283
  public Cart setStatus(CartStatus status) {
284
    this.status = status;
285
    return this;
286
  }
287
 
288
  public void unsetStatus() {
289
    this.status = null;
290
  }
291
 
292
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
293
  public boolean isSetStatus() {
294
    return this.status != null;
295
  }
296
 
297
  public void setStatusIsSet(boolean value) {
298
    if (!value) {
299
      this.status = null;
300
    }
301
  }
302
 
303
  public long getCreatedOn() {
304
    return this.createdOn;
305
  }
306
 
307
  public Cart setCreatedOn(long createdOn) {
308
    this.createdOn = createdOn;
309
    setCreatedOnIsSet(true);
310
    return this;
311
  }
312
 
313
  public void unsetCreatedOn() {
314
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
315
  }
316
 
317
  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
318
  public boolean isSetCreatedOn() {
319
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
320
  }
321
 
322
  public void setCreatedOnIsSet(boolean value) {
323
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
324
  }
325
 
326
  public long getUpdatedOn() {
327
    return this.updatedOn;
328
  }
329
 
330
  public Cart setUpdatedOn(long updatedOn) {
331
    this.updatedOn = updatedOn;
332
    setUpdatedOnIsSet(true);
333
    return this;
334
  }
335
 
336
  public void unsetUpdatedOn() {
337
    __isset_bit_vector.clear(__UPDATEDON_ISSET_ID);
338
  }
339
 
340
  /** Returns true if field updatedOn is set (has been asigned a value) and false otherwise */
341
  public boolean isSetUpdatedOn() {
342
    return __isset_bit_vector.get(__UPDATEDON_ISSET_ID);
343
  }
344
 
345
  public void setUpdatedOnIsSet(boolean value) {
346
    __isset_bit_vector.set(__UPDATEDON_ISSET_ID, value);
347
  }
348
 
688 chandransh 349
  public long getCheckedOutOn() {
350
    return this.checkedOutOn;
553 chandransh 351
  }
352
 
688 chandransh 353
  public Cart setCheckedOutOn(long checkedOutOn) {
354
    this.checkedOutOn = checkedOutOn;
355
    setCheckedOutOnIsSet(true);
553 chandransh 356
    return this;
357
  }
358
 
688 chandransh 359
  public void unsetCheckedOutOn() {
360
    __isset_bit_vector.clear(__CHECKEDOUTON_ISSET_ID);
553 chandransh 361
  }
362
 
688 chandransh 363
  /** Returns true if field checkedOutOn is set (has been asigned a value) and false otherwise */
364
  public boolean isSetCheckedOutOn() {
365
    return __isset_bit_vector.get(__CHECKEDOUTON_ISSET_ID);
553 chandransh 366
  }
367
 
688 chandransh 368
  public void setCheckedOutOnIsSet(boolean value) {
369
    __isset_bit_vector.set(__CHECKEDOUTON_ISSET_ID, value);
553 chandransh 370
  }
371
 
372
  public long getUserId() {
373
    return this.userId;
374
  }
375
 
376
  public Cart setUserId(long userId) {
377
    this.userId = userId;
378
    setUserIdIsSet(true);
379
    return this;
380
  }
381
 
382
  public void unsetUserId() {
383
    __isset_bit_vector.clear(__USERID_ISSET_ID);
384
  }
385
 
386
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
387
  public boolean isSetUserId() {
388
    return __isset_bit_vector.get(__USERID_ISSET_ID);
389
  }
390
 
391
  public void setUserIdIsSet(boolean value) {
392
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
393
  }
394
 
395
  public long getAddressId() {
396
    return this.addressId;
397
  }
398
 
399
  public Cart setAddressId(long addressId) {
400
    this.addressId = addressId;
401
    setAddressIdIsSet(true);
402
    return this;
403
  }
404
 
405
  public void unsetAddressId() {
406
    __isset_bit_vector.clear(__ADDRESSID_ISSET_ID);
407
  }
408
 
409
  /** Returns true if field addressId is set (has been asigned a value) and false otherwise */
410
  public boolean isSetAddressId() {
411
    return __isset_bit_vector.get(__ADDRESSID_ISSET_ID);
412
  }
413
 
414
  public void setAddressIdIsSet(boolean value) {
415
    __isset_bit_vector.set(__ADDRESSID_ISSET_ID, value);
416
  }
417
 
418
  public void setFieldValue(_Fields field, Object value) {
419
    switch (field) {
420
    case ID:
421
      if (value == null) {
422
        unsetId();
423
      } else {
424
        setId((Long)value);
425
      }
426
      break;
427
 
428
    case LINES:
429
      if (value == null) {
430
        unsetLines();
431
      } else {
432
        setLines((List<Line>)value);
433
      }
434
      break;
435
 
436
    case STATUS:
437
      if (value == null) {
438
        unsetStatus();
439
      } else {
440
        setStatus((CartStatus)value);
441
      }
442
      break;
443
 
444
    case CREATED_ON:
445
      if (value == null) {
446
        unsetCreatedOn();
447
      } else {
448
        setCreatedOn((Long)value);
449
      }
450
      break;
451
 
452
    case UPDATED_ON:
453
      if (value == null) {
454
        unsetUpdatedOn();
455
      } else {
456
        setUpdatedOn((Long)value);
457
      }
458
      break;
459
 
688 chandransh 460
    case CHECKED_OUT_ON:
553 chandransh 461
      if (value == null) {
688 chandransh 462
        unsetCheckedOutOn();
553 chandransh 463
      } else {
688 chandransh 464
        setCheckedOutOn((Long)value);
553 chandransh 465
      }
466
      break;
467
 
468
    case USER_ID:
469
      if (value == null) {
470
        unsetUserId();
471
      } else {
472
        setUserId((Long)value);
473
      }
474
      break;
475
 
476
    case ADDRESS_ID:
477
      if (value == null) {
478
        unsetAddressId();
479
      } else {
480
        setAddressId((Long)value);
481
      }
482
      break;
483
 
484
    }
485
  }
486
 
487
  public void setFieldValue(int fieldID, Object value) {
488
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
489
  }
490
 
491
  public Object getFieldValue(_Fields field) {
492
    switch (field) {
493
    case ID:
494
      return new Long(getId());
495
 
496
    case LINES:
497
      return getLines();
498
 
499
    case STATUS:
500
      return getStatus();
501
 
502
    case CREATED_ON:
503
      return new Long(getCreatedOn());
504
 
505
    case UPDATED_ON:
506
      return new Long(getUpdatedOn());
507
 
688 chandransh 508
    case CHECKED_OUT_ON:
509
      return new Long(getCheckedOutOn());
553 chandransh 510
 
511
    case USER_ID:
512
      return new Long(getUserId());
513
 
514
    case ADDRESS_ID:
515
      return new Long(getAddressId());
516
 
517
    }
518
    throw new IllegalStateException();
519
  }
520
 
521
  public Object getFieldValue(int fieldId) {
522
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
523
  }
524
 
525
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
526
  public boolean isSet(_Fields field) {
527
    switch (field) {
528
    case ID:
529
      return isSetId();
530
    case LINES:
531
      return isSetLines();
532
    case STATUS:
533
      return isSetStatus();
534
    case CREATED_ON:
535
      return isSetCreatedOn();
536
    case UPDATED_ON:
537
      return isSetUpdatedOn();
688 chandransh 538
    case CHECKED_OUT_ON:
539
      return isSetCheckedOutOn();
553 chandransh 540
    case USER_ID:
541
      return isSetUserId();
542
    case ADDRESS_ID:
543
      return isSetAddressId();
544
    }
545
    throw new IllegalStateException();
546
  }
547
 
548
  public boolean isSet(int fieldID) {
549
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
550
  }
551
 
552
  @Override
553
  public boolean equals(Object that) {
554
    if (that == null)
555
      return false;
556
    if (that instanceof Cart)
557
      return this.equals((Cart)that);
558
    return false;
559
  }
560
 
561
  public boolean equals(Cart that) {
562
    if (that == null)
563
      return false;
564
 
565
    boolean this_present_id = true;
566
    boolean that_present_id = true;
567
    if (this_present_id || that_present_id) {
568
      if (!(this_present_id && that_present_id))
569
        return false;
570
      if (this.id != that.id)
571
        return false;
572
    }
573
 
574
    boolean this_present_lines = true && this.isSetLines();
575
    boolean that_present_lines = true && that.isSetLines();
576
    if (this_present_lines || that_present_lines) {
577
      if (!(this_present_lines && that_present_lines))
578
        return false;
579
      if (!this.lines.equals(that.lines))
580
        return false;
581
    }
582
 
583
    boolean this_present_status = true && this.isSetStatus();
584
    boolean that_present_status = true && that.isSetStatus();
585
    if (this_present_status || that_present_status) {
586
      if (!(this_present_status && that_present_status))
587
        return false;
588
      if (!this.status.equals(that.status))
589
        return false;
590
    }
591
 
592
    boolean this_present_createdOn = true;
593
    boolean that_present_createdOn = true;
594
    if (this_present_createdOn || that_present_createdOn) {
595
      if (!(this_present_createdOn && that_present_createdOn))
596
        return false;
597
      if (this.createdOn != that.createdOn)
598
        return false;
599
    }
600
 
601
    boolean this_present_updatedOn = true;
602
    boolean that_present_updatedOn = true;
603
    if (this_present_updatedOn || that_present_updatedOn) {
604
      if (!(this_present_updatedOn && that_present_updatedOn))
605
        return false;
606
      if (this.updatedOn != that.updatedOn)
607
        return false;
608
    }
609
 
688 chandransh 610
    boolean this_present_checkedOutOn = true;
611
    boolean that_present_checkedOutOn = true;
612
    if (this_present_checkedOutOn || that_present_checkedOutOn) {
613
      if (!(this_present_checkedOutOn && that_present_checkedOutOn))
553 chandransh 614
        return false;
688 chandransh 615
      if (this.checkedOutOn != that.checkedOutOn)
553 chandransh 616
        return false;
617
    }
618
 
619
    boolean this_present_userId = true;
620
    boolean that_present_userId = true;
621
    if (this_present_userId || that_present_userId) {
622
      if (!(this_present_userId && that_present_userId))
623
        return false;
624
      if (this.userId != that.userId)
625
        return false;
626
    }
627
 
628
    boolean this_present_addressId = true;
629
    boolean that_present_addressId = true;
630
    if (this_present_addressId || that_present_addressId) {
631
      if (!(this_present_addressId && that_present_addressId))
632
        return false;
633
      if (this.addressId != that.addressId)
634
        return false;
635
    }
636
 
637
    return true;
638
  }
639
 
640
  @Override
641
  public int hashCode() {
642
    return 0;
643
  }
644
 
645
  public int compareTo(Cart other) {
646
    if (!getClass().equals(other.getClass())) {
647
      return getClass().getName().compareTo(other.getClass().getName());
648
    }
649
 
650
    int lastComparison = 0;
651
    Cart typedOther = (Cart)other;
652
 
653
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
654
    if (lastComparison != 0) {
655
      return lastComparison;
656
    }
657
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
658
    if (lastComparison != 0) {
659
      return lastComparison;
660
    }
661
    lastComparison = Boolean.valueOf(isSetLines()).compareTo(isSetLines());
662
    if (lastComparison != 0) {
663
      return lastComparison;
664
    }
665
    lastComparison = TBaseHelper.compareTo(lines, typedOther.lines);
666
    if (lastComparison != 0) {
667
      return lastComparison;
668
    }
669
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
670
    if (lastComparison != 0) {
671
      return lastComparison;
672
    }
673
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
674
    if (lastComparison != 0) {
675
      return lastComparison;
676
    }
677
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(isSetCreatedOn());
678
    if (lastComparison != 0) {
679
      return lastComparison;
680
    }
681
    lastComparison = TBaseHelper.compareTo(createdOn, typedOther.createdOn);
682
    if (lastComparison != 0) {
683
      return lastComparison;
684
    }
685
    lastComparison = Boolean.valueOf(isSetUpdatedOn()).compareTo(isSetUpdatedOn());
686
    if (lastComparison != 0) {
687
      return lastComparison;
688
    }
689
    lastComparison = TBaseHelper.compareTo(updatedOn, typedOther.updatedOn);
690
    if (lastComparison != 0) {
691
      return lastComparison;
692
    }
688 chandransh 693
    lastComparison = Boolean.valueOf(isSetCheckedOutOn()).compareTo(isSetCheckedOutOn());
553 chandransh 694
    if (lastComparison != 0) {
695
      return lastComparison;
696
    }
688 chandransh 697
    lastComparison = TBaseHelper.compareTo(checkedOutOn, typedOther.checkedOutOn);
553 chandransh 698
    if (lastComparison != 0) {
699
      return lastComparison;
700
    }
701
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
702
    if (lastComparison != 0) {
703
      return lastComparison;
704
    }
705
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
706
    if (lastComparison != 0) {
707
      return lastComparison;
708
    }
709
    lastComparison = Boolean.valueOf(isSetAddressId()).compareTo(isSetAddressId());
710
    if (lastComparison != 0) {
711
      return lastComparison;
712
    }
713
    lastComparison = TBaseHelper.compareTo(addressId, typedOther.addressId);
714
    if (lastComparison != 0) {
715
      return lastComparison;
716
    }
717
    return 0;
718
  }
719
 
720
  public void read(TProtocol iprot) throws TException {
721
    TField field;
722
    iprot.readStructBegin();
723
    while (true)
724
    {
725
      field = iprot.readFieldBegin();
726
      if (field.type == TType.STOP) { 
727
        break;
728
      }
729
      _Fields fieldId = _Fields.findByThriftId(field.id);
730
      if (fieldId == null) {
731
        TProtocolUtil.skip(iprot, field.type);
732
      } else {
733
        switch (fieldId) {
734
          case ID:
735
            if (field.type == TType.I64) {
736
              this.id = iprot.readI64();
737
              setIdIsSet(true);
738
            } else { 
739
              TProtocolUtil.skip(iprot, field.type);
740
            }
741
            break;
742
          case LINES:
743
            if (field.type == TType.LIST) {
744
              {
571 rajveer 745
                TList _list8 = iprot.readListBegin();
746
                this.lines = new ArrayList<Line>(_list8.size);
747
                for (int _i9 = 0; _i9 < _list8.size; ++_i9)
553 chandransh 748
                {
571 rajveer 749
                  Line _elem10;
750
                  _elem10 = new Line();
751
                  _elem10.read(iprot);
752
                  this.lines.add(_elem10);
553 chandransh 753
                }
754
                iprot.readListEnd();
755
              }
756
            } else { 
757
              TProtocolUtil.skip(iprot, field.type);
758
            }
759
            break;
760
          case STATUS:
761
            if (field.type == TType.I32) {
762
              this.status = CartStatus.findByValue(iprot.readI32());
763
            } else { 
764
              TProtocolUtil.skip(iprot, field.type);
765
            }
766
            break;
767
          case CREATED_ON:
768
            if (field.type == TType.I64) {
769
              this.createdOn = iprot.readI64();
770
              setCreatedOnIsSet(true);
771
            } else { 
772
              TProtocolUtil.skip(iprot, field.type);
773
            }
774
            break;
775
          case UPDATED_ON:
776
            if (field.type == TType.I64) {
777
              this.updatedOn = iprot.readI64();
778
              setUpdatedOnIsSet(true);
779
            } else { 
780
              TProtocolUtil.skip(iprot, field.type);
781
            }
782
            break;
688 chandransh 783
          case CHECKED_OUT_ON:
553 chandransh 784
            if (field.type == TType.I64) {
688 chandransh 785
              this.checkedOutOn = iprot.readI64();
786
              setCheckedOutOnIsSet(true);
553 chandransh 787
            } else { 
788
              TProtocolUtil.skip(iprot, field.type);
789
            }
790
            break;
791
          case USER_ID:
792
            if (field.type == TType.I64) {
793
              this.userId = iprot.readI64();
794
              setUserIdIsSet(true);
795
            } else { 
796
              TProtocolUtil.skip(iprot, field.type);
797
            }
798
            break;
799
          case ADDRESS_ID:
800
            if (field.type == TType.I64) {
801
              this.addressId = iprot.readI64();
802
              setAddressIdIsSet(true);
803
            } else { 
804
              TProtocolUtil.skip(iprot, field.type);
805
            }
806
            break;
807
        }
808
        iprot.readFieldEnd();
809
      }
810
    }
811
    iprot.readStructEnd();
812
    validate();
813
  }
814
 
815
  public void write(TProtocol oprot) throws TException {
816
    validate();
817
 
818
    oprot.writeStructBegin(STRUCT_DESC);
819
    oprot.writeFieldBegin(ID_FIELD_DESC);
820
    oprot.writeI64(this.id);
821
    oprot.writeFieldEnd();
822
    if (this.lines != null) {
823
      oprot.writeFieldBegin(LINES_FIELD_DESC);
824
      {
825
        oprot.writeListBegin(new TList(TType.STRUCT, this.lines.size()));
571 rajveer 826
        for (Line _iter11 : this.lines)
553 chandransh 827
        {
571 rajveer 828
          _iter11.write(oprot);
553 chandransh 829
        }
830
        oprot.writeListEnd();
831
      }
832
      oprot.writeFieldEnd();
833
    }
834
    if (this.status != null) {
835
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
836
      oprot.writeI32(this.status.getValue());
837
      oprot.writeFieldEnd();
838
    }
839
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
840
    oprot.writeI64(this.createdOn);
841
    oprot.writeFieldEnd();
842
    oprot.writeFieldBegin(UPDATED_ON_FIELD_DESC);
843
    oprot.writeI64(this.updatedOn);
844
    oprot.writeFieldEnd();
688 chandransh 845
    oprot.writeFieldBegin(CHECKED_OUT_ON_FIELD_DESC);
846
    oprot.writeI64(this.checkedOutOn);
553 chandransh 847
    oprot.writeFieldEnd();
848
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
849
    oprot.writeI64(this.userId);
850
    oprot.writeFieldEnd();
851
    oprot.writeFieldBegin(ADDRESS_ID_FIELD_DESC);
852
    oprot.writeI64(this.addressId);
853
    oprot.writeFieldEnd();
854
    oprot.writeFieldStop();
855
    oprot.writeStructEnd();
856
  }
857
 
858
  @Override
859
  public String toString() {
860
    StringBuilder sb = new StringBuilder("Cart(");
861
    boolean first = true;
862
 
863
    sb.append("id:");
864
    sb.append(this.id);
865
    first = false;
866
    if (!first) sb.append(", ");
867
    sb.append("lines:");
868
    if (this.lines == null) {
869
      sb.append("null");
870
    } else {
871
      sb.append(this.lines);
872
    }
873
    first = false;
874
    if (!first) sb.append(", ");
875
    sb.append("status:");
876
    if (this.status == null) {
877
      sb.append("null");
878
    } else {
879
      String status_name = status.name();
880
      if (status_name != null) {
881
        sb.append(status_name);
882
        sb.append(" (");
883
      }
884
      sb.append(this.status);
885
      if (status_name != null) {
886
        sb.append(")");
887
      }
888
    }
889
    first = false;
890
    if (!first) sb.append(", ");
891
    sb.append("createdOn:");
892
    sb.append(this.createdOn);
893
    first = false;
894
    if (!first) sb.append(", ");
895
    sb.append("updatedOn:");
896
    sb.append(this.updatedOn);
897
    first = false;
898
    if (!first) sb.append(", ");
688 chandransh 899
    sb.append("checkedOutOn:");
900
    sb.append(this.checkedOutOn);
553 chandransh 901
    first = false;
902
    if (!first) sb.append(", ");
903
    sb.append("userId:");
904
    sb.append(this.userId);
905
    first = false;
906
    if (!first) sb.append(", ");
907
    sb.append("addressId:");
908
    sb.append(this.addressId);
909
    first = false;
910
    sb.append(")");
911
    return sb.toString();
912
  }
913
 
914
  public void validate() throws TException {
915
    // check for required fields
916
  }
917
 
918
}
919