Subversion Repositories SmartDukaan

Rev

Rev 1982 | 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 PromotionTracking implements org.apache.thrift.TBase<PromotionTracking, PromotionTracking._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PromotionTracking");
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 TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)3);
29
  private static final org.apache.thrift.protocol.TField APPLIED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("appliedOn", org.apache.thrift.protocol.TType.BOOL, (short)4);
1982 varun.gupt 30
 
3430 rajveer 31
  private String couponCode; // required
32
  private long transactionId; // required
33
  private long userId; // required
34
  private boolean appliedOn; // 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"),
39
    TRANSACTION_ID((short)2, "transactionId"),
40
    USER_ID((short)3, "userId"),
41
    APPLIED_ON((short)4, "appliedOn");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 55
      switch(fieldId) {
56
        case 1: // COUPON_CODE
57
          return COUPON_CODE;
58
        case 2: // TRANSACTION_ID
59
          return TRANSACTION_ID;
60
        case 3: // USER_ID
61
          return USER_ID;
62
        case 4: // APPLIED_ON
63
          return APPLIED_ON;
64
        default:
65
          return null;
66
      }
1982 varun.gupt 67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __TRANSACTIONID_ISSET_ID = 0;
105
  private static final int __USERID_ISSET_ID = 1;
106
  private static final int __APPLIEDON_ISSET_ID = 2;
