Subversion Repositories SmartDukaan

Rev

Rev 3385 | Go to most recent revision | 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);
1982 varun.gupt 29
 
3430 rajveer 30
  private String couponCode; // required
31
  private Promotion promotion; // required
32
  private String arguments; // required
1982 varun.gupt 33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
1982 varun.gupt 36
    COUPON_CODE((short)1, "couponCode"),
3385 varun.gupt 37
    PROMOTION((short)2, "promotion"),
1982 varun.gupt 38
    ARGUMENTS((short)3, "arguments");
39
 
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
 
42
    static {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
44
        byName.put(field.getFieldName(), field);
45
      }
46
    }
47
 
48
    /**
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
50
     */
51
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 52
      switch(fieldId) {
53
        case 1: // COUPON_CODE
54
          return COUPON_CODE;
55
        case 2: // PROMOTION
56
          return PROMOTION;
57
        case 3: // ARGUMENTS
58
          return ARGUMENTS;
59
        default:
60
          return null;
61
      }
1982 varun.gupt 62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches fieldId, throwing an exception
66
     * if it is not found.
67
     */
68
    public static _Fields findByThriftIdOrThrow(int fieldId) {
69
      _Fields fields = findByThriftId(fieldId);
70
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
71
      return fields;
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches name, or null if its not found.
76
     */
77
    public static _Fields findByName(String name) {
78
      return byName.get(name);
79
    }
80
 
81
    private final short _thriftId;
82
    private final String _fieldName;
83
 
84
    _Fields(short thriftId, String fieldName) {
85
      _thriftId = thriftId;
86
      _fieldName = fieldName;
87
    }
88
 
89
    public short getThriftFieldId() {
90
      return _thriftId;
91
    }
92
 
93
    public String getFieldName() {
94
      return _fieldName;
95
    }
96
  }
97
 
98
  // isset id assignments
99
 
3430 rajveer 100
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
1982 varun.gupt 101
  static {
3430 rajveer 102
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
103
    tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
104
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
105
    tmpMap.put(_Fields.PROMOTION, new org.apache.thrift.meta_data.FieldMetaData("promotion", org.apache.thrift.TFieldRequirementType.DEFAULT, 
106
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Promotion.class)));
107
    tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
109
    metaDataMap = Collections.unmodifiableMap(tmpMap);
110
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Coupon.class, metaDataMap);
1982 varun.gupt 111
  }
112
 
113
  public Coupon() {
114
  }
115
 
116
  public Coupon(
117
    String couponCode,
3385 varun.gupt 118
    Promotion promotion,
1982 varun.gupt 119
    String arguments)
120
  {
121
    this();
122
    this.couponCode = couponCode;
3385 varun.gupt 123
    this.promotion = promotion;
1982 varun.gupt 124
    this.arguments = arguments;
125
  }
126
 
127
  /**
128
   * Performs a deep copy on <i>other</i>.
129
   */
130
  public Coupon(Coupon other) {
131
    if (other.isSetCouponCode()) {
132
      this.couponCode = other.couponCode;
133
    }
3385 varun.gupt 134
    if (other.isSetPromotion()) {
135
      this.promotion = new Promotion(other.promotion);
136
    }
1982 varun.gupt 137
    if (other.isSetArguments()) {
138
      this.arguments = other.arguments;
139
    }
140
  }
141
 
142
  public Coupon deepCopy() {
143
    return new Coupon(this);
144
  }
145
 
3430 rajveer 146
  @Override
147
  public void clear() {
148
    this.couponCode = null;
149
    this.promotion = null;
150
    this.arguments = null;
1982 varun.gupt 151
  }
152
 
153
  public String getCouponCode() {
154
    return this.couponCode;
155
  }
156
 
3430 rajveer 157
  public void setCouponCode(String couponCode) {
1982 varun.gupt 158
    this.couponCode = couponCode;
159
  }
160
 
161
  public void unsetCouponCode() {
162
    this.couponCode = null;
163
  }
164
 
3430 rajveer 165
  /** Returns true if field couponCode is set (has been assigned a value) and false otherwise */
1982 varun.gupt 166
  public boolean isSetCouponCode() {
167
    return this.couponCode != null;
168
  }
169
 
170
  public void setCouponCodeIsSet(boolean value) {
171
    if (!value) {
172
      this.couponCode = null;
173
    }
174
  }
175
 
3385 varun.gupt 176
  public Promotion getPromotion() {
177
    return this.promotion;
1982 varun.gupt 178
  }
179
 
3430 rajveer 180
  public void setPromotion(Promotion promotion) {
3385 varun.gupt 181
    this.promotion = promotion;
1982 varun.gupt 182
  }
183
 
3385 varun.gupt 184
  public void unsetPromotion() {
185
    this.promotion = null;
1982 varun.gupt 186
  }
