Subversion Repositories SmartDukaan

Rev

Rev 3430 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1982 varun.gupt 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
1982 varun.gupt 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;
3430 rajveer 18
import java.nio.ByteBuffer;
1982 varun.gupt 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class Coupon implements org.apache.thrift.TBase<Coupon, Coupon._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Coupon");
1982 varun.gupt 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)1);
27
  private static final org.apache.thrift.protocol.TField PROMOTION_FIELD_DESC = new org.apache.thrift.protocol.TField("promotion", org.apache.thrift.protocol.TType.STRUCT, (short)2);
28
  private static final org.apache.thrift.protocol.TField ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("arguments", org.apache.thrift.protocol.TType.STRING, (short)3);
8707 manish.sha 29
  private static final org.apache.thrift.protocol.TField COUPON_CATEGORY_FIELD_DESC = new org.apache.thrift.protocol.TField("coupon_category", org.apache.thrift.protocol.TType.I32, (short)4);
1982 varun.gupt 30
 
3430 rajveer 31
  private String couponCode; // required
32
  private Promotion promotion; // required
33
  private String arguments; // required
8707 manish.sha 34
  private CouponCategory coupon_category; // required
1982 varun.gupt 35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
1982 varun.gupt 38
    COUPON_CODE((short)1, "couponCode"),
3385 varun.gupt 39
    PROMOTION((short)2, "promotion"),
8707 manish.sha 40
    ARGUMENTS((short)3, "arguments"),
41
    /**
42
     * 
43
     * @see CouponCategory
44
     */
45
    COUPON_CATEGORY((short)4, "coupon_category");
1982 varun.gupt 46
 
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byName.put(field.getFieldName(), field);
52
      }
53
    }
54
 
55
    /**
56
     * Find the _Fields constant that matches fieldId, or null if its not found.
57
     */
58
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 59
      switch(fieldId) {
60
        case 1: // COUPON_CODE
61
          return COUPON_CODE;
62
        case 2: // PROMOTION
63
          return PROMOTION;
64
        case 3: // ARGUMENTS
65
          return ARGUMENTS;
8707 manish.sha 66
        case 4: // COUPON_CATEGORY
67
          return COUPON_CATEGORY;
3430 rajveer 68
        default:
69
          return null;
70
      }
1982 varun.gupt 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
 
3430 rajveer 109
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
1982 varun.gupt 110
  static {
3430 rajveer 111
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
112
    tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
113
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
114
    tmpMap.put(_Fields.PROMOTION, new org.apache.thrift.meta_data.FieldMetaData("promotion", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Promotion.class)));
116
    tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
8707 manish.sha 118
    tmpMap.put(_Fields.COUPON_CATEGORY, new org.apache.thrift.meta_data.FieldMetaData("coupon_category", org.apache.thrift.TFieldRequirementType.DEFAULT, 
119
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CouponCategory.class)));
3430 rajveer 120
    metaDataMap = Collections.unmodifiableMap(tmpMap);
121
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Coupon.class, metaDataMap);
1982 varun.gupt 122
  }
123
 
124
  public Coupon() {
125
  }
126
 
127
  public Coupon(
128
    String couponCode,
3385 varun.gupt 129
    Promotion promotion,
8707 manish.sha 130
    String arguments,
131
    CouponCategory coupon_category)
1982 varun.gupt 132
  {
133
    this();
134
    this.couponCode = couponCode;
3385 varun.gupt 135
    this.promotion = promotion;
1982 varun.gupt 136
    this.arguments = arguments;
8707 manish.sha 137
    this.coupon_category = coupon_category;
1982 varun.gupt 138
  }
139
 
140
  /**
141
   * Performs a deep copy on <i>other</i>.
142
   */
143
  public Coupon(Coupon other) {
144
    if (other.isSetCouponCode()) {
145
      this.couponCode = other.couponCode;
146
    }
3385 varun.gupt 147
    if (other.isSetPromotion()) {
148
      this.promotion = new Promotion(other.promotion);
149
    }
1982 varun.gupt 150
    if (other.isSetArguments()) {
151
      this.arguments = other.arguments;
152
    }
8707 manish.sha 153
    if (other.isSetCoupon_category()) {
154
      this.coupon_category = other.coupon_category;
155
    }
1982 varun.gupt 156
  }
157
 
158
  public Coupon deepCopy() {
159
    return new Coupon(this);
160
  }
161
 
3430 rajveer 162
  @Override
163
  public void clear() {
164
    this.couponCode = null;
165
    this.promotion = null;
166
    this.arguments = null;
8707 manish.sha 167
    this.coupon_category = null;
1982 varun.gupt 168
  }
169
 
