Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12363 kshitij.so 1
/**
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.catalog;
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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class AmazonPromotion implements org.apache.thrift.TBase<AmazonPromotion, AmazonPromotion._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AmazonPromotion");
25
 
26
  private static final org.apache.thrift.protocol.TField SKU_FIELD_DESC = new org.apache.thrift.protocol.TField("sku", org.apache.thrift.protocol.TType.STRING, (short)1);
27
  private static final org.apache.thrift.protocol.TField STANDARD_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("standardPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)2);
28
  private static final org.apache.thrift.protocol.TField SALE_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("salePrice", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
29
  private static final org.apache.thrift.protocol.TField START_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("startDate", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField END_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("endDate", org.apache.thrift.protocol.TType.I64, (short)5);
31
  private static final org.apache.thrift.protocol.TField ADDED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("addedOn", org.apache.thrift.protocol.TType.I64, (short)6);
32
  private static final org.apache.thrift.protocol.TField UPDATED_ON_MARKETPLACE_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedOnMarketplace", org.apache.thrift.protocol.TType.I64, (short)7);
33
  private static final org.apache.thrift.protocol.TField STATE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("stateId", org.apache.thrift.protocol.TType.I64, (short)8);
34
  private static final org.apache.thrift.protocol.TField PROMOTION_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionActive", org.apache.thrift.protocol.TType.BOOL, (short)9);
35
  private static final org.apache.thrift.protocol.TField SUBSIDY_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("subsidyAmount", org.apache.thrift.protocol.TType.DOUBLE, (short)10);
36
  private static final org.apache.thrift.protocol.TField PROMOTION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionType", org.apache.thrift.protocol.TType.I32, (short)11);
37
 
38
  private String sku; // required
39
  private double standardPrice; // required
40
  private double salePrice; // required
41
  private long startDate; // required
42
  private long endDate; // required
43
  private long addedOn; // required
44
  private long updatedOnMarketplace; // required
45
  private long stateId; // required
46
  private boolean promotionActive; // required
47
  private double subsidyAmount; // required
48
  private AmazonPromotionType promotionType; // required
49
 
50
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
51
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
52
    SKU((short)1, "sku"),
53
    STANDARD_PRICE((short)2, "standardPrice"),
54
    SALE_PRICE((short)3, "salePrice"),
55
    START_DATE((short)4, "startDate"),
56
    END_DATE((short)5, "endDate"),
57
    ADDED_ON((short)6, "addedOn"),
58
    UPDATED_ON_MARKETPLACE((short)7, "updatedOnMarketplace"),
59
    STATE_ID((short)8, "stateId"),
60
    PROMOTION_ACTIVE((short)9, "promotionActive"),
61
    SUBSIDY_AMOUNT((short)10, "subsidyAmount"),
62
    /**
63
     * 
64
     * @see AmazonPromotionType
65
     */
66
    PROMOTION_TYPE((short)11, "promotionType");
67
 
68
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
69
 
70
    static {
71
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
72
        byName.put(field.getFieldName(), field);
73
      }
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches fieldId, or null if its not found.
78
     */
79
    public static _Fields findByThriftId(int fieldId) {
80
      switch(fieldId) {
81
        case 1: // SKU
82
          return SKU;
83
        case 2: // STANDARD_PRICE
84
          return STANDARD_PRICE;
85
        case 3: // SALE_PRICE
86
          return SALE_PRICE;
87
        case 4: // START_DATE
88
          return START_DATE;
89
        case 5: // END_DATE
90
          return END_DATE;
91
        case 6: // ADDED_ON
92
          return ADDED_ON;
93
        case 7: // UPDATED_ON_MARKETPLACE
94
          return UPDATED_ON_MARKETPLACE;
95
        case 8: // STATE_ID
96
          return STATE_ID;
97
        case 9: // PROMOTION_ACTIVE
98
          return PROMOTION_ACTIVE;
99
        case 10: // SUBSIDY_AMOUNT
100
          return SUBSIDY_AMOUNT;
101
        case 11: // PROMOTION_TYPE
102
          return PROMOTION_TYPE;
103
        default:
104
          return null;
105
      }
106
    }
107
 
108
    /**
109
     * Find the _Fields constant that matches fieldId, throwing an exception
110
     * if it is not found.
111
     */
112
    public static _Fields findByThriftIdOrThrow(int fieldId) {
113
      _Fields fields = findByThriftId(fieldId);
114
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
115
      return fields;
116
    }
117
 
118
    /**
119
     * Find the _Fields constant that matches name, or null if its not found.
120
     */
121
    public static _Fields findByName(String name) {
122
      return byName.get(name);
123
    }
124
 
125
    private final short _thriftId;
126
    private final String _fieldName;
127
 
128
    _Fields(short thriftId, String fieldName) {
129
      _thriftId = thriftId;
130
      _fieldName = fieldName;
131
    }
132
 
133
    public short getThriftFieldId() {
134
      return _thriftId;
135
    }
136
 
137
    public String getFieldName() {
138
      return _fieldName;
139
    }
140
  }
141
 
142
  // isset id assignments
143
  private static final int __STANDARDPRICE_ISSET_ID = 0;
