Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
6467 amar.kumar 1
/**
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.purchase;
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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class PurchaseReturn implements org.apache.thrift.TBase<PurchaseReturn, PurchaseReturn._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PurchaseReturn");
25
 
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField VENDOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("vendorId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)3);
29
  private static final org.apache.thrift.protocol.TField RETURN_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("returnTimestamp", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField IS_SETTLED_FIELD_DESC = new org.apache.thrift.protocol.TField("isSettled", org.apache.thrift.protocol.TType.BOOL, (short)5);
6821 amar.kumar 31
  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)6);
6467 amar.kumar 32
 
33
  private long id; // required
34
  private long vendorId; // required
35
  private long amount; // required
36
  private long returnTimestamp; // required
37
  private boolean isSettled; // required
6821 amar.kumar 38
  private PurchaseReturnType type; // required
6467 amar.kumar 39
 
40
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
41
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
42
    ID((short)1, "id"),
43
    VENDOR_ID((short)2, "vendorId"),
44
    AMOUNT((short)3, "amount"),
45
    RETURN_TIMESTAMP((short)4, "returnTimestamp"),
6821 amar.kumar 46
    IS_SETTLED((short)5, "isSettled"),
47
    /**
48
     * 
49
     * @see PurchaseReturnType
50
     */
51
    TYPE((short)6, "type");
6467 amar.kumar 52
 
53
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
54
 
55
    static {
56
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
57
        byName.put(field.getFieldName(), field);
58
      }
59
    }
60
 
61
    /**
62
     * Find the _Fields constant that matches fieldId, or null if its not found.
63
     */
64
    public static _Fields findByThriftId(int fieldId) {
65
      switch(fieldId) {
66
        case 1: // ID
67
          return ID;
68
        case 2: // VENDOR_ID
69
          return VENDOR_ID;
70
        case 3: // AMOUNT
71
          return AMOUNT;
72
        case 4: // RETURN_TIMESTAMP
73
          return RETURN_TIMESTAMP;
74
        case 5: // IS_SETTLED
75
          return IS_SETTLED;
6821 amar.kumar 76
        case 6: // TYPE
77
          return TYPE;
6467 amar.kumar 78
        default:
79
          return null;
80
      }
81
    }
82
 
83
    /**
84
     * Find the _Fields constant that matches fieldId, throwing an exception
85
     * if it is not found.
86
     */
87
    public static _Fields findByThriftIdOrThrow(int fieldId) {
88
      _Fields fields = findByThriftId(fieldId);
89
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
90
      return fields;
91
    }
92
 
93
    /**
94
     * Find the _Fields constant that matches name, or null if its not found.
95
     */
96
    public static _Fields findByName(String name) {
97
      return byName.get(name);
98
    }
99
 
100
    private final short _thriftId;
101
    private final String _fieldName;
102
 
103
    _Fields(short thriftId, String fieldName) {
104
      _thriftId = thriftId;
105
      _fieldName = fieldName;
106
    }
107
 
108
    public short getThriftFieldId() {
109
      return _thriftId;
110
    }
111
 
112
    public String getFieldName() {
113
      return _fieldName;
114
    }
115
  }
116
 
117
  // isset id assignments
118
  private static final int __ID_ISSET_ID = 0;
119
  private static final int __VENDORID_ISSET_ID = 1;
120
  private static final int __AMOUNT_ISSET_ID = 2;
121
  private static final int __RETURNTIMESTAMP_ISSET_ID = 3;
122
  private static final int __ISSETTLED_ISSET_ID = 4;
123
  private BitSet __isset_bit_vector = new BitSet(5);
124
 
