Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.order;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class Billing implements TBase<Billing._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Billing");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField BILL_NUMBER_FIELD_DESC = new TField("billNumber", TType.STRING, (short)2);
132 ashish 31
  private static final TField LINE_ITEM_FIELD_DESC = new TField("lineItem", TType.LIST, (short)3);
68 ashish 32
  private static final TField GENERATED_TIMESTAMP_FIELD_DESC = new TField("generatedTimestamp", TType.I64, (short)4);
33
  private static final TField GENERATED_BY_FIELD_DESC = new TField("generatedBy", TType.STRING, (short)5);
34
 
35
  private long id;
36
  private String billNumber;
132 ashish 37
  private List<LineItem> lineItem;
68 ashish 38
  private long generatedTimestamp;
39
  private String generatedBy;
40
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
43
    ID((short)1, "id"),
44
    BILL_NUMBER((short)2, "billNumber"),
45
    LINE_ITEM((short)3, "lineItem"),
46
    GENERATED_TIMESTAMP((short)4, "generatedTimestamp"),
47
    GENERATED_BY((short)5, "generatedBy");
48
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
 
52
    static {
53
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
54
        byId.put((int)field._thriftId, field);
55
        byName.put(field.getFieldName(), field);
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, or null if its not found.
61
     */
62
    public static _Fields findByThriftId(int fieldId) {
63
      return byId.get(fieldId);
64
    }
65
 
66
    /**
67
     * Find the _Fields constant that matches fieldId, throwing an exception
68
     * if it is not found.
69
     */
70
    public static _Fields findByThriftIdOrThrow(int fieldId) {
71
      _Fields fields = findByThriftId(fieldId);
72
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
73
      return fields;
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches name, or null if its not found.
78
     */
79
    public static _Fields findByName(String name) {
80
      return byName.get(name);
81
    }
82
 
83
    private final short _thriftId;
84
    private final String _fieldName;
85
 
86
    _Fields(short thriftId, String fieldName) {
87
      _thriftId = thriftId;
88
      _fieldName = fieldName;
89
    }
90
 
91
    public short getThriftFieldId() {
92
      return _thriftId;
93
    }
94
 
95
    public String getFieldName() {
96
      return _fieldName;
97
    }
98
  }
99
 
100
  // isset id assignments
101
  private static final int __ID_ISSET_ID = 0;
102
  private static final int __GENERATEDTIMESTAMP_ISSET_ID = 1;
103
  private BitSet __isset_bit_vector = new BitSet(2);
104
 
105
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
106
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.I64)));
108
    put(_Fields.BILL_NUMBER, new FieldMetaData("billNumber", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.STRING)));
110
    put(_Fields.LINE_ITEM, new FieldMetaData("lineItem", TFieldRequirementType.DEFAULT, 
132 ashish 111
        new ListMetaData(TType.LIST, 
112
            new StructMetaData(TType.STRUCT, LineItem.class))));
68 ashish 113
    put(_Fields.GENERATED_TIMESTAMP, new FieldMetaData("generatedTimestamp", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.I64)));
115
    put(_Fields.GENERATED_BY, new FieldMetaData("generatedBy", TFieldRequirementType.DEFAULT, 
116
        new FieldValueMetaData(TType.STRING)));
117
  }});
118
 
119
  static {
120
    FieldMetaData.addStructMetaDataMap(Billing.class, metaDataMap);
121
  }
122
 
123
  public Billing() {
124
  }
125
 
126
  public Billing(
127
    long id,
128
    String billNumber,
132 ashish 129
    List<LineItem> lineItem,
68 ashish 130
    long generatedTimestamp,
131
    String generatedBy)
132
  {
133
    this();
134
    this.id = id;
135
    setIdIsSet(true);
136
    this.billNumber = billNumber;
137
    this.lineItem = lineItem;
138
    this.generatedTimestamp = generatedTimestamp;
139
    setGeneratedTimestampIsSet(true);
140
    this.generatedBy = generatedBy;
141
  }
