Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1982 varun.gupt 1
/**
2
 * Autogenerated by Thrift
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.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class PromotionTracking implements TBase<PromotionTracking._Fields>, java.io.Serializable, Cloneable, Comparable<PromotionTracking> {
27
  private static final TStruct STRUCT_DESC = new TStruct("PromotionTracking");
28
 
29
  private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
30
  private static final TField TRANSACTION_ID_FIELD_DESC = new TField("transactionId", TType.I64, (short)2);
31
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)3);
32
  private static final TField APPLIED_ON_FIELD_DESC = new TField("appliedOn", TType.BOOL, (short)4);
33
 
34
  private String couponCode;
35
  private long transactionId;
36
  private long userId;
37
  private boolean appliedOn;
38
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
41
    COUPON_CODE((short)1, "couponCode"),
42
    TRANSACTION_ID((short)2, "transactionId"),
43
    USER_ID((short)3, "userId"),
44
    APPLIED_ON((short)4, "appliedOn");
45
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byId.put((int)field._thriftId, field);
52
        byName.put(field.getFieldName(), field);
53
      }
54
    }
55
 
56
    /**
57
     * Find the _Fields constant that matches fieldId, or null if its not found.
58
     */
59
    public static _Fields findByThriftId(int fieldId) {
60
      return byId.get(fieldId);
61
    }
62
 
63
    /**
64
     * Find the _Fields constant that matches fieldId, throwing an exception
65
     * if it is not found.
66
     */
67
    public static _Fields findByThriftIdOrThrow(int fieldId) {
68
      _Fields fields = findByThriftId(fieldId);
69
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
70
      return fields;
71
    }
72
 
73
    /**
74
     * Find the _Fields constant that matches name, or null if its not found.
75
     */
76
    public static _Fields findByName(String name) {
77
      return byName.get(name);
78
    }
79
 
80
    private final short _thriftId;
81
    private final String _fieldName;
82
 
83
    _Fields(short thriftId, String fieldName) {
84
      _thriftId = thriftId;
85
      _fieldName = fieldName;
86
    }
87
 
88
    public short getThriftFieldId() {
89
      return _thriftId;
90
    }
91
 
92
    public String getFieldName() {
93
      return _fieldName;
94
    }
95
  }
96
 
97
  // isset id assignments
98
  private static final int __TRANSACTIONID_ISSET_ID = 0;
99
  private static final int __USERID_ISSET_ID = 1;
100
  private static final int __APPLIEDON_ISSET_ID = 2;
101
  private BitSet __isset_bit_vector = new BitSet(3);
102
 
103
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
104
    put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.STRING)));
106
    put(_Fields.TRANSACTION_ID, new FieldMetaData("transactionId", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.I64)));
108
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.I64)));
110
    put(_Fields.APPLIED_ON, new FieldMetaData("appliedOn", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.BOOL)));
112
  }});
113
 
114
  static {
115
    FieldMetaData.addStructMetaDataMap(PromotionTracking.class, metaDataMap);
116
  }
117
 
118
  public PromotionTracking() {
119
  }
120
 
121
  public PromotionTracking(
122
    String couponCode,
123
    long transactionId,
124
    long userId,
125
    boolean appliedOn)
126
  {
127
    this();
128
    this.couponCode = couponCode;
129
    this.transactionId = transactionId;
130
    setTransactionIdIsSet(true);
131
    this.userId = userId;
132
    setUserIdIsSet(true);
133
    this.appliedOn = appliedOn;
134
    setAppliedOnIsSet(true);
135
  }
136
 
137
  /**
138
   * Performs a deep copy on <i>other</i>.
139
   */
140
  public PromotionTracking(PromotionTracking other) {
141
    __isset_bit_vector.clear();
142
    __isset_bit_vector.or(other.__isset_bit_vector);
143
    if (other.isSetCouponCode()) {
144
      this.couponCode = other.couponCode;
145
    }
146
    this.transactionId = other.transactionId;
147
    this.userId = other.userId;
148
    this.appliedOn = other.appliedOn;
149
  }
150
 
151
  public PromotionTracking deepCopy() {
152
    return new PromotionTracking(this);
153
  }
154
 
155
  @Deprecated
156
  public PromotionTracking clone() {
157
    return new PromotionTracking(this);
158
  }
159
 
160
  public String getCouponCode() {
161
    return this.couponCode;
162
  }
163
 
164
  public PromotionTracking setCouponCode(String couponCode) {
165
    this.couponCode = couponCode;
166
    return this;
167
  }
168
 