125
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
126
  static {
127
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
128
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
129
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
130
    tmpMap.put(_Fields.VENDOR_ID, new org.apache.thrift.meta_data.FieldMetaData("vendorId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
131
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
132
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
133
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
134
    tmpMap.put(_Fields.RETURN_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("returnTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
135
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
136
    tmpMap.put(_Fields.IS_SETTLED, new org.apache.thrift.meta_data.FieldMetaData("isSettled", org.apache.thrift.TFieldRequirementType.DEFAULT, 
137
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
6821 amar.kumar 138
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT, 
139
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PurchaseReturnType.class)));
6467 amar.kumar 140
    metaDataMap = Collections.unmodifiableMap(tmpMap);
141
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PurchaseReturn.class, metaDataMap);
142
  }
143
 
144
  public PurchaseReturn() {
145
  }
146
 
147
  public PurchaseReturn(
148
    long id,
149
    long vendorId,
150
    long amount,
151
    long returnTimestamp,
6821 amar.kumar 152
    boolean isSettled,
153
    PurchaseReturnType type)
6467 amar.kumar 154
  {
155
    this();
156
    this.id = id;
157
    setIdIsSet(true);
158
    this.vendorId = vendorId;
159
    setVendorIdIsSet(true);
160
    this.amount = amount;
161
    setAmountIsSet(true);
162
    this.returnTimestamp = returnTimestamp;
163
    setReturnTimestampIsSet(true);
164
    this.isSettled = isSettled;
165
    setIsSettledIsSet(true);
6821 amar.kumar 166
    this.type = type;
6467 amar.kumar 167
  }
168
 
169
  /**
170
   * Performs a deep copy on <i>other</i>.
171
   */
172
  public PurchaseReturn(PurchaseReturn other) {
173
    __isset_bit_vector.clear();
174
    __isset_bit_vector.or(other.__isset_bit_vector);
175
    this.id = other.id;
176
    this.vendorId = other.vendorId;
177
    this.amount = other.amount;
178
    this.returnTimestamp = other.returnTimestamp;
179
    this.isSettled = other.isSettled;
6821 amar.kumar 180
    if (other.isSetType()) {
181
      this.type = other.type;
182
    }
6467 amar.kumar 183
  }
184
 
185
  public PurchaseReturn deepCopy() {
186
    return new PurchaseReturn(this);
187
  }
188
 
189
  @Override
190
  public void clear() {
191
    setIdIsSet(false);
192
    this.id = 0;
193
    setVendorIdIsSet(false);
194
    this.vendorId = 0;
195
    setAmountIsSet(false);
196
    this.amount = 0;
197
    setReturnTimestampIsSet(false);
198
    this.returnTimestamp = 0;
199
    setIsSettledIsSet(false);
200
    this.isSettled = false;
6821 amar.kumar 201
    this.type = null;
6467 amar.kumar 202
  }
203
 
204
  public long getId() {
205
    return this.id;
206
  }
207
 
208
  public void setId(long id) {
209
    this.id = id;
210
    setIdIsSet(true);
211
  }
212
 
213
  public void unsetId() {
214
    __isset_bit_vector.clear(__ID_ISSET_ID);
215
  }
216
 
217
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
218
  public boolean isSetId() {
219
    return __isset_bit_vector.get(__ID_ISSET_ID);
220
  }
221
 
222
  public void setIdIsSet(boolean value) {
223
    __isset_bit_vector.set(__ID_ISSET_ID, value);
224
  }
225
 
226
  public long getVendorId() {
227
    return this.vendorId;
228
  }
229
 
230
  public void setVendorId(long vendorId) {
231
    this.vendorId = vendorId;
232
    setVendorIdIsSet(true);
233
  }
234
 
235
  public void unsetVendorId() {
236
    __isset_bit_vector.clear(__VENDORID_ISSET_ID);
237
  }
238
 
239
  /** Returns true if field vendorId is set (has been assigned a value) and false otherwise */
240
  public boolean isSetVendorId() {
241
    return __isset_bit_vector.get(__VENDORID_ISSET_ID);
242
  }
243
 
244
  public void setVendorIdIsSet(boolean value) {
245
    __isset_bit_vector.set(__VENDORID_ISSET_ID, value);
246
  }
247
 
248
  public long getAmount() {
249
    return this.amount;
250
  }
251
 
252
  public void setAmount(long amount) {
253
    this.amount = amount;
254
    setAmountIsSet(true);
255
  }
256
 
257
  public void unsetAmount() {
258
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
259
  }
260
 
261
  /** Returns true if field amount is set (has been assigned a value) and false otherwise */
262
  public boolean isSetAmount() {
263
    return __isset_bit_vector.get(__AMOUNT_ISSET_ID);
264
  }
265
 
266
  public void setAmountIsSet(boolean value) {
267
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
268
  }
269
 
270
  public long getReturnTimestamp() {
271
    return this.returnTimestamp;
272
  }
273
 
274
  public void setReturnTimestamp(long returnTimestamp) {
275
    this.returnTimestamp = returnTimestamp;
276
    setReturnTimestampIsSet(true);
277
  }
278
 
279
  public void unsetReturnTimestamp() {
280
    __isset_bit_vector.clear(__RETURNTIMESTAMP_ISSET_ID);
281
  }
282
 
283
  /** Returns true if field returnTimestamp is set (has been assigned a value) and false otherwise */
284
  public boolean isSetReturnTimestamp() {
285
    return __isset_bit_vector.get(__RETURNTIMESTAMP_ISSET_ID);
286
  }
287
 
288
  public void setReturnTimestampIsSet(boolean value) {
289
    __isset_bit_vector.set(__RETURNTIMESTAMP_ISSET_ID, value);
290
  }
291
 
292
  public boolean isIsSettled() {
293
    return this.isSettled;
294
  }
295
 
296
  public void setIsSettled(boolean isSettled) {
297
    this.isSettled = isSettled;
298
    setIsSettledIsSet(true);
299
  }
300
 
301
  public void unsetIsSettled() {
302
    __isset_bit_vector.clear(__ISSETTLED_ISSET_ID);
303
  }
304
 
305
  /** Returns true if field isSettled is set (has been assigned a value) and false otherwise */
306
  public boolean isSetIsSettled() {
307
    return __isset_bit_vector.get(__ISSETTLED_ISSET_ID);
308
  }
309
 
310
  public void setIsSettledIsSet(boolean value) {
311
    __isset_bit_vector.set(__ISSETTLED_ISSET_ID, value);
312
  }
313
 
6821 amar.kumar 314
  /**
315
   * 
316
   * @see PurchaseReturnType
317
   */
318
  public PurchaseReturnType getType() {
319
    return this.type;
320
  }
321
 
322
  /**
323
   * 
324
   * @see PurchaseReturnType
325
   */
326
  public void setType(PurchaseReturnType type) {
327
    this.type = type;
328
  }
329
 
330
  public void unsetType() {
331
    this.type = null;
332
  }
333
 
334
  /** Returns true if field type is set (has been assigned a value) and false otherwise */
335
  public boolean isSetType() {
336
    return this.type != null;
337
  }
338
 
339
  public void setTypeIsSet(boolean value) {
340
    if (!value) {
341
      this.type = null;
342
    }
343
  }
344
 
6467 amar.kumar 345
  public void setFieldValue(_Fields field, Object value) {
346
    switch (field) {
347
    case ID:
348
      if (value == null) {
349
        unsetId();
350
      } else {
351
        setId((Long)value);
352
      }
353
      break;
354
 
355
    case VENDOR_ID:
356
      if (value == null) {
357
        unsetVendorId();
358
      } else {
359
        setVendorId((Long)value);
360
      }
361
      break;
362
 
363
    case AMOUNT:
364
      if (value == null) {
365
        unsetAmount();
366
      } else {
367
        setAmount((Long)value);
368
      }
369
      break;
370
 
371
    case RETURN_TIMESTAMP:
372
      if (value == null) {
373
        unsetReturnTimestamp();
374
      } else {
375
        setReturnTimestamp((Long)value);
376
      }
377
      break;
378
 
379
    case IS_SETTLED:
380
      if (value == null) {
381
        unsetIsSettled();
382
      } else {
383
        setIsSettled((Boolean)value);
384
      }
385
      break;
386
 
6821 amar.kumar 387
    case TYPE:
388
      if (value == null) {
389
        unsetType();
390
      } else {
391
        setType((PurchaseReturnType)value);
392
      }
393
      break;
394
 
6467 amar.kumar 395
    }
396
  }
397
 
398
  public Object getFieldValue(_Fields field) {
399
    switch (field) {
400
    case ID:
401
      return Long.valueOf(getId());
402
 
403
    case VENDOR_ID:
404
      return Long.valueOf(getVendorId());
405
 
406
    case AMOUNT:
407
      return Long.valueOf(getAmount());
408
 
409
    case RETURN_TIMESTAMP:
410
      return Long.valueOf(getReturnTimestamp());
411
 
412
    case IS_SETTLED:
413
      return Boolean.valueOf(isIsSettled());
414
 
6821 amar.kumar 415
    case TYPE:
416
      return getType();
417
 
6467 amar.kumar 418
    }
419
    throw new IllegalStateException();
420
  }
421
 
422
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
423
  public boolean isSet(_Fields field) {
424
    if (field == null) {
425
      throw new IllegalArgumentException();
426
    }
427
 
428
    switch (field) {
429
    case ID:
430
      return isSetId();
431
    case VENDOR_ID:
432
      return isSetVendorId();
433
    case AMOUNT:
434
      return isSetAmount();
435
    case RETURN_TIMESTAMP:
436
      return isSetReturnTimestamp();
437
    case IS_SETTLED:
438
      return isSetIsSettled();
6821 amar.kumar 439
    case TYPE:
440
      return isSetType();
6467 amar.kumar 441
    }
442
    throw new IllegalStateException();
443
  }
444
 
445
  @Override
446
  public boolean equals(Object that) {
447
    if (that == null)
448
      return false;
449
    if (that instanceof PurchaseReturn)
450
      return this.equals((PurchaseReturn)that);
451
    return false;
452
  }
453
 
454
  public boolean equals(PurchaseReturn that) {
455
    if (that == null)
456
      return false;
457
 
458
    boolean this_present_id = true;
459
    boolean that_present_id = true;
460
    if (this_present_id || that_present_id) {
461
      if (!(this_present_id && that_present_id))
462
        return false;
463
      if (this.id != that.id)
464
        return false;
465
    }
466
 
467
    boolean this_present_vendorId = true;
468
    boolean that_present_vendorId = true;
469
    if (this_present_vendorId || that_present_vendorId) {
470
      if (!(this_present_vendorId && that_present_vendorId))
471
        return false;
472
      if (this.vendorId != that.vendorId)
473
        return false;
474
    }
475
 
476
    boolean this_present_amount = true;
477
    boolean that_present_amount = true;
478
    if (this_present_amount || that_present_amount) {
479
      if (!(this_present_amount && that_present_amount))
480
        return false;
481
      if (this.amount != that.amount)
482
        return false;
483
    }
484
 
485
    boolean this_present_returnTimestamp = true;
486
    boolean that_present_returnTimestamp = true;
487
    if (this_present_returnTimestamp || that_present_returnTimestamp) {
488
      if (!(this_present_returnTimestamp && that_present_returnTimestamp))
489
        return false;
490
      if (this.returnTimestamp != that.returnTimestamp)
491
        return false;
492
    }
493
 
494
    boolean this_present_isSettled = true;
495
    boolean that_present_isSettled = true;
496
    if (this_present_isSettled || that_present_isSettled) {
497
      if (!(this_present_isSettled && that_present_isSettled))
498
        return false;
499
      if (this.isSettled != that.isSettled)
500
        return false;
501
    }
502
 
6821 amar.kumar 503
    boolean this_present_type = true && this.isSetType();
504
    boolean that_present_type = true && that.isSetType();
505
    if (this_present_type || that_present_type) {
506
      if (!(this_present_type && that_present_type))
507
        return false;
508
      if (!this.type.equals(that.type))
509
        return false;
510
    }
511
 
6467 amar.kumar 512
    return true;
513
  }
514
 
515
  @Override
516
  public int hashCode() {
517
    return 0;
518
  }
519
 
520
  public int compareTo(PurchaseReturn other) {
521
    if (!getClass().equals(other.getClass())) {
522
      return getClass().getName().compareTo(other.getClass().getName());
523
    }
524
 
525
    int lastComparison = 0;
526
    PurchaseReturn typedOther = (PurchaseReturn)other;
527
 
528
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
529
    if (lastComparison != 0) {
530
      return lastComparison;
531
    }
532
    if (isSetId()) {
533
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
534
      if (lastComparison != 0) {
535
        return lastComparison;
536
      }
537
    }
538
    lastComparison = Boolean.valueOf(isSetVendorId()).compareTo(typedOther.isSetVendorId());
539
    if (lastComparison != 0) {
540
      return lastComparison;
541
    }
542
    if (isSetVendorId()) {
543
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.vendorId, typedOther.vendorId);
544
      if (lastComparison != 0) {
545
        return lastComparison;
546
      }
547
    }
548
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
549
    if (lastComparison != 0) {
550
      return lastComparison;
551
    }
552
    if (isSetAmount()) {
553
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
554
      if (lastComparison != 0) {
555
        return lastComparison;
556
      }
557
    }
558
    lastComparison = Boolean.valueOf(isSetReturnTimestamp()).compareTo(typedOther.isSetReturnTimestamp());
559
    if (lastComparison != 0) {
560
      return lastComparison;
561
    }
562
    if (isSetReturnTimestamp()) {
563
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.returnTimestamp, typedOther.returnTimestamp);
564
      if (lastComparison != 0) {
565
        return lastComparison;
566
      }
567
    }
568
    lastComparison = Boolean.valueOf(isSetIsSettled()).compareTo(typedOther.isSetIsSettled());
569
    if (lastComparison != 0) {
570
      return lastComparison;
571
    }
572
    if (isSetIsSettled()) {
573
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isSettled, typedOther.isSettled);
574
      if (lastComparison != 0) {
575
        return lastComparison;
576
      }
577
    }