142
 
143
  /**
144
   * Performs a deep copy on <i>other</i>.
145
   */
146
  public Billing(Billing other) {
147
    __isset_bit_vector.clear();
148
    __isset_bit_vector.or(other.__isset_bit_vector);
149
    this.id = other.id;
150
    if (other.isSetBillNumber()) {
151
      this.billNumber = other.billNumber;
152
    }
153
    if (other.isSetLineItem()) {
132 ashish 154
      List<LineItem> __this__lineItem = new ArrayList<LineItem>();
155
      for (LineItem other_element : other.lineItem) {
156
        __this__lineItem.add(new LineItem(other_element));
157
      }
158
      this.lineItem = __this__lineItem;
68 ashish 159
    }
160
    this.generatedTimestamp = other.generatedTimestamp;
161
    if (other.isSetGeneratedBy()) {
162
      this.generatedBy = other.generatedBy;
163
    }
164
  }
165
 
166
  public Billing deepCopy() {
167
    return new Billing(this);
168
  }
169
 
170
  @Deprecated
171
  public Billing clone() {
172
    return new Billing(this);
173
  }
174
 
175
  public long getId() {
176
    return this.id;
177
  }
178
 
179
  public Billing setId(long id) {
180
    this.id = id;
181
    setIdIsSet(true);
182
    return this;
183
  }
184
 
185
  public void unsetId() {
186
    __isset_bit_vector.clear(__ID_ISSET_ID);
187
  }
188
 
189
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
190
  public boolean isSetId() {
191
    return __isset_bit_vector.get(__ID_ISSET_ID);
192
  }
193
 
194
  public void setIdIsSet(boolean value) {
195
    __isset_bit_vector.set(__ID_ISSET_ID, value);
196
  }
197
 
198
  public String getBillNumber() {
199
    return this.billNumber;
200
  }
201
 
202
  public Billing setBillNumber(String billNumber) {
203
    this.billNumber = billNumber;
204
    return this;
205
  }
206
 
207
  public void unsetBillNumber() {
208
    this.billNumber = null;
209
  }
210
 
211
  /** Returns true if field billNumber is set (has been asigned a value) and false otherwise */
212
  public boolean isSetBillNumber() {
213
    return this.billNumber != null;
214
  }
215
 
216
  public void setBillNumberIsSet(boolean value) {
217
    if (!value) {
218
      this.billNumber = null;
219
    }
220
  }
221
 
132 ashish 222
  public int getLineItemSize() {
223
    return (this.lineItem == null) ? 0 : this.lineItem.size();
224
  }
225
 
226
  public java.util.Iterator<LineItem> getLineItemIterator() {
227
    return (this.lineItem == null) ? null : this.lineItem.iterator();
228
  }
229
 
230
  public void addToLineItem(LineItem elem) {
231
    if (this.lineItem == null) {
232
      this.lineItem = new ArrayList<LineItem>();
233
    }
234
    this.lineItem.add(elem);
235
  }
236
 
237
  public List<LineItem> getLineItem() {
68 ashish 238
    return this.lineItem;
239
  }
240
 
132 ashish 241
  public Billing setLineItem(List<LineItem> lineItem) {
68 ashish 242
    this.lineItem = lineItem;
243
    return this;
244
  }
245
 
246
  public void unsetLineItem() {
247
    this.lineItem = null;
248
  }
249
 
250
  /** Returns true if field lineItem is set (has been asigned a value) and false otherwise */
251
  public boolean isSetLineItem() {
252
    return this.lineItem != null;
253
  }
254
 
255
  public void setLineItemIsSet(boolean value) {
256
    if (!value) {
257
      this.lineItem = null;
258
    }
259
  }
260
 
261
  public long getGeneratedTimestamp() {
262
    return this.generatedTimestamp;
263
  }