170
  public String getCouponCode() {
171
    return this.couponCode;
172
  }
173
 
3430 rajveer 174
  public void setCouponCode(String couponCode) {
1982 varun.gupt 175
    this.couponCode = couponCode;
176
  }
177
 
178
  public void unsetCouponCode() {
179
    this.couponCode = null;
180
  }
181
 
3430 rajveer 182
  /** Returns true if field couponCode is set (has been assigned a value) and false otherwise */
1982 varun.gupt 183
  public boolean isSetCouponCode() {
184
    return this.couponCode != null;
185
  }
186
 
187
  public void setCouponCodeIsSet(boolean value) {
188
    if (!value) {
189
      this.couponCode = null;
190
    }
191
  }
192
 
3385 varun.gupt 193
  public Promotion getPromotion() {
194
    return this.promotion;
1982 varun.gupt 195
  }
196
 
3430 rajveer 197
  public void setPromotion(Promotion promotion) {
3385 varun.gupt 198
    this.promotion = promotion;
1982 varun.gupt 199
  }
200
 
3385 varun.gupt 201
  public void unsetPromotion() {
202
    this.promotion = null;
1982 varun.gupt 203
  }
204
 
3430 rajveer 205
  /** Returns true if field promotion is set (has been assigned a value) and false otherwise */
3385 varun.gupt 206
  public boolean isSetPromotion() {
207
    return this.promotion != null;
1982 varun.gupt 208
  }
209
 
3385 varun.gupt 210
  public void setPromotionIsSet(boolean value) {
211
    if (!value) {
212
      this.promotion = null;
213
    }
1982 varun.gupt 214
  }
215
 
216
  public String getArguments() {
217
    return this.arguments;
218
  }
219
 
3430 rajveer 220
  public void setArguments(String arguments) {
1982 varun.gupt 221
    this.arguments = arguments;
222
  }
223
 
224
  public void unsetArguments() {
225
    this.arguments = null;
226
  }
227
 
3430 rajveer 228
  /** Returns true if field arguments is set (has been assigned a value) and false otherwise */
1982 varun.gupt 229
  public boolean isSetArguments() {
230
    return this.arguments != null;
231
  }
232
 
233
  public void setArgumentsIsSet(boolean value) {
234
    if (!value) {
235
      this.arguments = null;
236
    }
237
  }
238
 
8707 manish.sha 239
  /**
240
   * 
241
   * @see CouponCategory
242
   */
243
  public CouponCategory getCoupon_category() {
244
    return this.coupon_category;
245
  }
246
 
247
  /**
248
   * 
249
   * @see CouponCategory
250
   */
251
  public void setCoupon_category(CouponCategory coupon_category) {
252
    this.coupon_category = coupon_category;
253
  }
254
 
255
  public void unsetCoupon_category() {
256
    this.coupon_category = null;
257
  }
258
 
259
  /** Returns true if field coupon_category is set (has been assigned a value) and false otherwise */
260
  public boolean isSetCoupon_category() {
261
    return this.coupon_category != null;
262
  }
263
 
264
  public void setCoupon_categoryIsSet(boolean value) {
265
    if (!value) {
266
      this.coupon_category = null;
267
    }
268
  }
269
 
1982 varun.gupt 270
  public void setFieldValue(_Fields field, Object value) {
271
    switch (field) {
272
    case COUPON_CODE:
273
      if (value == null) {
274
        unsetCouponCode();
275
      } else {
276
        setCouponCode((String)value);
277
      }
278
      break;
279
 
3385 varun.gupt 280
    case PROMOTION:
1982 varun.gupt 281
      if (value == null) {
3385 varun.gupt 282
        unsetPromotion();
1982 varun.gupt 283
      } else {
3385 varun.gupt 284
        setPromotion((Promotion)value);
1982 varun.gupt 285
      }
286
      break;
287
 
288
    case ARGUMENTS:
289
      if (value == null) {
290
        unsetArguments();
291
      } else {
292
        setArguments((String)value);
293
      }
294
      break;
295
 
8707 manish.sha 296
    case COUPON_CATEGORY:
297
      if (value == null) {
298
        unsetCoupon_category();
299
      } else {
300
        setCoupon_category((CouponCategory)value);
301
      }
302
      break;
303
 
1982 varun.gupt 304
    }
305
  }
306
 
307
  public Object getFieldValue(_Fields field) {
308
    switch (field) {
309
    case COUPON_CODE:
310
      return getCouponCode();
311
 
3385 varun.gupt 312
    case PROMOTION:
313
      return getPromotion();
1982 varun.gupt 314
 
315
    case ARGUMENTS:
316
      return getArguments();
317
 
8707 manish.sha 318
    case COUPON_CATEGORY:
319
      return getCoupon_category();
320
 
1982 varun.gupt 321
    }
322
    throw new IllegalStateException();
323
  }