6821 amar.kumar 578
    lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
579
    if (lastComparison != 0) {
580
      return lastComparison;
581
    }
582
    if (isSetType()) {
583
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
584
      if (lastComparison != 0) {
585
        return lastComparison;
586
      }
587
    }
6467 amar.kumar 588
    return 0;
589
  }
590
 
591
  public _Fields fieldForId(int fieldId) {
592
    return _Fields.findByThriftId(fieldId);
593
  }
594
 
595
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
596
    org.apache.thrift.protocol.TField field;
597
    iprot.readStructBegin();
598
    while (true)
599
    {
600
      field = iprot.readFieldBegin();
601
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
602
        break;
603
      }
604
      switch (field.id) {
605
        case 1: // ID
606
          if (field.type == org.apache.thrift.protocol.TType.I64) {
607
            this.id = iprot.readI64();
608
            setIdIsSet(true);
609
          } else { 
610
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
611
          }
612
          break;
613
        case 2: // VENDOR_ID
614
          if (field.type == org.apache.thrift.protocol.TType.I64) {
615
            this.vendorId = iprot.readI64();
616
            setVendorIdIsSet(true);
617
          } else { 
618
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
619
          }
620
          break;
621
        case 3: // AMOUNT
622
          if (field.type == org.apache.thrift.protocol.TType.I64) {
623
            this.amount = iprot.readI64();
624
            setAmountIsSet(true);
625
          } else { 
626
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
627
          }
628
          break;
629
        case 4: // RETURN_TIMESTAMP
630
          if (field.type == org.apache.thrift.protocol.TType.I64) {
631
            this.returnTimestamp = iprot.readI64();
632
            setReturnTimestampIsSet(true);
633
          } else { 
634
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
635
          }
636
          break;
637
        case 5: // IS_SETTLED
638
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
639
            this.isSettled = iprot.readBool();
640
            setIsSettledIsSet(true);
641
          } else { 
642
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
643
          }