264
 
265
  public Billing setGeneratedTimestamp(long generatedTimestamp) {
266
    this.generatedTimestamp = generatedTimestamp;
267
    setGeneratedTimestampIsSet(true);
268
    return this;
269
  }
270
 
271
  public void unsetGeneratedTimestamp() {
272
    __isset_bit_vector.clear(__GENERATEDTIMESTAMP_ISSET_ID);
273
  }
274
 
275
  /** Returns true if field generatedTimestamp is set (has been asigned a value) and false otherwise */
276
  public boolean isSetGeneratedTimestamp() {
277
    return __isset_bit_vector.get(__GENERATEDTIMESTAMP_ISSET_ID);
278
  }
279
 
280
  public void setGeneratedTimestampIsSet(boolean value) {
281
    __isset_bit_vector.set(__GENERATEDTIMESTAMP_ISSET_ID, value);
282
  }
283
 
284
  public String getGeneratedBy() {
285
    return this.generatedBy;
286
  }
287
 
288
  public Billing setGeneratedBy(String generatedBy) {
289
    this.generatedBy = generatedBy;
290
    return this;
291
  }
292
 
293
  public void unsetGeneratedBy() {
294
    this.generatedBy = null;
295
  }
296
 
297
  /** Returns true if field generatedBy is set (has been asigned a value) and false otherwise */
298
  public boolean isSetGeneratedBy() {
299
    return this.generatedBy != null;
300
  }
301
 
302
  public void setGeneratedByIsSet(boolean value) {
303
    if (!value) {
304
      this.generatedBy = null;
305
    }
306
  }
307
 
308
  public void setFieldValue(_Fields field, Object value) {
309
    switch (field) {
310
    case ID:
311
      if (value == null) {
312
        unsetId();
313
      } else {
314
        setId((Long)value);
315
      }
316
      break;
317
 
318
    case BILL_NUMBER:
319
      if (value == null) {
320
        unsetBillNumber();
321
      } else {
322
        setBillNumber((String)value);
323
      }
324
      break;
325
 
326
    case LINE_ITEM:
327
      if (value == null) {
328
        unsetLineItem();
329
      } else {
132 ashish 330
        setLineItem((List<LineItem>)value);
68 ashish 331
      }
332
      break;
333
 
334
    case GENERATED_TIMESTAMP:
335
      if (value == null) {
336
        unsetGeneratedTimestamp();
337
      } else {
338
        setGeneratedTimestamp((Long)value);
339
      }
340
      break;
341
 
342
    case GENERATED_BY:
343
      if (value == null) {
344
        unsetGeneratedBy();
345
      } else {
346
        setGeneratedBy((String)value);
347
      }
348
      break;
349
 
350
    }
351
  }
352
 
353
  public void setFieldValue(int fieldID, Object value) {
354
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
355
  }
356
 
357
  public Object getFieldValue(_Fields field) {
358
    switch (field) {
359
    case ID:
360
      return new Long(getId());
361
 
362
    case BILL_NUMBER:
363
      return getBillNumber();
364
 
365
    case LINE_ITEM:
366
      return getLineItem();
367
 
368
    case GENERATED_TIMESTAMP:
369
      return new Long(getGeneratedTimestamp());
370
 
371
    case GENERATED_BY:
372
      return getGeneratedBy();
373
 
374
    }
375
    throw new IllegalStateException();
376
  }
377
 
378
  public Object getFieldValue(int fieldId) {
379
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
380
  }
381
 
382
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
383
  public boolean isSet(_Fields field) {
384
    switch (field) {
385
    case ID:
386
      return isSetId();
387
    case BILL_NUMBER:
388
      return isSetBillNumber();
389
    case LINE_ITEM:
390
      return isSetLineItem();
391
    case GENERATED_TIMESTAMP:
392
      return isSetGeneratedTimestamp();
393
    case GENERATED_BY:
394
      return isSetGeneratedBy();
395
    }
396
    throw new IllegalStateException();
397
  }