169
  public void unsetCouponCode() {
170
    this.couponCode = null;
171
  }
172
 
173
  /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
174
  public boolean isSetCouponCode() {
175
    return this.couponCode != null;
176
  }
177
 
178
  public void setCouponCodeIsSet(boolean value) {
179
    if (!value) {
180
      this.couponCode = null;
181
    }
182
  }
183
 
184
  public long getTransactionId() {
185
    return this.transactionId;
186
  }
187
 
188
  public PromotionTracking setTransactionId(long transactionId) {
189
    this.transactionId = transactionId;
190
    setTransactionIdIsSet(true);
191
    return this;
192
  }
193
 
194
  public void unsetTransactionId() {
195
    __isset_bit_vector.clear(__TRANSACTIONID_ISSET_ID);
196
  }
197
 
198
  /** Returns true if field transactionId is set (has been asigned a value) and false otherwise */
199
  public boolean isSetTransactionId() {
200
    return __isset_bit_vector.get(__TRANSACTIONID_ISSET_ID);
201
  }
202
 
203
  public void setTransactionIdIsSet(boolean value) {
204
    __isset_bit_vector.set(__TRANSACTIONID_ISSET_ID, value);
205
  }
206
 
207
  public long getUserId() {
208
    return this.userId;
209
  }
210
 
211
  public PromotionTracking setUserId(long userId) {
212
    this.userId = userId;
213
    setUserIdIsSet(true);
214
    return this;
215
  }
216
 
217
  public void unsetUserId() {
218
    __isset_bit_vector.clear(__USERID_ISSET_ID);
219
  }
220
 
221
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
222
  public boolean isSetUserId() {
223
    return __isset_bit_vector.get(__USERID_ISSET_ID);
224
  }
225
 
226
  public void setUserIdIsSet(boolean value) {
227
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
228
  }
229
 
230
  public boolean isAppliedOn() {
231
    return this.appliedOn;
232
  }
233
 
234
  public PromotionTracking setAppliedOn(boolean appliedOn) {
235
    this.appliedOn = appliedOn;
236
    setAppliedOnIsSet(true);
237
    return this;
238
  }
239
 
240
  public void unsetAppliedOn() {
241
    __isset_bit_vector.clear(__APPLIEDON_ISSET_ID);
242
  }
243
 
244
  /** Returns true if field appliedOn is set (has been asigned a value) and false otherwise */
245
  public boolean isSetAppliedOn() {
246
    return __isset_bit_vector.get(__APPLIEDON_ISSET_ID);
247
  }
248
 
249
  public void setAppliedOnIsSet(boolean value) {
250
    __isset_bit_vector.set(__APPLIEDON_ISSET_ID, value);
251
  }
252
 
253
  public void setFieldValue(_Fields field, Object value) {
254
    switch (field) {
255
    case COUPON_CODE:
256
      if (value == null) {
257
        unsetCouponCode();
258
      } else {
259
        setCouponCode((String)value);
260
      }
261
      break;
262
 
263
    case TRANSACTION_ID:
264
      if (value == null) {
265
        unsetTransactionId();
266
      } else {
267
        setTransactionId((Long)value);
268
      }
269
      break;
270
 
271
    case USER_ID:
272
      if (value == null) {
273
        unsetUserId();
274
      } else {
275
        setUserId((Long)value);
276
      }
277
      break;
278
 
279
    case APPLIED_ON:
280
      if (value == null) {
281
        unsetAppliedOn();
282
      } else {
283
        setAppliedOn((Boolean)value);
284
      }
285
      break;
286
 
287
    }
288
  }
289
 
290
  public void setFieldValue(int fieldID, Object value) {
291
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
292
  }
293
 
294
  public Object getFieldValue(_Fields field) {
295
    switch (field) {
296
    case COUPON_CODE:
297
      return getCouponCode();
298
 
299
    case TRANSACTION_ID:
300
      return new Long(getTransactionId());
301
 
302
    case USER_ID:
303
      return new Long(getUserId());
304
 
305
    case APPLIED_ON:
306
      return new Boolean(isAppliedOn());
307
 
308
    }
309
    throw new IllegalStateException();
310
  }
311
 
312
  public Object getFieldValue(int fieldId) {
313
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    switch (field) {
319
    case COUPON_CODE:
320
      return isSetCouponCode();
321
    case TRANSACTION_ID:
322
      return isSetTransactionId();
323
    case USER_ID:
324
      return isSetUserId();
325
    case APPLIED_ON:
326
      return isSetAppliedOn();
327
    }
328
    throw new IllegalStateException();
329
  }