644
          break;
6821 amar.kumar 645
        case 6: // TYPE
646
          if (field.type == org.apache.thrift.protocol.TType.I32) {
647
            this.type = PurchaseReturnType.findByValue(iprot.readI32());
648
          } else { 
649
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
650
          }
651
          break;
6467 amar.kumar 652
        default:
653
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
654
      }
655
      iprot.readFieldEnd();
656
    }
657
    iprot.readStructEnd();
658
    validate();
659
  }
660
 
661
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
662
    validate();
663
 
664
    oprot.writeStructBegin(STRUCT_DESC);
665
    oprot.writeFieldBegin(ID_FIELD_DESC);
666
    oprot.writeI64(this.id);
667
    oprot.writeFieldEnd();
668
    oprot.writeFieldBegin(VENDOR_ID_FIELD_DESC);
669
    oprot.writeI64(this.vendorId);
670
    oprot.writeFieldEnd();
671
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
672
    oprot.writeI64(this.amount);
673
    oprot.writeFieldEnd();
674
    oprot.writeFieldBegin(RETURN_TIMESTAMP_FIELD_DESC);
675
    oprot.writeI64(this.returnTimestamp);
676
    oprot.writeFieldEnd();
677
    oprot.writeFieldBegin(IS_SETTLED_FIELD_DESC);
