Subversion Repositories SmartDukaan

Rev

Rev 1982 | Rev 3430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1982 Rev 3385
Line 25... Line 25...
25
 
25
 
26
public class Coupon implements TBase<Coupon._Fields>, java.io.Serializable, Cloneable, Comparable<Coupon> {
26
public class Coupon implements TBase<Coupon._Fields>, java.io.Serializable, Cloneable, Comparable<Coupon> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Coupon");
27
  private static final TStruct STRUCT_DESC = new TStruct("Coupon");
28
 
28
 
29
  private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
29
  private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
30
  private static final TField PROMOTION_ID_FIELD_DESC = new TField("promotionId", TType.I64, (short)2);
30
  private static final TField PROMOTION_FIELD_DESC = new TField("promotion", TType.STRUCT, (short)2);
31
  private static final TField ARGUMENTS_FIELD_DESC = new TField("arguments", TType.STRING, (short)3);
31
  private static final TField ARGUMENTS_FIELD_DESC = new TField("arguments", TType.STRING, (short)3);
32
 
32
 
33
  private String couponCode;
33
  private String couponCode;
34
  private long promotionId;
34
  private Promotion promotion;
35
  private String arguments;
35
  private String arguments;
36
 
36
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
38
  public enum _Fields implements TFieldIdEnum {
39
    COUPON_CODE((short)1, "couponCode"),
39
    COUPON_CODE((short)1, "couponCode"),
40
    PROMOTION_ID((short)2, "promotionId"),
40
    PROMOTION((short)2, "promotion"),
41
    ARGUMENTS((short)3, "arguments");
41
    ARGUMENTS((short)3, "arguments");
42
 
42
 
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
45
 
45
 
Line 90... Line 90...
90
      return _fieldName;
90
      return _fieldName;
91
    }
91
    }
92
  }
92
  }
93
 
93
 
94
  // isset id assignments
94
  // isset id assignments
95
  private static final int __PROMOTIONID_ISSET_ID = 0;
-
 
96
  private BitSet __isset_bit_vector = new BitSet(1);
-
 
97
 
95
 
98
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
96
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
99
    put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
97
    put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
100
        new FieldValueMetaData(TType.STRING)));
98
        new FieldValueMetaData(TType.STRING)));
101
    put(_Fields.PROMOTION_ID, new FieldMetaData("promotionId", TFieldRequirementType.DEFAULT, 
99
    put(_Fields.PROMOTION, new FieldMetaData("promotion", TFieldRequirementType.DEFAULT, 
102
        new FieldValueMetaData(TType.I64)));
100
        new StructMetaData(TType.STRUCT, Promotion.class)));
103
    put(_Fields.ARGUMENTS, new FieldMetaData("arguments", TFieldRequirementType.DEFAULT, 
101
    put(_Fields.ARGUMENTS, new FieldMetaData("arguments", TFieldRequirementType.DEFAULT, 
104
        new FieldValueMetaData(TType.STRING)));
102
        new FieldValueMetaData(TType.STRING)));
105
  }});
103
  }});
106
 
104
 
107
  static {
105
  static {
Line 111... Line 109...
111
  public Coupon() {
109
  public Coupon() {
112
  }
110
  }
113
 
111
 
114
  public Coupon(
112
  public Coupon(
115
    String couponCode,
113
    String couponCode,
116
    long promotionId,
114
    Promotion promotion,
117
    String arguments)
115
    String arguments)
118
  {
116
  {
119
    this();
117
    this();
120
    this.couponCode = couponCode;
118
    this.couponCode = couponCode;
121
    this.promotionId = promotionId;
119
    this.promotion = promotion;
122
    setPromotionIdIsSet(true);
-
 
123
    this.arguments = arguments;
120
    this.arguments = arguments;
124
  }
121
  }
125
 
122
 
126
  /**
123
  /**
127
   * Performs a deep copy on <i>other</i>.
124
   * Performs a deep copy on <i>other</i>.
128
   */
125
   */
129
  public Coupon(Coupon other) {
126
  public Coupon(Coupon other) {
130
    __isset_bit_vector.clear();
-
 
131
    __isset_bit_vector.or(other.__isset_bit_vector);
-
 
132
    if (other.isSetCouponCode()) {
127
    if (other.isSetCouponCode()) {
133
      this.couponCode = other.couponCode;
128
      this.couponCode = other.couponCode;
134
    }
129
    }
-
 
130
    if (other.isSetPromotion()) {
135
    this.promotionId = other.promotionId;
131
      this.promotion = new Promotion(other.promotion);
-
 
132
    }
136
    if (other.isSetArguments()) {
133
    if (other.isSetArguments()) {
137
      this.arguments = other.arguments;
134
      this.arguments = other.arguments;
138
    }
135
    }
139
  }
136
  }
140
 
137
 
Line 169... Line 166...
169
    if (!value) {
166
    if (!value) {
170
      this.couponCode = null;
167
      this.couponCode = null;
171
    }
168
    }
172
  }
169
  }