144
  private static final int __SALEPRICE_ISSET_ID = 1;
145
  private static final int __STARTDATE_ISSET_ID = 2;
146
  private static final int __ENDDATE_ISSET_ID = 3;
147
  private static final int __ADDEDON_ISSET_ID = 4;
148
  private static final int __UPDATEDONMARKETPLACE_ISSET_ID = 5;
149
  private static final int __STATEID_ISSET_ID = 6;
150
  private static final int __PROMOTIONACTIVE_ISSET_ID = 7;
151
  private static final int __SUBSIDYAMOUNT_ISSET_ID = 8;
152
  private BitSet __isset_bit_vector = new BitSet(9);
153
 
154
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
155
  static {
156
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
157
    tmpMap.put(_Fields.SKU, new org.apache.thrift.meta_data.FieldMetaData("sku", org.apache.thrift.TFieldRequirementType.DEFAULT, 
158
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
159
    tmpMap.put(_Fields.STANDARD_PRICE, new org.apache.thrift.meta_data.FieldMetaData("standardPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
160
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
161
    tmpMap.put(_Fields.SALE_PRICE, new org.apache.thrift.meta_data.FieldMetaData("salePrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
162
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
163
    tmpMap.put(_Fields.START_DATE, new org.apache.thrift.meta_data.FieldMetaData("startDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
164
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
165
    tmpMap.put(_Fields.END_DATE, new org.apache.thrift.meta_data.FieldMetaData("endDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
166
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
167
    tmpMap.put(_Fields.ADDED_ON, new org.apache.thrift.meta_data.FieldMetaData("addedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
168
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
169
    tmpMap.put(_Fields.UPDATED_ON_MARKETPLACE, new org.apache.thrift.meta_data.FieldMetaData("updatedOnMarketplace", org.apache.thrift.TFieldRequirementType.DEFAULT, 
170
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
171
    tmpMap.put(_Fields.STATE_ID, new org.apache.thrift.meta_data.FieldMetaData("stateId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
172
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
173
    tmpMap.put(_Fields.PROMOTION_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("promotionActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
174
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
175
    tmpMap.put(_Fields.SUBSIDY_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("subsidyAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
176
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
177
    tmpMap.put(_Fields.PROMOTION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("promotionType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
178
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AmazonPromotionType.class)));
179
    metaDataMap = Collections.unmodifiableMap(tmpMap);
180
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AmazonPromotion.class, metaDataMap);
181
  }
182
 
183
  public AmazonPromotion() {
184
  }
185
 
186
  public AmazonPromotion(
187
    String sku,
188
    double standardPrice,
189
    double salePrice,
190
    long startDate,
191
    long endDate,
192
    long addedOn,
193
    long updatedOnMarketplace,
194
    long stateId,
195
    boolean promotionActive,
196
    double subsidyAmount,
197
    AmazonPromotionType promotionType)
198
  {
199
    this();
200
    this.sku = sku;
201
    this.standardPrice = standardPrice;
202
    setStandardPriceIsSet(true);
203
    this.salePrice = salePrice;
204
    setSalePriceIsSet(true);
205
    this.startDate = startDate;
206
    setStartDateIsSet(true);
207
    this.endDate = endDate;
208
    setEndDateIsSet(true);
209
    this.addedOn = addedOn;
210
    setAddedOnIsSet(true);
211
    this.updatedOnMarketplace = updatedOnMarketplace;
212
    setUpdatedOnMarketplaceIsSet(true);
213
    this.stateId = stateId;
214
    setStateIdIsSet(true);
215
    this.promotionActive = promotionActive;
216
    setPromotionActiveIsSet(true);
217
    this.subsidyAmount = subsidyAmount;
218
    setSubsidyAmountIsSet(true);
219
    this.promotionType = promotionType;
220
  }
221
 
222
  /**
223
   * Performs a deep copy on <i>other</i>.
224
   */
225
  public AmazonPromotion(AmazonPromotion other) {
226
    __isset_bit_vector.clear();
227
    __isset_bit_vector.or(other.__isset_bit_vector);
228
    if (other.isSetSku()) {
229
      this.sku = other.sku;
230
    }
231
    this.standardPrice = other.standardPrice;
232
    this.salePrice = other.salePrice;
233
    this.startDate = other.startDate;
234
    this.endDate = other.endDate;
235
    this.addedOn = other.addedOn;
236
    this.updatedOnMarketplace = other.updatedOnMarketplace;
237
    this.stateId = other.stateId;
238
    this.promotionActive = other.promotionActive;
239
    this.subsidyAmount = other.subsidyAmount;
240
    if (other.isSetPromotionType()) {
241
      this.promotionType = other.promotionType;
242
    }
243
  }
244
 
245
  public AmazonPromotion deepCopy() {
246
    return new AmazonPromotion(this);
247
  }
248
 
249
  @Override
250
  public void clear() {
251
    this.sku = null;
252
    setStandardPriceIsSet(false);
253
    this.standardPrice = 0.0;
254
    setSalePriceIsSet(false);
255
    this.salePrice = 0.0;
256
    setStartDateIsSet(false);
257
    this.startDate = 0;
258
    setEndDateIsSet(false);
259
    this.endDate = 0;
260
    setAddedOnIsSet(false);
261
    this.addedOn = 0;
262
    setUpdatedOnMarketplaceIsSet(false);
263
    this.updatedOnMarketplace = 0;
264
    setStateIdIsSet(false);
265
    this.stateId = 0;
266
    setPromotionActiveIsSet(false);
267
    this.promotionActive = false;
268
    setSubsidyAmountIsSet(false);
269
    this.subsidyAmount = 0.0;
270
    this.promotionType = null;
271
  }
272
 
273
  public String getSku() {
274
    return this.sku;
275
  }
276
 
277
  public void setSku(String sku) {
278
    this.sku = sku;
279
  }
280
 
281
  public void unsetSku() {
282
    this.sku = null;
283
  }
284
 
285
  /** Returns true if field sku is set (has been assigned a value) and false otherwise */
286
  public boolean isSetSku() {
287
    return this.sku != null;
288
  }
289
 
290
  public void setSkuIsSet(boolean value) {
291
    if (!value) {
292
      this.sku = null;
293
    }
294
  }
295
 
296
  public double getStandardPrice() {
297
    return this.standardPrice;
298
  }
299
 
300
  public void setStandardPrice(double standardPrice) {
301
    this.standardPrice = standardPrice;
302
    setStandardPriceIsSet(true);
303
  }
304
 
305
  public void unsetStandardPrice() {
306
    __isset_bit_vector.clear(__STANDARDPRICE_ISSET_ID);
307
  }
308
 
309
  /** Returns true if field standardPrice is set (has been assigned a value) and false otherwise */
310
  public boolean isSetStandardPrice() {
311
    return __isset_bit_vector.get(__STANDARDPRICE_ISSET_ID);
312
  }
313
 
314
  public void setStandardPriceIsSet(boolean value) {
315
    __isset_bit_vector.set(__STANDARDPRICE_ISSET_ID, value);
316
  }
317
 
318
  public double getSalePrice() {
319
    return this.salePrice;
320
  }
321
 
322
  public void setSalePrice(double salePrice) {
323
    this.salePrice = salePrice;
324
    setSalePriceIsSet(true);
325
  }
326
 
327
  public void unsetSalePrice() {
328
    __isset_bit_vector.clear(__SALEPRICE_ISSET_ID);
329
  }
330
 
331
  /** Returns true if field salePrice is set (has been assigned a value) and false otherwise */
332
  public boolean isSetSalePrice() {
333
    return __isset_bit_vector.get(__SALEPRICE_ISSET_ID);
334
  }
335
 
336
  public void setSalePriceIsSet(boolean value) {
337
    __isset_bit_vector.set(__SALEPRICE_ISSET_ID, value);
338
  }
339
 
340
  public long getStartDate() {
341
    return this.startDate;
342
  }
343
 
344
  public void setStartDate(long startDate) {
345
    this.startDate = startDate;
346
    setStartDateIsSet(true);
347
  }
348
 
349
  public void unsetStartDate() {
350
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
351
  }
352
 
353
  /** Returns true if field startDate is set (has been assigned a value) and false otherwise */
354
  public boolean isSetStartDate() {
355
    return __isset_bit_vector.get(__STARTDATE_ISSET_ID);
356
  }
357
 
358
  public void setStartDateIsSet(boolean value) {
359
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
360
  }
361
 
362
  public long getEndDate() {
363
    return this.endDate;
364
  }
365
 
366
  public void setEndDate(long endDate) {
367
    this.endDate = endDate;
368
    setEndDateIsSet(true);
369
  }
370
 
371
  public void unsetEndDate() {
372
    __isset_bit_vector.clear(__ENDDATE_ISSET_ID);
373
  }
374
 
375
  /** Returns true if field endDate is set (has been assigned a value) and false otherwise */
376
  public boolean isSetEndDate() {
377
    return __isset_bit_vector.get(__ENDDATE_ISSET_ID);
378
  }
379
 
380
  public void setEndDateIsSet(boolean value) {
381
    __isset_bit_vector.set(__ENDDATE_ISSET_ID, value);
382
  }
383
 
384
  public long getAddedOn() {
385
    return this.addedOn;
386
  }
387
 
388
  public void setAddedOn(long addedOn) {
389
    this.addedOn = addedOn;
390
    setAddedOnIsSet(true);
391
  }
392
 
393
  public void unsetAddedOn() {
394
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
395
  }
396
 
397
  /** Returns true if field addedOn is set (has been assigned a value) and false otherwise */
398
  public boolean isSetAddedOn() {
399
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
400
  }
401
 
402
  public void setAddedOnIsSet(boolean value) {
403
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
404
  }
405
 
406
  public long getUpdatedOnMarketplace() {
407
    return this.updatedOnMarketplace;
408
  }
409
 
410
  public void setUpdatedOnMarketplace(long updatedOnMarketplace) {
411
    this.updatedOnMarketplace = updatedOnMarketplace;
412
    setUpdatedOnMarketplaceIsSet(true);
413
  }
414
 
415
  public void unsetUpdatedOnMarketplace() {
416
    __isset_bit_vector.clear(__UPDATEDONMARKETPLACE_ISSET_ID);
417
  }
418
 
419
  /** Returns true if field updatedOnMarketplace is set (has been assigned a value) and false otherwise */
420
  public boolean isSetUpdatedOnMarketplace() {
421
    return __isset_bit_vector.get(__UPDATEDONMARKETPLACE_ISSET_ID);
422
  }
423
 
424
  public void setUpdatedOnMarketplaceIsSet(boolean value) {
425
    __isset_bit_vector.set(__UPDATEDONMARKETPLACE_ISSET_ID, value);
426
  }
427
 
428
  public long getStateId() {
429
    return this.stateId;
430
  }
431
 
432
  public void setStateId(long stateId) {
433
    this.stateId = stateId;
434
    setStateIdIsSet(true);
435
  }
436
 
437
  public void unsetStateId() {
438
    __isset_bit_vector.clear(__STATEID_ISSET_ID);
439
  }
440
 
441
  /** Returns true if field stateId is set (has been assigned a value) and false otherwise */
442
  public boolean isSetStateId() {
443
    return __isset_bit_vector.get(__STATEID_ISSET_ID);
444
  }
445
 
446
  public void setStateIdIsSet(boolean value) {
447
    __isset_bit_vector.set(__STATEID_ISSET_ID, value);
448
  }
449
 
450
  public boolean isPromotionActive() {
451
    return this.promotionActive;
452
  }
453
 
454
  public void setPromotionActive(boolean promotionActive) {
455
    this.promotionActive = promotionActive;
456
    setPromotionActiveIsSet(true);
457
  }
458
 
459
  public void unsetPromotionActive() {
460
    __isset_bit_vector.clear(__PROMOTIONACTIVE_ISSET_ID);
461
  }
462
 
463
  /** Returns true if field promotionActive is set (has been assigned a value) and false otherwise */
464
  public boolean isSetPromotionActive() {
465
    return __isset_bit_vector.get(__PROMOTIONACTIVE_ISSET_ID);
466
  }
467
 
468
  public void setPromotionActiveIsSet(boolean value) {
469
    __isset_bit_vector.set(__PROMOTIONACTIVE_ISSET_ID, value);
470
  }
471
 
472
  public double getSubsidyAmount() {
473
    return this.subsidyAmount;
474
  }
475
 
476
  public void setSubsidyAmount(double subsidyAmount) {
477
    this.subsidyAmount = subsidyAmount;
478
    setSubsidyAmountIsSet(true);
479
  }
480
 
481
  public void unsetSubsidyAmount() {
482
    __isset_bit_vector.clear(__SUBSIDYAMOUNT_ISSET_ID);
483
  }
484
 
485
  /** Returns true if field subsidyAmount is set (has been assigned a value) and false otherwise */
486
  public boolean isSetSubsidyAmount() {
487
    return __isset_bit_vector.get(__SUBSIDYAMOUNT_ISSET_ID);
488
  }
489
 
490
  public void setSubsidyAmountIsSet(boolean value) {
491
    __isset_bit_vector.set(__SUBSIDYAMOUNT_ISSET_ID, value);
492
  }
493
 
494
  /**
495
   * 
496
   * @see AmazonPromotionType
497
   */
498
  public AmazonPromotionType getPromotionType() {
499
    return this.promotionType;
500
  }
501
 
502
  /**
503
   * 
504
   * @see AmazonPromotionType
505
   */
506
  public void setPromotionType(AmazonPromotionType promotionType) {
507
    this.promotionType = promotionType;
508
  }
509
 
510
  public void unsetPromotionType() {
511
    this.promotionType = null;
512
  }
513
 
514
  /** Returns true if field promotionType is set (has been assigned a value) and false otherwise */
515
  public boolean isSetPromotionType() {
516
    return this.promotionType != null;
517
  }
518
 
519
  public void setPromotionTypeIsSet(boolean value) {
520
    if (!value) {
521
      this.promotionType = null;
522
    }
523
  }
524
 
525
  public void setFieldValue(_Fields field, Object value) {
526
    switch (field) {
527
    case SKU:
528
      if (value == null) {
529
        unsetSku();
530
      } else {
531
        setSku((String)value);
532
      }
533
      break;
534
 
535
    case STANDARD_PRICE:
536
      if (value == null) {
537
        unsetStandardPrice();
538
      } else {
539
        setStandardPrice((Double)value);
540
      }
541
      break;
542
 
543
    case SALE_PRICE:
544
      if (value == null) {
545
        unsetSalePrice();
546
      } else {
547
        setSalePrice((Double)value);
548
      }
549
      break;
550
 
551
    case START_DATE:
552
      if (value == null) {
553
        unsetStartDate();
554
      } else {
555
        setStartDate((Long)value);
556
      }
557
      break;
558
 
559
    case END_DATE:
560
      if (value == null) {
561
        unsetEndDate();
562
      } else {
563
        setEndDate((Long)value);
564
      }
565
      break;
566
 
567
    case ADDED_ON:
568
      if (value == null) {
569
        unsetAddedOn();
570
      } else {
571
        setAddedOn((Long)value);
572
      }
573
      break;
574
 
575
    case UPDATED_ON_MARKETPLACE:
576
      if (value == null) {
577
        unsetUpdatedOnMarketplace();
578
      } else {
579
        setUpdatedOnMarketplace((Long)value);
580
      }
581
      break;
582
 
583
    case STATE_ID:
584
      if (value == null) {
585
        unsetStateId();
586
      } else {
587
        setStateId((Long)value);
588
      }
589
      break;
590
 
591
    case PROMOTION_ACTIVE:
592
      if (value == null) {
593
        unsetPromotionActive();
594
      } else {
595
        setPromotionActive((Boolean)value);
596
      }
597
      break;
598
 
599
    case SUBSIDY_AMOUNT:
600
      if (value == null) {
601
        unsetSubsidyAmount();
602
      } else {
603
        setSubsidyAmount((Double)value);
604
      }
605
      break;
606
 
607
    case PROMOTION_TYPE:
608
      if (value == null) {
609
        unsetPromotionType();
610
      } else {
611
        setPromotionType((AmazonPromotionType)value);
612
      }
613
      break;
614
 
615
    }
616
  }
617
 
618
  public Object getFieldValue(_Fields field) {
619
    switch (field) {
620
    case SKU:
621
      return getSku();
622
 
623
    case STANDARD_PRICE:
624
      return Double.valueOf(getStandardPrice());
625
 
626
    case SALE_PRICE:
627
      return Double.valueOf(getSalePrice());
628
 
629
    case START_DATE:
630
      return Long.valueOf(getStartDate());
631
 
632
    case END_DATE:
633
      return Long.valueOf(getEndDate());
634
 
635
    case ADDED_ON:
636
      return Long.valueOf(getAddedOn());
637
 
638
    case UPDATED_ON_MARKETPLACE:
639
      return Long.valueOf(getUpdatedOnMarketplace());
640
 
641
    case STATE_ID:
642
      return Long.valueOf(getStateId());
643
 
644
    case PROMOTION_ACTIVE:
645
      return Boolean.valueOf(isPromotionActive());
646
 
647
    case SUBSIDY_AMOUNT:
648
      return Double.valueOf(getSubsidyAmount());
649
 
650
    case PROMOTION_TYPE:
651
      return getPromotionType();
652
 
653
    }
654
    throw new IllegalStateException();
655
  }
656
 
657
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
658
  public boolean isSet(_Fields field) {
659
    if (field == null) {
660
      throw new IllegalArgumentException();
661
    }
662
 
663
    switch (field) {
664
    case SKU:
665
      return isSetSku();
666
    case STANDARD_PRICE:
667
      return isSetStandardPrice();
668
    case SALE_PRICE:
669
      return isSetSalePrice();
670
    case START_DATE:
671
      return isSetStartDate();
672
    case END_DATE:
673
      return isSetEndDate();
674
    case ADDED_ON:
675
      return isSetAddedOn();
676
    case UPDATED_ON_MARKETPLACE:
677
      return isSetUpdatedOnMarketplace();
678
    case STATE_ID:
679
      return isSetStateId();
680
    case PROMOTION_ACTIVE:
681
      return isSetPromotionActive();
682
    case SUBSIDY_AMOUNT:
683
      return isSetSubsidyAmount();
684
    case PROMOTION_TYPE:
685
      return isSetPromotionType();
686
    }
687
    throw new IllegalStateException();
688
  }
689
 
690
  @Override
691
  public boolean equals(Object that) {
692
    if (that == null)
693
      return false;
694
    if (that instanceof AmazonPromotion)
695
      return this.equals((AmazonPromotion)that);
696
    return false;
697
  }
698
 
699
  public boolean equals(AmazonPromotion that) {
700
    if (that == null)
701
      return false;
702
 
703
    boolean this_present_sku = true && this.isSetSku();
704
    boolean that_present_sku = true && that.isSetSku();
705
    if (this_present_sku || that_present_sku) {
706
      if (!(this_present_sku && that_present_sku))
707
        return false;
708
      if (!this.sku.equals(that.sku))
709
        return false;
710
    }
711
 
712
    boolean this_present_standardPrice = true;
713
    boolean that_present_standardPrice = true;
714
    if (this_present_standardPrice || that_present_standardPrice) {
715
      if (!(this_present_standardPrice && that_present_standardPrice))
716
        return false;
717
      if (this.standardPrice != that.standardPrice)
718
        return false;
719
    }
720
 
721
    boolean this_present_salePrice = true;
722
    boolean that_present_salePrice = true;
723
    if (this_present_salePrice || that_present_salePrice) {
724
      if (!(this_present_salePrice && that_present_salePrice))
725
        return false;
726
      if (this.salePrice != that.salePrice)
727
        return false;
728
    }
729
 
730
    boolean this_present_startDate = true;
731
    boolean that_present_startDate = true;
732
    if (this_present_startDate || that_present_startDate) {
733
      if (!(this_present_startDate && that_present_startDate))
734
        return false;
735
      if (this.startDate != that.startDate)
736
        return false;
737
    }
738
 
739
    boolean this_present_endDate = true;
740
    boolean that_present_endDate = true;
741
    if (this_present_endDate || that_present_endDate) {
742
      if (!(this_present_endDate && that_present_endDate))
743
        return false;
744
      if (this.endDate != that.endDate)
745
        return false;
746
    }
747
 
748
    boolean this_present_addedOn = true;
749
    boolean that_present_addedOn = true;
750
    if (this_present_addedOn || that_present_addedOn) {
751
      if (!(this_present_addedOn && that_present_addedOn))
752
        return false;
753
      if (this.addedOn != that.addedOn)
754
        return false;
755
    }
756
 
757
    boolean this_present_updatedOnMarketplace = true;
758
    boolean that_present_updatedOnMarketplace = true;
759
    if (this_present_updatedOnMarketplace || that_present_updatedOnMarketplace) {
760
      if (!(this_present_updatedOnMarketplace && that_present_updatedOnMarketplace))
761
        return false;
762
      if (this.updatedOnMarketplace != that.updatedOnMarketplace)
763
        return false;
764
    }
765
 
766
    boolean this_present_stateId = true;
767
    boolean that_present_stateId = true;
768
    if (this_present_stateId || that_present_stateId) {
769
      if (!(this_present_stateId && that_present_stateId))
770
        return false;
771
      if (this.stateId != that.stateId)
772
        return false;
773
    }
774
 
775
    boolean this_present_promotionActive = true;
776
    boolean that_present_promotionActive = true;
777
    if (this_present_promotionActive || that_present_promotionActive) {
778
      if (!(this_present_promotionActive && that_present_promotionActive))
779
        return false;
780
      if (this.promotionActive != that.promotionActive)
781
        return false;
782
    }
783
 
784
    boolean this_present_subsidyAmount = true;
785
    boolean that_present_subsidyAmount = true;
786
    if (this_present_subsidyAmount || that_present_subsidyAmount) {
787
      if (!(this_present_subsidyAmount && that_present_subsidyAmount))
788
        return false;
789
      if (this.subsidyAmount != that.subsidyAmount)
790
        return false;
791
    }
792
 
793
    boolean this_present_promotionType = true && this.isSetPromotionType();
794
    boolean that_present_promotionType = true && that.isSetPromotionType();
795
    if (this_present_promotionType || that_present_promotionType) {
796
      if (!(this_present_promotionType && that_present_promotionType))
797
        return false;
798
      if (!this.promotionType.equals(that.promotionType))
799
        return false;
800
    }
801
 
802
    return true;
803
  }
804
 
805
  @Override
806
  public int hashCode() {
807
    return 0;
808
  }
809
 
810
  public int compareTo(AmazonPromotion other) {
811
    if (!getClass().equals(other.getClass())) {
812
      return getClass().getName().compareTo(other.getClass().getName());
813
    }
814
 
815
    int lastComparison = 0;
816
    AmazonPromotion typedOther = (AmazonPromotion)other;
817
 
818
    lastComparison = Boolean.valueOf(isSetSku()).compareTo(typedOther.isSetSku());
819
    if (lastComparison != 0) {
820
      return lastComparison;
821
    }
822
    if (isSetSku()) {
823
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sku, typedOther.sku);
824
      if (lastComparison != 0) {
825
        return lastComparison;
826
      }
827
    }
828
    lastComparison = Boolean.valueOf(isSetStandardPrice()).compareTo(typedOther.isSetStandardPrice());
829
    if (lastComparison != 0) {
830
      return lastComparison;
831
    }
832
    if (isSetStandardPrice()) {
833
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.standardPrice, typedOther.standardPrice);
834
      if (lastComparison != 0) {
835
        return lastComparison;
836
      }
837
    }
838
    lastComparison = Boolean.valueOf(isSetSalePrice()).compareTo(typedOther.isSetSalePrice());
839
    if (lastComparison != 0) {
840
      return lastComparison;
841
    }
842
    if (isSetSalePrice()) {
843
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.salePrice, typedOther.salePrice);
844
      if (lastComparison != 0) {
845
        return lastComparison;
846
      }
847
    }
848
    lastComparison = Boolean.valueOf(isSetStartDate()).compareTo(typedOther.isSetStartDate());
849
    if (lastComparison != 0) {
850
      return lastComparison;
851
    }
852
    if (isSetStartDate()) {
853
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startDate, typedOther.startDate);
854
      if (lastComparison != 0) {
855
        return lastComparison;
856
      }
857
    }
858
    lastComparison = Boolean.valueOf(isSetEndDate()).compareTo(typedOther.isSetEndDate());
859
    if (lastComparison != 0) {
860
      return lastComparison;
861
    }
862
    if (isSetEndDate()) {
863
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endDate, typedOther.endDate);
864
      if (lastComparison != 0) {
865
        return lastComparison;
866
      }
867
    }
868
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(typedOther.isSetAddedOn());
869
    if (lastComparison != 0) {
870
      return lastComparison;
871
    }
872
    if (isSetAddedOn()) {
873
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addedOn, typedOther.addedOn);
874
      if (lastComparison != 0) {
875
        return lastComparison;
876
      }
877
    }
878
    lastComparison = Boolean.valueOf(isSetUpdatedOnMarketplace()).compareTo(typedOther.isSetUpdatedOnMarketplace());
879
    if (lastComparison != 0) {
880
      return lastComparison;
881
    }
882
    if (isSetUpdatedOnMarketplace()) {
883
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updatedOnMarketplace, typedOther.updatedOnMarketplace);
884
      if (lastComparison != 0) {
885
        return lastComparison;
886
      }
887
    }
888
    lastComparison = Boolean.valueOf(isSetStateId()).compareTo(typedOther.isSetStateId());
889
    if (lastComparison != 0) {
890
      return lastComparison;
891
    }
892
    if (isSetStateId()) {
893
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateId, typedOther.stateId);
894
      if (lastComparison != 0) {
895
        return lastComparison;
896
      }
897
    }
898
    lastComparison = Boolean.valueOf(isSetPromotionActive()).compareTo(typedOther.isSetPromotionActive());
899
    if (lastComparison != 0) {
900
      return lastComparison;
901
    }
902
    if (isSetPromotionActive()) {
903
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionActive, typedOther.promotionActive);
904
      if (lastComparison != 0) {
905
        return lastComparison;
906
      }
907
    }
908
    lastComparison = Boolean.valueOf(isSetSubsidyAmount()).compareTo(typedOther.isSetSubsidyAmount());
909
    if (lastComparison != 0) {
910
      return lastComparison;
911
    }
912
    if (isSetSubsidyAmount()) {
913
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.subsidyAmount, typedOther.subsidyAmount);
914
      if (lastComparison != 0) {
915
        return lastComparison;
916
      }
917
    }
918
    lastComparison = Boolean.valueOf(isSetPromotionType()).compareTo(typedOther.isSetPromotionType());
919
    if (lastComparison != 0) {
920
      return lastComparison;
921
    }
922
    if (isSetPromotionType()) {
923
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionType, typedOther.promotionType);
924
      if (lastComparison != 0) {
925
        return lastComparison;
926
      }
927
    }
928
    return 0;
929
  }
930
 
931
  public _Fields fieldForId(int fieldId) {
932
    return _Fields.findByThriftId(fieldId);
933
  }
934
 
935
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
936
    org.apache.thrift.protocol.TField field;
937
    iprot.readStructBegin();
938
    while (true)
939
    {
940
      field = iprot.readFieldBegin();
941
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
942
        break;
943
      }
944
      switch (field.id) {
945
        case 1: // SKU
946
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
947
            this.sku = iprot.readString();
948
          } else { 
949
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
950
          }
951
          break;
952
        case 2: // STANDARD_PRICE
953
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
954
            this.standardPrice = iprot.readDouble();
955
            setStandardPriceIsSet(true);
956
          } else { 
957
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
958
          }
959
          break;
960
        case 3: // SALE_PRICE
961
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
962
            this.salePrice = iprot.readDouble();
963
            setSalePriceIsSet(true);
964
          } else { 
965
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
966
          }
967
          break;
968
        case 4: // START_DATE
969
          if (field.type == org.apache.thrift.protocol.TType.I64) {
970
            this.startDate = iprot.readI64();
971
            setStartDateIsSet(true);
972
          } else { 
973
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
974
          }
975
          break;
976
        case 5: // END_DATE
977
          if (field.type == org.apache.thrift.protocol.TType.I64) {
978
            this.endDate = iprot.readI64();
979
            setEndDateIsSet(true);
980
          } else { 
981
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
982
          }
983
          break;
984
        case 6: // ADDED_ON
985
          if (field.type == org.apache.thrift.protocol.TType.I64) {
986
            this.addedOn = iprot.readI64();
987
            setAddedOnIsSet(true);
988
          } else { 
989
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
990
          }
991
          break;
992
        case 7: // UPDATED_ON_MARKETPLACE
993
          if (field.type == org.apache.thrift.protocol.TType.I64) {
994
            this.updatedOnMarketplace = iprot.readI64();
995
            setUpdatedOnMarketplaceIsSet(true);
996
          } else { 
997
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
998
          }
999
          break;
1000
        case 8: // STATE_ID
1001
          if (field.type == org.apache.thrift.protocol.TType.I64) {
1002
            this.stateId = iprot.readI64();
1003
            setStateIdIsSet(true);
1004
          } else { 
1005
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1006
          }
1007
          break;
1008
        case 9: // PROMOTION_ACTIVE
1009
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
1010
            this.promotionActive = iprot.readBool();
1011
            setPromotionActiveIsSet(true);
1012
          } else { 
1013
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1014
          }
1015
          break;
1016
        case 10: // SUBSIDY_AMOUNT
1017
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
1018
            this.subsidyAmount = iprot.readDouble();
1019
            setSubsidyAmountIsSet(true);
1020
          } else { 
1021
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1022
          }
1023
          break;
1024
        case 11: // PROMOTION_TYPE
1025
          if (field.type == org.apache.thrift.protocol.TType.I32) {
1026
            this.promotionType = AmazonPromotionType.findByValue(iprot.readI32());
1027
          } else { 
1028
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1029
          }
1030
          break;
1031
        default:
1032
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1033
      }
1034
      iprot.readFieldEnd();
1035
    }
1036
    iprot.readStructEnd();
1037
    validate();
1038
  }