678
    oprot.writeBool(this.isSettled);
679
    oprot.writeFieldEnd();
6821 amar.kumar 680
    if (this.type != null) {
681
      oprot.writeFieldBegin(TYPE_FIELD_DESC);
682
      oprot.writeI32(this.type.getValue());
683
      oprot.writeFieldEnd();
684
    }
6467 amar.kumar 685
    oprot.writeFieldStop();
686
    oprot.writeStructEnd();
687
  }
688
 
689
  @Override
690
  public String toString() {
691
    StringBuilder sb = new StringBuilder("PurchaseReturn(");
692
    boolean first = true;
693
 
694
    sb.append("id:");
695
    sb.append(this.id);
696
    first = false;
697
    if (!first) sb.append(", ");
698
    sb.append("vendorId:");
699
    sb.append(this.vendorId);
700
    first = false;
701
    if (!first) sb.append(", ");
702
    sb.append("amount:");
703
    sb.append(this.amount);
704
    first = false;
705
    if (!first) sb.append(", ");
706
    sb.append("returnTimestamp:");
707
    sb.append(this.returnTimestamp);
708
    first = false;
709
    if (!first) sb.append(", ");
710
    sb.append("isSettled:");
711
    sb.append(this.isSettled);
712
    first = false;
6821 amar.kumar 713
    if (!first) sb.append(", ");
714
    sb.append("type:");
715
    if (this.type == null) {
716
      sb.append("null");
717
    } else {
718
      sb.append(this.type);
719
    }
720
    first = false;
6467 amar.kumar 721
    sb.append(")");
722
    return sb.toString();
723
  }
724
 
725
  public void validate() throws org.apache.thrift.TException {
726
    // check for required fields
727
  }
728
 
729
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
730
    try {
731
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
732
    } catch (org.apache.thrift.TException te) {
733
      throw new java.io.IOException(te);
734
    }
735
  }
736
 
737
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
738
    try {
739
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
740
      __isset_bit_vector = new BitSet(1);
741
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
742
    } catch (org.apache.thrift.TException te) {
743
      throw new java.io.IOException(te);
744
    }
745
  }
746
 
747
}
748