173
 
170
 
174
  public long getPromotionId() {
171
  public Promotion getPromotion() {
175
    return this.promotionId;
172
    return this.promotion;
176
  }
173
  }
177
 
174
 
178
  public Coupon setPromotionId(long promotionId) {
175
  public Coupon setPromotion(Promotion promotion) {
179
    this.promotionId = promotionId;
176
    this.promotion = promotion;
180
    setPromotionIdIsSet(true);
-
 
181
    return this;
177
    return this;
182
  }
178
  }
183
 
179
 
184
  public void unsetPromotionId() {
180
  public void unsetPromotion() {
185
    __isset_bit_vector.clear(__PROMOTIONID_ISSET_ID);
181
    this.promotion = null;
186
  }
182
  }
187
 
183
 
188
  /** Returns true if field promotionId is set (has been asigned a value) and false otherwise */
184
  /** Returns true if field promotion is set (has been asigned a value) and false otherwise */
189
  public boolean isSetPromotionId() {
185
  public boolean isSetPromotion() {
190
    return __isset_bit_vector.get(__PROMOTIONID_ISSET_ID);
186
    return this.promotion != null;
191
  }
187
  }
192
 
188
 
193
  public void setPromotionIdIsSet(boolean value) {
189
  public void setPromotionIsSet(boolean value) {
-
 
190
    if (!value) {
194
    __isset_bit_vector.set(__PROMOTIONID_ISSET_ID, value);
191
      this.promotion = null;
-
 
192
    }
195
  }
193
  }
196
 
194
 
197
  public String getArguments() {
195
  public String getArguments() {
198
    return this.arguments;
196
    return this.arguments;
199
  }
197
  }
Line 226... Line 224...
226
      } else {
224
      } else {
227
        setCouponCode((String)value);
225
        setCouponCode((String)value);
228
      }
226
      }
229
      break;
227
      break;
230
 
228
 
231
    case PROMOTION_ID:
229
    case PROMOTION:
232
      if (value == null) {
230
      if (value == null) {
233
        unsetPromotionId();
231
        unsetPromotion();
234
      } else {
232
      } else {
235
        setPromotionId((Long)value);
233
        setPromotion((Promotion)value);
236
      }
234
      }
237
      break;
235
      break;
238
 
236
 
239
    case ARGUMENTS:
237
    case ARGUMENTS:
240
      if (value == null) {
238
      if (value == null) {
Line 254... Line 252...
254
  public Object getFieldValue(_Fields field) {
252
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
253
    switch (field) {
256
    case COUPON_CODE:
254
    case COUPON_CODE:
257
      return getCouponCode();
255
      return getCouponCode();
258
 
256
 
259
    case PROMOTION_ID:
257
    case PROMOTION:
260
      return new Long(getPromotionId());
258
      return getPromotion();
261
 
259
 
262
    case ARGUMENTS:
260
    case ARGUMENTS:
263
      return getArguments();
261
      return getArguments();
264
 
262
 
265
    }
263
    }
Line 273... Line 271...
273
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
271
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
274
  public boolean isSet(_Fields field) {
272
  public boolean isSet(_Fields field) {
275
    switch (field) {
273
    switch (field) {
276
    case COUPON_CODE:
274
    case COUPON_CODE:
277
      return isSetCouponCode();
275
      return isSetCouponCode();
278
    case PROMOTION_ID:
276
    case PROMOTION:
279
      return isSetPromotionId();
277
      return isSetPromotion();
280
    case ARGUMENTS:
278
    case ARGUMENTS:
281
      return isSetArguments();
279
      return isSetArguments();
282
    }
280
    }
283
    throw new IllegalStateException();
281
    throw new IllegalStateException();
284
  }
282
  }
Line 307... Line 305...
307
        return false;
305
        return false;
308
      if (!this.couponCode.equals(that.couponCode))
306
      if (!this.couponCode.equals(that.couponCode))
309
        return false;
307
        return false;
310
    }
308
    }
311
 
309
 
312
    boolean this_present_promotionId = true;
310
    boolean this_present_promotion = true && this.isSetPromotion();
313
    boolean that_present_promotionId = true;
311
    boolean that_present_promotion = true && that.isSetPromotion();