1039
 
1040
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1041
    validate();
1042
 
1043
    oprot.writeStructBegin(STRUCT_DESC);
1044
    if (this.sku != null) {
1045
      oprot.writeFieldBegin(SKU_FIELD_DESC);
1046
      oprot.writeString(this.sku);
1047
      oprot.writeFieldEnd();
1048
    }
1049
    oprot.writeFieldBegin(STANDARD_PRICE_FIELD_DESC);
1050
    oprot.writeDouble(this.standardPrice);
1051
    oprot.writeFieldEnd();
1052
    oprot.writeFieldBegin(SALE_PRICE_FIELD_DESC);
1053
    oprot.writeDouble(this.salePrice);
1054
    oprot.writeFieldEnd();
1055
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
1056
    oprot.writeI64(this.startDate);
1057
    oprot.writeFieldEnd();
1058
    oprot.writeFieldBegin(END_DATE_FIELD_DESC);
1059
    oprot.writeI64(this.endDate);
1060
    oprot.writeFieldEnd();
1061
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
1062
    oprot.writeI64(this.addedOn);
1063
    oprot.writeFieldEnd();
1064
    oprot.writeFieldBegin(UPDATED_ON_MARKETPLACE_FIELD_DESC);
1065
    oprot.writeI64(this.updatedOnMarketplace);