187
 
3430 rajveer 188
  /** Returns true if field promotion is set (has been assigned a value) and false otherwise */
3385 varun.gupt 189
  public boolean isSetPromotion() {
190
    return this.promotion != null;
1982 varun.gupt 191
  }
192
 
3385 varun.gupt 193
  public void setPromotionIsSet(boolean value) {
194
    if (!value) {
195
      this.promotion = null;
196
    }
1982 varun.gupt 197
  }
198
 
199
  public String getArguments() {
200
    return this.arguments;
201
  }
202
 
3430 rajveer 203
  public void setArguments(String arguments) {
1982 varun.gupt 204
    this.arguments = arguments;
205
  }
206
 
207
  public void unsetArguments() {
208
    this.arguments = null;
209
  }
210
 
3430 rajveer 211
  /** Returns true if field arguments is set (has been assigned a value) and false otherwise */
1982 varun.gupt 212
  public boolean isSetArguments() {
213
    return this.arguments != null;
214
  }
215
 
216
  public void setArgumentsIsSet(boolean value) {
217
    if (!value) {
218
      this.arguments = null;
219
    }
220
  }
221
 
222
  public void setFieldValue(_Fields field, Object value) {
223
    switch (field) {
224
    case COUPON_CODE:
225
      if (value == null) {
226
        unsetCouponCode();
227
      } else {
228
        setCouponCode((String)value);
229
      }
230
      break;
231
 
3385 varun.gupt 232
    case PROMOTION:
1982 varun.gupt 233
      if (value == null) {
3385 varun.gupt 234
        unsetPromotion();
1982 varun.gupt 235
      } else {
3385 varun.gupt 236
        setPromotion((Promotion)value);
1982 varun.gupt 237
      }
238
      break;
239
 
240
    case ARGUMENTS:
241
      if (value == null) {
242
        unsetArguments();
243
      } else {
244
        setArguments((String)value);
245
      }
246
      break;
247
 
248
    }
249
  }
250
 
251
  public Object getFieldValue(_Fields field) {
252
    switch (field) {
253
    case COUPON_CODE:
254
      return getCouponCode();
255
 
3385 varun.gupt 256
    case PROMOTION:
257
      return getPromotion();
1982 varun.gupt 258
 
259
    case ARGUMENTS:
260
      return getArguments();
261
 
262
    }
263
    throw new IllegalStateException();
264
  }
265
 
3430 rajveer 266
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
267
  public boolean isSet(_Fields field) {
268
    if (field == null) {
269
      throw new IllegalArgumentException();
270
    }
1982 varun.gupt 271
 
272
    switch (field) {
273
    case COUPON_CODE:
274
      return isSetCouponCode();
3385 varun.gupt 275
    case PROMOTION:
276
      return isSetPromotion();
1982 varun.gupt 277
    case ARGUMENTS:
278
      return isSetArguments();
279
    }
280
    throw new IllegalStateException();
281
  }
282
 
283
  @Override
284
  public boolean equals(Object that) {
285
    if (that == null)
286
      return false;
287
    if (that instanceof Coupon)
288
      return this.equals((Coupon)that);
289
    return false;
290
  }
291
 
292
  public boolean equals(Coupon that) {
293
    if (that == null)
294
      return false;
295
 
296
    boolean this_present_couponCode = true && this.isSetCouponCode();
297
    boolean that_present_couponCode = true && that.isSetCouponCode();
298
    if (this_present_couponCode || that_present_couponCode) {
299
      if (!(this_present_couponCode && that_present_couponCode))
300
        return false;
301
      if (!this.couponCode.equals(that.couponCode))
302
        return false;
303
    }
304
 
3385 varun.gupt 305
    boolean this_present_promotion = true && this.isSetPromotion();
306
    boolean that_present_promotion = true && that.isSetPromotion();
307
    if (this_present_promotion || that_present_promotion) {
308
      if (!(this_present_promotion && that_present_promotion))
1982 varun.gupt 309
        return false;
3385 varun.gupt 310
      if (!this.promotion.equals(that.promotion))
1982 varun.gupt 311
        return false;
312
    }
313
 
314
    boolean this_present_arguments = true && this.isSetArguments();
315
    boolean that_present_arguments = true && that.isSetArguments();
316
    if (this_present_arguments || that_present_arguments) {
317
      if (!(this_present_arguments && that_present_arguments))
318
        return false;
319
      if (!this.arguments.equals(that.arguments))
320
        return false;
321
    }
322
 
323
    return true;
324
  }
325
 
326
  @Override
327
  public int hashCode() {
328
    return 0;
329
  }
330
 
