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