330
 
331
  public boolean isSet(int fieldID) {
332
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
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
 
400
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
405
    if (lastComparison != 0) {
406
      return lastComparison;
407
    }
408
    lastComparison = Boolean.valueOf(isSetTransactionId()).compareTo(isSetTransactionId());
409
    if (lastComparison != 0) {
410
      return lastComparison;
411
    }
412
    lastComparison = TBaseHelper.compareTo(transactionId, typedOther.transactionId);
413
    if (lastComparison != 0) {
414
      return lastComparison;
415
    }
416
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
417
    if (lastComparison != 0) {
418
      return lastComparison;
419
    }
420
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    lastComparison = Boolean.valueOf(isSetAppliedOn()).compareTo(isSetAppliedOn());
425
    if (lastComparison != 0) {
426
      return lastComparison;
427
    }
428
    lastComparison = TBaseHelper.compareTo(appliedOn, typedOther.appliedOn);
429
    if (lastComparison != 0) {
430
      return lastComparison;
431
    }
432
    return 0;
433
  }
434
 
435
  public void read(TProtocol iprot) throws TException {
436
    TField field;
437
    iprot.readStructBegin();
438
    while (true)
439
    {
440
      field = iprot.readFieldBegin();
441
      if (field.type == TType.STOP) { 
442
        break;
443
      }
444
      _Fields fieldId = _Fields.findByThriftId(field.id);
445
      if (fieldId == null) {
446
        TProtocolUtil.skip(iprot, field.type);
447
      } else {
448
        switch (fieldId) {
449
          case COUPON_CODE:
450
            if (field.type == TType.STRING) {
451
              this.couponCode = iprot.readString();
452
            } else { 
453
              TProtocolUtil.skip(iprot, field.type);
454
            }
455
            break;
456
          case TRANSACTION_ID:
457
            if (field.type == TType.I64) {
458
              this.transactionId = iprot.readI64();
459
              setTransactionIdIsSet(true);
460
            } else { 
461
              TProtocolUtil.skip(iprot, field.type);
462
            }
463
            break;
464
          case USER_ID:
465
            if (field.type == TType.I64) {
466
              this.userId = iprot.readI64();
467
              setUserIdIsSet(true);
468
            } else { 
469
              TProtocolUtil.skip(iprot, field.type);
470
            }
471
            break;
472
          case APPLIED_ON:
473
            if (field.type == TType.BOOL) {
474
              this.appliedOn = iprot.readBool();
475
              setAppliedOnIsSet(true);
476
            } else { 
477
              TProtocolUtil.skip(iprot, field.type);
478
            }
479
            break;
480
        }
481
        iprot.readFieldEnd();
482
      }
483
    }
484
    iprot.readStructEnd();
485
    validate();
486
  }
487
 
488
  public void write(TProtocol oprot) throws TException {
489
    validate();
490
 
491
    oprot.writeStructBegin(STRUCT_DESC);
492
    if (this.couponCode != null) {
493
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
494
      oprot.writeString(this.couponCode);
495
      oprot.writeFieldEnd();
496
    }
497
    oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
498
    oprot.writeI64(this.transactionId);
499
    oprot.writeFieldEnd();
500
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
501
    oprot.writeI64(this.userId);
502
    oprot.writeFieldEnd();
503
    oprot.writeFieldBegin(APPLIED_ON_FIELD_DESC);
504
    oprot.writeBool(this.appliedOn);
505
    oprot.writeFieldEnd();
506
    oprot.writeFieldStop();
507
    oprot.writeStructEnd();
508
  }
509
 
510
  @Override
511
  public String toString() {
512
    StringBuilder sb = new StringBuilder("PromotionTracking(");
513
    boolean first = true;
514
 
515
    sb.append("couponCode:");
516
    if (this.couponCode == null) {
517
      sb.append("null");
518
    } else {
519
      sb.append(this.couponCode);
520
    }
521
    first = false;
522
    if (!first) sb.append(", ");
523
    sb.append("transactionId:");
524
    sb.append(this.transactionId);
525
    first = false;
526
    if (!first) sb.append(", ");
527
    sb.append("userId:");
528
    sb.append(this.userId);
529
    first = false;
530
    if (!first) sb.append(", ");
531
    sb.append("appliedOn:");
532
    sb.append(this.appliedOn);
533
    first = false;
534
    sb.append(")");
535
    return sb.toString();
536
  }
537
 
538
  public void validate() throws TException {
539
    // check for required fields
540
  }
541
 
542
}
543