331
  public int compareTo(Coupon other) {
332
    if (!getClass().equals(other.getClass())) {
333
      return getClass().getName().compareTo(other.getClass().getName());
334
    }
335
 
336
    int lastComparison = 0;
337
    Coupon typedOther = (Coupon)other;
338
 
3430 rajveer 339
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
1982 varun.gupt 340
    if (lastComparison != 0) {
341
      return lastComparison;
342
    }
3430 rajveer 343
    if (isSetCouponCode()) {
344
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
345
      if (lastComparison != 0) {
346
        return lastComparison;
347
      }
1982 varun.gupt 348
    }
3430 rajveer 349
    lastComparison = Boolean.valueOf(isSetPromotion()).compareTo(typedOther.isSetPromotion());
1982 varun.gupt 350
    if (lastComparison != 0) {
351
      return lastComparison;
352
    }
3430 rajveer 353
    if (isSetPromotion()) {
354
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotion, typedOther.promotion);
355
      if (lastComparison != 0) {
356
        return lastComparison;
357
      }
1982 varun.gupt 358
    }
3430 rajveer 359
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
1982 varun.gupt 360
    if (lastComparison != 0) {
361
      return lastComparison;
362
    }
3430 rajveer 363
    if (isSetArguments()) {
364
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
365
      if (lastComparison != 0) {
366
        return lastComparison;
367
      }
1982 varun.gupt 368
    }
369
    return 0;
370
  }
371
 
3430 rajveer 372
  public _Fields fieldForId(int fieldId) {
373
    return _Fields.findByThriftId(fieldId);
374
  }
375
 
376
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
377
    org.apache.thrift.protocol.TField field;
1982 varun.gupt 378
    iprot.readStructBegin();
379
    while (true)
380
    {
381
      field = iprot.readFieldBegin();
3430 rajveer 382
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
1982 varun.gupt 383
        break;
384
      }
3430 rajveer 385
      switch (field.id) {
386
        case 1: // COUPON_CODE
387
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
388
            this.couponCode = iprot.readString();
389
          } else { 
390
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
391
          }
392
          break;
393
        case 2: // PROMOTION
394
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
395
            this.promotion = new Promotion();
396
            this.promotion.read(iprot);
397
          } else { 
398
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
399
          }
400
          break;
401
        case 3: // ARGUMENTS
402
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
403
            this.arguments = iprot.readString();
404
          } else { 
405
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
406
          }
407
          break;
408
        default:
409
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1982 varun.gupt 410
      }
3430 rajveer 411
      iprot.readFieldEnd();
1982 varun.gupt 412
    }
413
    iprot.readStructEnd();
414
    validate();
415
  }
416
 
3430 rajveer 417
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1982 varun.gupt 418
    validate();
419
 
420
    oprot.writeStructBegin(STRUCT_DESC);
421
    if (this.couponCode != null) {
422
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
423
      oprot.writeString(this.couponCode);
424
      oprot.writeFieldEnd();
425
    }
3385 varun.gupt 426
    if (this.promotion != null) {
427
      oprot.writeFieldBegin(PROMOTION_FIELD_DESC);
428
      this.promotion.write(oprot);
429
      oprot.writeFieldEnd();
430
    }
1982 varun.gupt 431
    if (this.arguments != null) {
432
      oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
433
      oprot.writeString(this.arguments);
434
      oprot.writeFieldEnd();
435
    }
436
    oprot.writeFieldStop();
437
    oprot.writeStructEnd();
438
  }
439
 
440
  @Override
441
  public String toString() {
442
    StringBuilder sb = new StringBuilder("Coupon(");
443
    boolean first = true;
444
 
445
    sb.append("couponCode:");
446
    if (this.couponCode == null) {
447
      sb.append("null");
448
    } else {
449
      sb.append(this.couponCode);
450
    }
451
    first = false;
452
    if (!first) sb.append(", ");
3385 varun.gupt 453
    sb.append("promotion:");
454
    if (this.promotion == null) {
455
      sb.append("null");
456
    } else {
457
      sb.append(this.promotion);
458
    }
1982 varun.gupt 459
    first = false;
460
    if (!first) sb.append(", ");
461
    sb.append("arguments:");
462
    if (this.arguments == null) {
463
      sb.append("null");
464
    } else {
465
      sb.append(this.arguments);
466
    }
467
    first = false;
468
    sb.append(")");
469
    return sb.toString();
470
  }
471
 
3430 rajveer 472
  public void validate() throws org.apache.thrift.TException {
1982 varun.gupt 473
    // check for required fields
474
  }
475
 
3430 rajveer 476
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
477
    try {
478
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
479
    } catch (org.apache.thrift.TException te) {
480
      throw new java.io.IOException(te);
481
    }
482
  }
483
 
484
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
485
    try {
486
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
487
    } catch (org.apache.thrift.TException te) {
488
      throw new java.io.IOException(te);
489
    }
490
  }
491
 
1982 varun.gupt 492
}
493