314
    if (this_present_promotionId || that_present_promotionId) {
312
    if (this_present_promotion || that_present_promotion) {
315
      if (!(this_present_promotionId && that_present_promotionId))
313
      if (!(this_present_promotion && that_present_promotion))
316
        return false;
314
        return false;
317
      if (this.promotionId != that.promotionId)
315
      if (!this.promotion.equals(that.promotion))
318
        return false;
316
        return false;
319
    }
317
    }
320
 
318
 
321
    boolean this_present_arguments = true && this.isSetArguments();
319
    boolean this_present_arguments = true && this.isSetArguments();
322
    boolean that_present_arguments = true && that.isSetArguments();
320
    boolean that_present_arguments = true && that.isSetArguments();
Line 349... Line 347...
349
    }
347
    }
350
    lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
348
    lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
351
    if (lastComparison != 0) {
349
    if (lastComparison != 0) {
352
      return lastComparison;
350
      return lastComparison;
353
    }
351
    }
354
    lastComparison = Boolean.valueOf(isSetPromotionId()).compareTo(isSetPromotionId());
352
    lastComparison = Boolean.valueOf(isSetPromotion()).compareTo(isSetPromotion());
355
    if (lastComparison != 0) {
353
    if (lastComparison != 0) {
356
      return lastComparison;
354
      return lastComparison;
357
    }
355
    }
358
    lastComparison = TBaseHelper.compareTo(promotionId, typedOther.promotionId);
356
    lastComparison = TBaseHelper.compareTo(promotion, typedOther.promotion);
359
    if (lastComparison != 0) {
357
    if (lastComparison != 0) {
360
      return lastComparison;
358
      return lastComparison;
361
    }
359
    }
362
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(isSetArguments());
360
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(isSetArguments());
363
    if (lastComparison != 0) {
361
    if (lastComparison != 0) {
Line 389... Line 387...
389
              this.couponCode = iprot.readString();
387
              this.couponCode = iprot.readString();
390
            } else { 
388
            } else { 
391
              TProtocolUtil.skip(iprot, field.type);
389
              TProtocolUtil.skip(iprot, field.type);
392
            }
390
            }
393
            break;
391
            break;
394
          case PROMOTION_ID:
392
          case PROMOTION:
395
            if (field.type == TType.I64) {
393
            if (field.type == TType.STRUCT) {
396
              this.promotionId = iprot.readI64();
394
              this.promotion = new Promotion();
397
              setPromotionIdIsSet(true);
395
              this.promotion.read(iprot);
398
            } else { 
396
            } else { 
399
              TProtocolUtil.skip(iprot, field.type);
397
              TProtocolUtil.skip(iprot, field.type);
400
            }
398
            }
401
            break;
399
            break;
402
          case ARGUMENTS:
400
          case ARGUMENTS:
Line 421... Line 419...
421
    if (this.couponCode != null) {
419
    if (this.couponCode != null) {
422
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
420
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
423
      oprot.writeString(this.couponCode);
421
      oprot.writeString(this.couponCode);
424
      oprot.writeFieldEnd();
422
      oprot.writeFieldEnd();
425
    }
423
    }
-
 
424
    if (this.promotion != null) {
426
    oprot.writeFieldBegin(PROMOTION_ID_FIELD_DESC);
425
      oprot.writeFieldBegin(PROMOTION_FIELD_DESC);
427
    oprot.writeI64(this.promotionId);
426
      this.promotion.write(oprot);
428
    oprot.writeFieldEnd();
427
      oprot.writeFieldEnd();
-
 
428
    }
429
    if (this.arguments != null) {
429
    if (this.arguments != null) {
430
      oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
430
      oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
431
      oprot.writeString(this.arguments);
431
      oprot.writeString(this.arguments);
432
      oprot.writeFieldEnd();
432
      oprot.writeFieldEnd();
433
    }
433
    }
Line 446... Line 446...
446
    } else {
446
    } else {
447
      sb.append(this.couponCode);
447
      sb.append(this.couponCode);
448
    }
448
    }
449
    first = false;
449
    first = false;
450
    if (!first) sb.append(", ");
450
    if (!first) sb.append(", ");
451
    sb.append("promotionId:");
451
    sb.append("promotion:");
-
 
452
    if (this.promotion == null) {
-
 
453
      sb.append("null");
-
 
454
    } else {
452
    sb.append(this.promotionId);
455
      sb.append(this.promotion);
-
 
456
    }
453
    first = false;
457
    first = false;
454
    if (!first) sb.append(", ");
458
    if (!first) sb.append(", ");
455
    sb.append("arguments:");
459
    sb.append("arguments:");
456
    if (this.arguments == null) {
460
    if (this.arguments == null) {
457
      sb.append("null");
461
      sb.append("null");