398
 
399
  public boolean isSet(int fieldID) {
400
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
401
  }
402
 
403
  @Override
404
  public boolean equals(Object that) {
405
    if (that == null)
406
      return false;
407
    if (that instanceof Billing)
408
      return this.equals((Billing)that);
409
    return false;
410
  }
411
 
412
  public boolean equals(Billing that) {
413
    if (that == null)
414
      return false;
415
 
416
    boolean this_present_id = true;
417
    boolean that_present_id = true;
418
    if (this_present_id || that_present_id) {
419
      if (!(this_present_id && that_present_id))
420
        return false;
421
      if (this.id != that.id)
422
        return false;
423
    }
424
 
425
    boolean this_present_billNumber = true && this.isSetBillNumber();
426
    boolean that_present_billNumber = true && that.isSetBillNumber();
427
    if (this_present_billNumber || that_present_billNumber) {
428
      if (!(this_present_billNumber && that_present_billNumber))
429
        return false;
430
      if (!this.billNumber.equals(that.billNumber))
431
        return false;
432
    }
433
 
434
    boolean this_present_lineItem = true && this.isSetLineItem();
435
    boolean that_present_lineItem = true && that.isSetLineItem();
436
    if (this_present_lineItem || that_present_lineItem) {
437
      if (!(this_present_lineItem && that_present_lineItem))
438
        return false;
439
      if (!this.lineItem.equals(that.lineItem))
440
        return false;
441
    }
442
 
443
    boolean this_present_generatedTimestamp = true;
444
    boolean that_present_generatedTimestamp = true;
445
    if (this_present_generatedTimestamp || that_present_generatedTimestamp) {
446
      if (!(this_present_generatedTimestamp && that_present_generatedTimestamp))
447
        return false;
448
      if (this.generatedTimestamp != that.generatedTimestamp)
449
        return false;
450
    }
451
 
452
    boolean this_present_generatedBy = true && this.isSetGeneratedBy();
453
    boolean that_present_generatedBy = true && that.isSetGeneratedBy();
454
    if (this_present_generatedBy || that_present_generatedBy) {
455
      if (!(this_present_generatedBy && that_present_generatedBy))
456
        return false;
457
      if (!this.generatedBy.equals(that.generatedBy))
458
        return false;
459
    }
460
 
461
    return true;
462
  }
463
 
464
  @Override
465
  public int hashCode() {
466
    return 0;
467
  }
468
 
469
  public void read(TProtocol iprot) throws TException {
470
    TField field;
471
    iprot.readStructBegin();
472
    while (true)
473
    {
474
      field = iprot.readFieldBegin();
475
      if (field.type == TType.STOP) { 
476
        break;
477
      }
478
      _Fields fieldId = _Fields.findByThriftId(field.id);
479
      if (fieldId == null) {
480
        TProtocolUtil.skip(iprot, field.type);
481
      } else {
482
        switch (fieldId) {
483
          case ID:
484
            if (field.type == TType.I64) {
485
              this.id = iprot.readI64();
486
              setIdIsSet(true);
487
            } else { 
488
              TProtocolUtil.skip(iprot, field.type);
489
            }
490
            break;
491
          case BILL_NUMBER:
492
            if (field.type == TType.STRING) {
493
              this.billNumber = iprot.readString();
494
            } else { 
495
              TProtocolUtil.skip(iprot, field.type);
496
            }
497
            break;
498
          case LINE_ITEM:
132 ashish 499
            if (field.type == TType.LIST) {
500
              {
501
                TList _list9 = iprot.readListBegin();
502
                this.lineItem = new ArrayList<LineItem>(_list9.size);
503
                for (int _i10 = 0; _i10 < _list9.size; ++_i10)
504
                {
505
                  LineItem _elem11;
506
                  _elem11 = new LineItem();
507
                  _elem11.read(iprot);
508
                  this.lineItem.add(_elem11);
509
                }
510
                iprot.readListEnd();
511
              }
68 ashish 512
            } else { 
513
              TProtocolUtil.skip(iprot, field.type);
514
            }
515
            break;
516
          case GENERATED_TIMESTAMP:
517
            if (field.type == TType.I64) {
518
              this.generatedTimestamp = iprot.readI64();
519
              setGeneratedTimestampIsSet(true);
520
            } else { 
521
              TProtocolUtil.skip(iprot, field.type);
522
            }
523
            break;
524
          case GENERATED_BY:
525
            if (field.type == TType.STRING) {
526
              this.generatedBy = iprot.readString();
527
            } else { 
528
              TProtocolUtil.skip(iprot, field.type);
529
            }
530
            break;
531
        }
532
        iprot.readFieldEnd();
533
      }
534
    }
535
    iprot.readStructEnd();
536
    validate();
537
  }
