Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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