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