107
  private BitSet __isset_bit_vector = new BitSet(3);
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.TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("transactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
116
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
118
    tmpMap.put(_Fields.APPLIED_ON, new org.apache.thrift.meta_data.FieldMetaData("appliedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
119
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
120
    metaDataMap = Collections.unmodifiableMap(tmpMap);
121
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PromotionTracking.class, metaDataMap);
1982 varun.gupt 122
  }
123
 
124
  public PromotionTracking() {
125
  }
126
 
127
  public PromotionTracking(
128
    String couponCode,
129
    long transactionId,
130
    long userId,
131
    boolean appliedOn)
132
  {
133
    this();
134
    this.couponCode = couponCode;
135
    this.transactionId = transactionId;
136
    setTransactionIdIsSet(true);
137
    this.userId = userId;
138
    setUserIdIsSet(true);
139
    this.appliedOn = appliedOn;
140
    setAppliedOnIsSet(true);
141
  }
142
 
143
  /**
144
   * Performs a deep copy on <i>other</i>.
145
   */
146
  public PromotionTracking(PromotionTracking other) {
147
    __isset_bit_vector.clear();
148
    __isset_bit_vector.or(other.__isset_bit_vector);
149
    if (other.isSetCouponCode()) {
150
      this.couponCode = other.couponCode;
151
    }
152
    this.transactionId = other.transactionId;
153
    this.userId = other.userId;
154
    this.appliedOn = other.appliedOn;
155
  }
156
 
157
  public PromotionTracking deepCopy() {
158
    return new PromotionTracking(this);
159
  }
160
 
3430 rajveer 161
  @Override
162
  public void clear() {
163
    this.couponCode = null;
164
    setTransactionIdIsSet(false);
165
    this.transactionId = 0;
166
    setUserIdIsSet(false);
167
    this.userId = 0;
168
    setAppliedOnIsSet(false);
169
    this.appliedOn = false;
1982 varun.gupt 170
  }
171
 
172
  public String getCouponCode() {
173
    return this.couponCode;
174
  }
175
 
3430 rajveer 176
  public void setCouponCode(String couponCode) {
1982 varun.gupt 177
    this.couponCode = couponCode;
178
  }
179
 
180
  public void unsetCouponCode() {
181
    this.couponCode = null;
182
  }
183
 
3430 rajveer 184
  /** Returns true if field couponCode is set (has been assigned a value) and false otherwise */
1982 varun.gupt 185
  public boolean isSetCouponCode() {
186
    return this.couponCode != null;
187
  }
188
 
189
  public void setCouponCodeIsSet(boolean value) {
190
    if (!value) {
191
      this.couponCode = null;
192
    }
193
  }
194
 
195
  public long getTransactionId() {
196
    return this.transactionId;
197
  }
198
 
3430 rajveer 199
  public void setTransactionId(long transactionId) {
1982 varun.gupt 200
    this.transactionId = transactionId;
201
    setTransactionIdIsSet(true);
202
  }
203
 
204
  public void unsetTransactionId() {
205
    __isset_bit_vector.clear(__TRANSACTIONID_ISSET_ID);
206
  }
207
 
3430 rajveer 208
  /** Returns true if field transactionId is set (has been assigned a value) and false otherwise */
1982 varun.gupt 209
  public boolean isSetTransactionId() {
210
    return __isset_bit_vector.get(__TRANSACTIONID_ISSET_ID);
211
  }
212
 
213
  public void setTransactionIdIsSet(boolean value) {
214
    __isset_bit_vector.set(__TRANSACTIONID_ISSET_ID, value);
215
  }
216
 
217
  public long getUserId() {
218
    return this.userId;
219
  }
220
 
3430 rajveer 221
  public void setUserId(long userId) {
1982 varun.gupt 222
    this.userId = userId;
223
    setUserIdIsSet(true);
224
  }
225
 
226
  public void unsetUserId() {
227
    __isset_bit_vector.clear(__USERID_ISSET_ID);
228
  }
229
 
3430 rajveer 230
  /** Returns true if field userId is set (has been assigned a value) and false otherwise */
1982 varun.gupt 231
  public boolean isSetUserId() {
232
    return __isset_bit_vector.get(__USERID_ISSET_ID);
233
  }
234
 
235
  public void setUserIdIsSet(boolean value) {
236
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
237
  }
238
 
239
  public boolean isAppliedOn() {
240
    return this.appliedOn;
241
  }
242
 
3430 rajveer 243
  public void setAppliedOn(boolean appliedOn) {
1982 varun.gupt 244
    this.appliedOn = appliedOn;
245
    setAppliedOnIsSet(true);
246
  }
247
 
248
  public void unsetAppliedOn() {
249
    __isset_bit_vector.clear(__APPLIEDON_ISSET_ID);
250
  }
251
 
3430 rajveer 252
  /** Returns true if field appliedOn is set (has been assigned a value) and false otherwise */
1982 varun.gupt 253
  public boolean isSetAppliedOn() {
254
    return __isset_bit_vector.get(__APPLIEDON_ISSET_ID);
255
  }
256
 
257
  public void setAppliedOnIsSet(boolean value) {
258
    __isset_bit_vector.set(__APPLIEDON_ISSET_ID, value);
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case COUPON_CODE:
264
      if (value == null) {
265
        unsetCouponCode();
266
      } else {
267
        setCouponCode((String)value);
268
      }
269
      break;
270
 
271
    case TRANSACTION_ID:
272
      if (value == null) {
273
        unsetTransactionId();
274
      } else {
275
        setTransactionId((Long)value);
276
      }
277
      break;
278
 
279
    case USER_ID:
280
      if (value == null) {
281
        unsetUserId();
282
      } else {
283
        setUserId((Long)value);
284
      }
285
      break;
286
 
287
    case APPLIED_ON:
288
      if (value == null) {
289
        unsetAppliedOn();
290
      } else {
291
        setAppliedOn((Boolean)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case COUPON_CODE:
301
      return getCouponCode();
302
 
303
    case TRANSACTION_ID:
3430 rajveer 304
      return Long.valueOf(getTransactionId());
1982 varun.gupt 305
 
306
    case USER_ID:
3430 rajveer 307
      return Long.valueOf(getUserId());
1982 varun.gupt 308
 
309
    case APPLIED_ON:
3430 rajveer 310
      return Boolean.valueOf(isAppliedOn());
1982 varun.gupt 311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
3430 rajveer 316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
1982 varun.gupt 321
 
322
    switch (field) {
323
    case COUPON_CODE:
324
      return isSetCouponCode();
325
    case TRANSACTION_ID:
326
      return isSetTransactionId();
327
    case USER_ID:
328
      return isSetUserId();
329
    case APPLIED_ON:
330
      return isSetAppliedOn();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof PromotionTracking)
340
      return this.equals((PromotionTracking)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(PromotionTracking that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_couponCode = true && this.isSetCouponCode();
349
    boolean that_present_couponCode = true && that.isSetCouponCode();
350
    if (this_present_couponCode || that_present_couponCode) {
351
      if (!(this_present_couponCode && that_present_couponCode))
352
        return false;
353
      if (!this.couponCode.equals(that.couponCode))
354
        return false;
355
    }
356
 
357
    boolean this_present_transactionId = true;
358
    boolean that_present_transactionId = true;
359
    if (this_present_transactionId || that_present_transactionId) {
360
      if (!(this_present_transactionId && that_present_transactionId))
361
        return false;
362
      if (this.transactionId != that.transactionId)
363
        return false;
364
    }
365
 
366
    boolean this_present_userId = true;
367
    boolean that_present_userId = true;
368
    if (this_present_userId || that_present_userId) {
369
      if (!(this_present_userId && that_present_userId))
370
        return false;
371
      if (this.userId != that.userId)
372
        return false;
373
    }
374
 
375
    boolean this_present_appliedOn = true;
376
    boolean that_present_appliedOn = true;
377
    if (this_present_appliedOn || that_present_appliedOn) {
378
      if (!(this_present_appliedOn && that_present_appliedOn))
379
        return false;
380
      if (this.appliedOn != that.appliedOn)
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(PromotionTracking other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    PromotionTracking typedOther = (PromotionTracking)other;
399
 
3430 rajveer 400
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
1982 varun.gupt 401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
3430 rajveer 404
    if (isSetCouponCode()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
1982 varun.gupt 409
    }
3430 rajveer 410
    lastComparison = Boolean.valueOf(isSetTransactionId()).compareTo(typedOther.isSetTransactionId());
1982 varun.gupt 411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
3430 rajveer 414
    if (isSetTransactionId()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transactionId, typedOther.transactionId);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
1982 varun.gupt 419
    }
3430 rajveer 420
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
1982 varun.gupt 421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
3430 rajveer 424
    if (isSetUserId()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
1982 varun.gupt 429
    }
3430 rajveer 430
    lastComparison = Boolean.valueOf(isSetAppliedOn()).compareTo(typedOther.isSetAppliedOn());
1982 varun.gupt 431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
3430 rajveer 434
    if (isSetAppliedOn()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appliedOn, typedOther.appliedOn);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
1982 varun.gupt 439
    }
440
    return 0;
441
  }
442
 
3430 rajveer 443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
1982 varun.gupt 449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
3430 rajveer 453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
1982 varun.gupt 454
        break;
455
      }
3430 rajveer 456
      switch (field.id) {
457
        case 1: // COUPON_CODE
458
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
459
            this.couponCode = iprot.readString();
460
          } else { 
461
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
462
          }
463
          break;
464
        case 2: // TRANSACTION_ID
465
          if (field.type == org.apache.thrift.protocol.TType.I64) {
466
            this.transactionId = iprot.readI64();
467
            setTransactionIdIsSet(true);
468
          } else { 
469
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
470
          }
471
          break;
472
        case 3: // USER_ID
473
          if (field.type == org.apache.thrift.protocol.TType.I64) {
474
            this.userId = iprot.readI64();
475
            setUserIdIsSet(true);
476
          } else { 
477
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
478
          }
479
          break;
480
        case 4: // APPLIED_ON
481
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
482
            this.appliedOn = iprot.readBool();
483
            setAppliedOnIsSet(true);
484
          } else { 
485
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
486
          }
487
          break;
488
        default:
489
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1982 varun.gupt 490
      }
3430 rajveer 491
      iprot.readFieldEnd();
1982 varun.gupt 492
    }
493
    iprot.readStructEnd();
494
    validate();
495
  }