324
 
3430 rajveer 325
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
326
  public boolean isSet(_Fields field) {
327
    if (field == null) {
328
      throw new IllegalArgumentException();
329
    }
1982 varun.gupt 330
 
331
    switch (field) {
332
    case COUPON_CODE:
333
      return isSetCouponCode();
3385 varun.gupt 334
    case PROMOTION:
335
      return isSetPromotion();
1982 varun.gupt 336
    case ARGUMENTS:
337
      return isSetArguments();
8707 manish.sha 338
    case COUPON_CATEGORY:
339
      return isSetCoupon_category();
1982 varun.gupt 340
    }
341
    throw new IllegalStateException();
342
  }
343
 
344
  @Override
345
  public boolean equals(Object that) {
346
    if (that == null)
347
      return false;
348
    if (that instanceof Coupon)
349
      return this.equals((Coupon)that);
350
    return false;
351
  }
352
 
353
  public boolean equals(Coupon that) {
354
    if (that == null)
355
      return false;
356
 
357
    boolean this_present_couponCode = true && this.isSetCouponCode();
358
    boolean that_present_couponCode = true && that.isSetCouponCode();
359
    if (this_present_couponCode || that_present_couponCode) {
360
      if (!(this_present_couponCode && that_present_couponCode))
361
        return false;
362
      if (!this.couponCode.equals(that.couponCode))
363
        return false;
364
    }
365
 
3385 varun.gupt 366
    boolean this_present_promotion = true && this.isSetPromotion();
367
    boolean that_present_promotion = true && that.isSetPromotion();
368
    if (this_present_promotion || that_present_promotion) {
369
      if (!(this_present_promotion && that_present_promotion))
1982 varun.gupt 370
        return false;
3385 varun.gupt 371
      if (!this.promotion.equals(that.promotion))
1982 varun.gupt 372
        return false;
373
    }
374
 
375
    boolean this_present_arguments = true && this.isSetArguments();
376
    boolean that_present_arguments = true && that.isSetArguments();
377
    if (this_present_arguments || that_present_arguments) {
378
      if (!(this_present_arguments && that_present_arguments))
379
        return false;
380
      if (!this.arguments.equals(that.arguments))
381
        return false;
382
    }
383
 
8707 manish.sha 384
    boolean this_present_coupon_category = true && this.isSetCoupon_category();
385
    boolean that_present_coupon_category = true && that.isSetCoupon_category();
386
    if (this_present_coupon_category || that_present_coupon_category) {
387
      if (!(this_present_coupon_category && that_present_coupon_category))
388
        return false;
389
      if (!this.coupon_category.equals(that.coupon_category))
390
        return false;
391
    }
392
 
1982 varun.gupt 393
    return true;
394
  }
395
 
396
  @Override
397
  public int hashCode() {
398
    return 0;
399
  }
400
 
401
  public int compareTo(Coupon other) {
402
    if (!getClass().equals(other.getClass())) {
403
      return getClass().getName().compareTo(other.getClass().getName());
404
    }
405
 
406
    int lastComparison = 0;
407
    Coupon typedOther = (Coupon)other;
408
 
3430 rajveer 409
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
1982 varun.gupt 410
    if (lastComparison != 0) {
411
      return lastComparison;
412
    }
3430 rajveer 413
    if (isSetCouponCode()) {
414
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
415
      if (lastComparison != 0) {
416
        return lastComparison;
417
      }
1982 varun.gupt 418
    }
3430 rajveer 419
    lastComparison = Boolean.valueOf(isSetPromotion()).compareTo(typedOther.isSetPromotion());
1982 varun.gupt 420
    if (lastComparison != 0) {
421
      return lastComparison;
422
    }
3430 rajveer 423
    if (isSetPromotion()) {
424
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotion, typedOther.promotion);
425
      if (lastComparison != 0) {
426
        return lastComparison;
427
      }
1982 varun.gupt 428
    }
3430 rajveer 429
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
1982 varun.gupt 430
    if (lastComparison != 0) {
431
      return lastComparison;
432
    }
3430 rajveer 433
    if (isSetArguments()) {
434
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
435
      if (lastComparison != 0) {
436
        return lastComparison;
437
      }
1982 varun.gupt 438
    }
8707 manish.sha 439
    lastComparison = Boolean.valueOf(isSetCoupon_category()).compareTo(typedOther.isSetCoupon_category());
440
    if (lastComparison != 0) {
441
      return lastComparison;
442
    }