1066
    oprot.writeFieldEnd();
1067
    oprot.writeFieldBegin(STATE_ID_FIELD_DESC);
1068
    oprot.writeI64(this.stateId);
1069
    oprot.writeFieldEnd();
1070
    oprot.writeFieldBegin(PROMOTION_ACTIVE_FIELD_DESC);
1071
    oprot.writeBool(this.promotionActive);
1072
    oprot.writeFieldEnd();
1073
    oprot.writeFieldBegin(SUBSIDY_AMOUNT_FIELD_DESC);
1074
    oprot.writeDouble(this.subsidyAmount);
1075
    oprot.writeFieldEnd();
1076
    if (this.promotionType != null) {
1077
      oprot.writeFieldBegin(PROMOTION_TYPE_FIELD_DESC);
1078
      oprot.writeI32(this.promotionType.getValue());
1079
      oprot.writeFieldEnd();
1080
    }
1081
    oprot.writeFieldStop();
1082
    oprot.writeStructEnd();
1083
  }
1084
 
1085
  @Override
1086
  public String toString() {
1087
    StringBuilder sb = new StringBuilder("AmazonPromotion(");
1088
    boolean first = true;
1089
 
1090
    sb.append("sku:");
1091
    if (this.sku == null) {
1092
      sb.append("null");
1093
    } else {
1094
      sb.append(this.sku);
1095
    }
1096
    first = false;
1097
    if (!first) sb.append(", ");
1098
    sb.append("standardPrice:");
1099
    sb.append(this.standardPrice);
1100
    first = false;
1101
    if (!first) sb.append(", ");
1102
    sb.append("salePrice:");
1103
    sb.append(this.salePrice);
1104
    first = false;
1105
    if (!first) sb.append(", ");
1106
    sb.append("startDate:");
1107
    sb.append(this.startDate);
1108
    first = false;
1109
    if (!first) sb.append(", ");
1110
    sb.append("endDate:");
1111
    sb.append(this.endDate);
1112
    first = false;
1113
    if (!first) sb.append(", ");
1114
    sb.append("addedOn:");
1115
    sb.append(this.addedOn);
1116
    first = false;
1117
    if (!first) sb.append(", ");
1118
    sb.append("updatedOnMarketplace:");
1119
    sb.append(this.updatedOnMarketplace);
1120
    first = false;
1121
    if (!first) sb.append(", ");
1122
    sb.append("stateId:");
1123
    sb.append(this.stateId);
1124
    first = false;
1125
    if (!first) sb.append(", ");
1126
    sb.append("promotionActive:");
1127
    sb.append(this.promotionActive);
1128
    first = false;
1129
    if (!first) sb.append(", ");
1130
    sb.append("subsidyAmount:");
1131
    sb.append(this.subsidyAmount);
1132
    first = false;
1133
    if (!first) sb.append(", ");
1134
    sb.append("promotionType:");
1135
    if (this.promotionType == null) {
1136
      sb.append("null");
1137
    } else {
1138
      sb.append(this.promotionType);
1139
    }
1140
    first = false;
1141
    sb.append(")");
1142
    return sb.toString();
1143
  }
1144
 
1145
  public void validate() throws org.apache.thrift.TException {
1146
    // check for required fields
1147
  }
1148
 
1149
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
1150
    try {
1151
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
1152
    } catch (org.apache.thrift.TException te) {
1153
      throw new java.io.IOException(te);
1154
    }
1155
  }
1156
 
1157
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
1158
    try {
1159
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
1160
      __isset_bit_vector = new BitSet(1);
1161
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
1162
    } catch (org.apache.thrift.TException te) {
1163
      throw new java.io.IOException(te);
1164
    }
1165
  }
1166
 
1167
}
1168