496
 
3430 rajveer 497
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1982 varun.gupt 498
    validate();
499
 
500
    oprot.writeStructBegin(STRUCT_DESC);
501
    if (this.couponCode != null) {
502
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
503
      oprot.writeString(this.couponCode);
504
      oprot.writeFieldEnd();
505
    }
506
    oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
507
    oprot.writeI64(this.transactionId);
508
    oprot.writeFieldEnd();
509
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
510
    oprot.writeI64(this.userId);
511
    oprot.writeFieldEnd();
512
    oprot.writeFieldBegin(APPLIED_ON_FIELD_DESC);
513
    oprot.writeBool(this.appliedOn);
514
    oprot.writeFieldEnd();
515
    oprot.writeFieldStop();
516
    oprot.writeStructEnd();
517
  }
518
 
519
  @Override
520
  public String toString() {
521
    StringBuilder sb = new StringBuilder("PromotionTracking(");
522
    boolean first = true;
523
 
524
    sb.append("couponCode:");
525
    if (this.couponCode == null) {
526
      sb.append("null");
527
    } else {
528
      sb.append(this.couponCode);
529
    }
530
    first = false;
531
    if (!first) sb.append(", ");
532
    sb.append("transactionId:");
533
    sb.append(this.transactionId);
534
    first = false;
535
    if (!first) sb.append(", ");
536
    sb.append("userId:");
537
    sb.append(this.userId);
538
    first = false;
539
    if (!first) sb.append(", ");
540
    sb.append("appliedOn:");
541
    sb.append(this.appliedOn);
542
    first = false;
543
    sb.append(")");
544
    return sb.toString();
545
  }
546
 
3430 rajveer 547
  public void validate() throws org.apache.thrift.TException {
1982 varun.gupt 548
    // check for required fields
549
  }
550
 
3430 rajveer 551
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
552
    try {
553
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
554
    } catch (org.apache.thrift.TException te) {
555
      throw new java.io.IOException(te);
556
    }
557
  }
558
 
559
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
560
    try {
561
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
562
      __isset_bit_vector = new BitSet(1);
563
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
564
    } catch (org.apache.thrift.TException te) {
565
      throw new java.io.IOException(te);
566
    }
567
  }
568
 
1982 varun.gupt 569
}
570