538
 
539
  public void write(TProtocol oprot) throws TException {
540
    validate();
541
 
542
    oprot.writeStructBegin(STRUCT_DESC);
543
    oprot.writeFieldBegin(ID_FIELD_DESC);
544
    oprot.writeI64(this.id);
545
    oprot.writeFieldEnd();
546
    if (this.billNumber != null) {
547
      oprot.writeFieldBegin(BILL_NUMBER_FIELD_DESC);
548
      oprot.writeString(this.billNumber);
549
      oprot.writeFieldEnd();
550
    }
551
    if (this.lineItem != null) {
552
      oprot.writeFieldBegin(LINE_ITEM_FIELD_DESC);
132 ashish 553
      {
554
        oprot.writeListBegin(new TList(TType.STRUCT, this.lineItem.size()));
555
        for (LineItem _iter12 : this.lineItem)
556
        {
557
          _iter12.write(oprot);
558
        }
559
        oprot.writeListEnd();
560
      }
68 ashish 561
      oprot.writeFieldEnd();
562
    }
563
    oprot.writeFieldBegin(GENERATED_TIMESTAMP_FIELD_DESC);
564
    oprot.writeI64(this.generatedTimestamp);
565
    oprot.writeFieldEnd();
566
    if (this.generatedBy != null) {
567
      oprot.writeFieldBegin(GENERATED_BY_FIELD_DESC);
568
      oprot.writeString(this.generatedBy);
569
      oprot.writeFieldEnd();
570
    }
571
    oprot.writeFieldStop();
572
    oprot.writeStructEnd();
573
  }
574
 
575
  @Override
576
  public String toString() {
577
    StringBuilder sb = new StringBuilder("Billing(");
578
    boolean first = true;
579
 
580
    sb.append("id:");
581
    sb.append(this.id);
582
    first = false;
583
    if (!first) sb.append(", ");
584
    sb.append("billNumber:");
585
    if (this.billNumber == null) {
586
      sb.append("null");
587
    } else {
588
      sb.append(this.billNumber);
589
    }
590
    first = false;
591
    if (!first) sb.append(", ");
592
    sb.append("lineItem:");
593
    if (this.lineItem == null) {
594
      sb.append("null");
595
    } else {
596
      sb.append(this.lineItem);
597
    }
598
    first = false;
599
    if (!first) sb.append(", ");
600
    sb.append("generatedTimestamp:");
601
    sb.append(this.generatedTimestamp);
602
    first = false;
603
    if (!first) sb.append(", ");
604
    sb.append("generatedBy:");
605
    if (this.generatedBy == null) {
606
      sb.append("null");
607
    } else {
608
      sb.append(this.generatedBy);
609
    }
610
    first = false;
611
    sb.append(")");
612
    return sb.toString();
613
  }
614
 
615
  public void validate() throws TException {
616
    // check for required fields
617
  }
618
 
619
}
620