443
    if (isSetCoupon_category()) {
444
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.coupon_category, typedOther.coupon_category);
445
      if (lastComparison != 0) {
446
        return lastComparison;
447
      }
448
    }
1982 varun.gupt 449
    return 0;
450
  }
451
 
3430 rajveer 452
  public _Fields fieldForId(int fieldId) {
453
    return _Fields.findByThriftId(fieldId);
454
  }
455
 
456
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
457
    org.apache.thrift.protocol.TField field;
1982 varun.gupt 458
    iprot.readStructBegin();
459
    while (true)
460
    {
461
      field = iprot.readFieldBegin();
3430 rajveer 462
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
1982 varun.gupt 463
        break;
464
      }
3430 rajveer 465
      switch (field.id) {
466
        case 1: // COUPON_CODE
467
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
468
            this.couponCode = iprot.readString();
469
          } else { 
470
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
471
          }
472
          break;
473
        case 2: // PROMOTION
474
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
475
            this.promotion = new Promotion();
476
            this.promotion.read(iprot);
477
          } else { 
478
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
479
          }
480
          break;
481
        case 3: // ARGUMENTS
482
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
483
            this.arguments = iprot.readString();
484
          } else { 
485
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
486
          }
487
          break;
8707 manish.sha 488
        case 4: // COUPON_CATEGORY
489
          if (field.type == org.apache.thrift.protocol.TType.I32) {
490
            this.coupon_category = CouponCategory.findByValue(iprot.readI32());
491
          } else { 
492
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
493
          }
494
          break;
3430 rajveer 495
        default:
496
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1982 varun.gupt 497
      }
3430 rajveer 498
      iprot.readFieldEnd();
1982 varun.gupt 499
    }
500
    iprot.readStructEnd();
501
    validate();
502
  }
503
 
3430 rajveer 504
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1982 varun.gupt 505
    validate();
506
 
507
    oprot.writeStructBegin(STRUCT_DESC);
508
    if (this.couponCode != null) {
509
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
510
      oprot.writeString(this.couponCode);
511
      oprot.writeFieldEnd();
512
    }
3385 varun.gupt 513
    if (this.promotion != null) {
514
      oprot.writeFieldBegin(PROMOTION_FIELD_DESC);
515
      this.promotion.write(oprot);
516
      oprot.writeFieldEnd();
517
    }
1982 varun.gupt 518
    if (this.arguments != null) {
519
      oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
520
      oprot.writeString(this.arguments);
521
      oprot.writeFieldEnd();
522
    }
8707 manish.sha 523
    if (this.coupon_category != null) {
524
      oprot.writeFieldBegin(COUPON_CATEGORY_FIELD_DESC);
525
      oprot.writeI32(this.coupon_category.getValue());
526
      oprot.writeFieldEnd();
527
    }
1982 varun.gupt 528
    oprot.writeFieldStop();
529
    oprot.writeStructEnd();
530
  }
531
 
532
  @Override
533
  public String toString() {
534
    StringBuilder sb = new StringBuilder("Coupon(");
535
    boolean first = true;
536
 
537
    sb.append("couponCode:");
538
    if (this.couponCode == null) {
539
      sb.append("null");
540
    } else {
541
      sb.append(this.couponCode);
542
    }
543
    first = false;
544
    if (!first) sb.append(", ");
3385 varun.gupt 545
    sb.append("promotion:");
546
    if (this.promotion == null) {
547
      sb.append("null");
548
    } else {
549
      sb.append(this.promotion);
550
    }
1982 varun.gupt 551
    first = false;
552
    if (!first) sb.append(", ");
553
    sb.append("arguments:");
554
    if (this.arguments == null) {
555
      sb.append("null");
556
    } else {
557
      sb.append(this.arguments);
558
    }
559
    first = false;
8707 manish.sha 560
    if (!first) sb.append(", ");
561
    sb.append("coupon_category:");
562
    if (this.coupon_category == null) {
563
      sb.append("null");
564
    } else {
565
      sb.append(this.coupon_category);
566
    }
567
    first = false;
1982 varun.gupt 568
    sb.append(")");
569
    return sb.toString();
570
  }
571
 
3430 rajveer 572
  public void validate() throws org.apache.thrift.TException {
1982 varun.gupt 573
    // check for required fields
574
  }
575
 
3430 rajveer 576
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
577
    try {
578
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
579
    } catch (org.apache.thrift.TException te) {
580
      throw new java.io.IOException(te);
581
    }
582
  }
583
 
584
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
585
    try {
586
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
587
    } catch (org.apache.thrift.TException te) {
588
      throw new java.io.IOException(te);
589
    }
590
  }
591
 
1982 varun.gupt 592
}
593