Subversion Repositories SmartDukaan

Rev

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

Rev 3385 Rev 3430
Line 1... Line 1...
1
/**
1
/**
2
 * Autogenerated by Thrift
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
5
 */
6
package in.shop2020.model.v1.user;
6
package in.shop2020.model.v1.user;
7
 
7
 
Line 13... Line 13...
13
import java.util.Set;
13
import java.util.Set;
14
import java.util.HashSet;
14
import java.util.HashSet;
15
import java.util.EnumSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
16
import java.util.Collections;
17
import java.util.BitSet;
17
import java.util.BitSet;
-
 
18
import java.nio.ByteBuffer;
18
import java.util.Arrays;
19
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
21
 
22
 
22
import org.apache.thrift.*;
-
 
23
import org.apache.thrift.meta_data.*;
-
 
24
import org.apache.thrift.protocol.*;
-
 
25
 
-
 
26
public class Coupon implements TBase<Coupon._Fields>, java.io.Serializable, Cloneable, Comparable<Coupon> {
23
public class Coupon implements org.apache.thrift.TBase<Coupon, Coupon._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Coupon");
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Coupon");
28
 
25
 
29
  private static final TField COUPON_CODE_FIELD_DESC = new TField("couponCode", TType.STRING, (short)1);
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);
30
  private static final TField PROMOTION_FIELD_DESC = new TField("promotion", TType.STRUCT, (short)2);
27
  private static final org.apache.thrift.protocol.TField PROMOTION_FIELD_DESC = new org.apache.thrift.protocol.TField("promotion", org.apache.thrift.protocol.TType.STRUCT, (short)2);
31
  private static final TField ARGUMENTS_FIELD_DESC = new TField("arguments", TType.STRING, (short)3);
28
  private static final org.apache.thrift.protocol.TField ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("arguments", org.apache.thrift.protocol.TType.STRING, (short)3);
32
 
29
 
33
  private String couponCode;
30
  private String couponCode; // required
34
  private Promotion promotion;
31
  private Promotion promotion; // required
35
  private String arguments;
32
  private String arguments; // required
36
 
33
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
39
    COUPON_CODE((short)1, "couponCode"),
36
    COUPON_CODE((short)1, "couponCode"),
40
    PROMOTION((short)2, "promotion"),
37
    PROMOTION((short)2, "promotion"),
41
    ARGUMENTS((short)3, "arguments");
38
    ARGUMENTS((short)3, "arguments");
42
 
39
 
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
45
 
41
 
46
    static {
42
    static {
47
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
48
        byId.put((int)field._thriftId, field);
-
 
49
        byName.put(field.getFieldName(), field);
44
        byName.put(field.getFieldName(), field);
50
      }
45
      }
51
    }
46
    }
52
 
47
 
53
    /**
48
    /**
54
     * Find the _Fields constant that matches fieldId, or null if its not found.
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
55
     */
50
     */
56
    public static _Fields findByThriftId(int fieldId) {
51
    public static _Fields findByThriftId(int fieldId) {
57
      return byId.get(fieldId);
52
      switch(fieldId) {
-
 
53
        case 1: // COUPON_CODE
-
 
54
          return COUPON_CODE;
-
 
55
        case 2: // PROMOTION
-
 
56
          return PROMOTION;
-
 
57
        case 3: // ARGUMENTS
-
 
58
          return ARGUMENTS;
-
 
59
        default:
-
 
60
          return null;
-
 
61
      }
58
    }
62
    }
59
 
63
 
60
    /**
64
    /**
61
     * Find the _Fields constant that matches fieldId, throwing an exception
65
     * Find the _Fields constant that matches fieldId, throwing an exception
62
     * if it is not found.
66
     * if it is not found.
Line 91... Line 95...
91
    }
95
    }
92
  }
96
  }
93
 
97
 
94
  // isset id assignments
98
  // isset id assignments
95
 
99
 
96
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
100
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
97
    put(_Fields.COUPON_CODE, new FieldMetaData("couponCode", TFieldRequirementType.DEFAULT, 
-
 
98
        new FieldValueMetaData(TType.STRING)));
-
 
99
    put(_Fields.PROMOTION, new FieldMetaData("promotion", TFieldRequirementType.DEFAULT, 
-
 
100
        new StructMetaData(TType.STRUCT, Promotion.class)));
-
 
101
    put(_Fields.ARGUMENTS, new FieldMetaData("arguments", TFieldRequirementType.DEFAULT, 
-
 
102
        new FieldValueMetaData(TType.STRING)));
-
 
103
  }});
-
 
104
 
-
 
105
  static {
101
  static {
-
 
102
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-
 
103
    tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
104
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-
 
105
    tmpMap.put(_Fields.PROMOTION, new org.apache.thrift.meta_data.FieldMetaData("promotion", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
106
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Promotion.class)));
-
 
107
    tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-
 
109
    metaDataMap = Collections.unmodifiableMap(tmpMap);
106
    FieldMetaData.addStructMetaDataMap(Coupon.class, metaDataMap);
110
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Coupon.class, metaDataMap);
107
  }
111
  }
108
 
112
 
109
  public Coupon() {
113
  public Coupon() {
110
  }
114
  }
111
 
115
 
Line 137... Line 141...
137
 
141
 
138
  public Coupon deepCopy() {
142
  public Coupon deepCopy() {
139
    return new Coupon(this);
143
    return new Coupon(this);
140
  }
144
  }
141
 
145
 
142
  @Deprecated
146
  @Override
143
  public Coupon clone() {
147
  public void clear() {
-
 
148
    this.couponCode = null;
144
    return new Coupon(this);
149
    this.promotion = null;
-
 
150
    this.arguments = null;
145
  }
151
  }
146
 
152
 
147
  public String getCouponCode() {
153
  public String getCouponCode() {
148
    return this.couponCode;
154
    return this.couponCode;
149
  }
155
  }
150
 
156
 
151
  public Coupon setCouponCode(String couponCode) {
157
  public void setCouponCode(String couponCode) {
152
    this.couponCode = couponCode;
158
    this.couponCode = couponCode;
153
    return this;
-
 
154
  }
159
  }
155
 
160
 
156
  public void unsetCouponCode() {
161
  public void unsetCouponCode() {
157
    this.couponCode = null;
162
    this.couponCode = null;
158
  }
163
  }
159
 
164
 
160
  /** Returns true if field couponCode is set (has been asigned a value) and false otherwise */
165
  /** Returns true if field couponCode is set (has been assigned a value) and false otherwise */
161
  public boolean isSetCouponCode() {
166
  public boolean isSetCouponCode() {
162
    return this.couponCode != null;
167
    return this.couponCode != null;
163
  }
168
  }
164
 
169
 
165
  public void setCouponCodeIsSet(boolean value) {
170
  public void setCouponCodeIsSet(boolean value) {
Line 170... Line 175...
170
 
175
 
171
  public Promotion getPromotion() {
176
  public Promotion getPromotion() {
172
    return this.promotion;
177
    return this.promotion;
173
  }
178
  }
174
 
179
 
175
  public Coupon setPromotion(Promotion promotion) {
180
  public void setPromotion(Promotion promotion) {
176
    this.promotion = promotion;
181
    this.promotion = promotion;
177
    return this;
-
 
178
  }
182
  }
179
 
183
 
180
  public void unsetPromotion() {
184
  public void unsetPromotion() {
181
    this.promotion = null;
185
    this.promotion = null;
182
  }
186
  }
183
 
187
 
184
  /** Returns true if field promotion is set (has been asigned a value) and false otherwise */
188
  /** Returns true if field promotion is set (has been assigned a value) and false otherwise */
185
  public boolean isSetPromotion() {
189
  public boolean isSetPromotion() {
186
    return this.promotion != null;
190
    return this.promotion != null;
187
  }
191
  }
188
 
192
 
189
  public void setPromotionIsSet(boolean value) {
193
  public void setPromotionIsSet(boolean value) {
Line 194... Line 198...
194
 
198
 
195
  public String getArguments() {
199
  public String getArguments() {
196
    return this.arguments;
200
    return this.arguments;
197
  }
201
  }
198
 
202
 
199
  public Coupon setArguments(String arguments) {
203
  public void setArguments(String arguments) {
200
    this.arguments = arguments;
204
    this.arguments = arguments;
201
    return this;
-
 
202
  }
205
  }
203
 
206
 
204
  public void unsetArguments() {
207
  public void unsetArguments() {
205
    this.arguments = null;
208
    this.arguments = null;
206
  }
209
  }
207
 
210
 
208
  /** Returns true if field arguments is set (has been asigned a value) and false otherwise */
211
  /** Returns true if field arguments is set (has been assigned a value) and false otherwise */
209
  public boolean isSetArguments() {
212
  public boolean isSetArguments() {
210
    return this.arguments != null;
213
    return this.arguments != null;
211
  }
214
  }
212
 
215
 
213
  public void setArgumentsIsSet(boolean value) {
216
  public void setArgumentsIsSet(boolean value) {
Line 243... Line 246...
243
      break;
246
      break;
244
 
247
 
245
    }
248
    }
246
  }
249
  }
247
 
250
 
248
  public void setFieldValue(int fieldID, Object value) {
-
 
249
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
250
  }
-
 
251
 
-
 
252
  public Object getFieldValue(_Fields field) {
251
  public Object getFieldValue(_Fields field) {
253
    switch (field) {
252
    switch (field) {
254
    case COUPON_CODE:
253
    case COUPON_CODE:
255
      return getCouponCode();
254
      return getCouponCode();
256
 
255
 
Line 262... Line 261...
262
 
261
 
263
    }
262
    }
264
    throw new IllegalStateException();
263
    throw new IllegalStateException();
265
  }
264
  }
266
 
265
 
267
  public Object getFieldValue(int fieldId) {
-
 
268
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
269
  }
-
 
270
 
-
 
271
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
266
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
272
  public boolean isSet(_Fields field) {
267
  public boolean isSet(_Fields field) {
-
 
268
    if (field == null) {
-
 
269
      throw new IllegalArgumentException();
-
 
270
    }
-
 
271
 
273
    switch (field) {
272
    switch (field) {
274
    case COUPON_CODE:
273
    case COUPON_CODE:
275
      return isSetCouponCode();
274
      return isSetCouponCode();
276
    case PROMOTION:
275
    case PROMOTION:
277
      return isSetPromotion();
276
      return isSetPromotion();
Line 279... Line 278...
279
      return isSetArguments();
278
      return isSetArguments();
280
    }
279
    }
281
    throw new IllegalStateException();
280
    throw new IllegalStateException();
282
  }
281
  }
283
 
282
 
284
  public boolean isSet(int fieldID) {
-
 
285
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
286
  }
-
 
287
 
-
 
288
  @Override
283
  @Override
289
  public boolean equals(Object that) {
284
  public boolean equals(Object that) {
290
    if (that == null)
285
    if (that == null)
291
      return false;
286
      return false;
292
    if (that instanceof Coupon)
287
    if (that instanceof Coupon)
Line 339... Line 334...
339
    }
334
    }
340
 
335
 
341
    int lastComparison = 0;
336
    int lastComparison = 0;
342
    Coupon typedOther = (Coupon)other;
337
    Coupon typedOther = (Coupon)other;
343
 
338
 
344
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(isSetCouponCode());
339
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
345
    if (lastComparison != 0) {
340
    if (lastComparison != 0) {
346
      return lastComparison;
341
      return lastComparison;
347
    }
342
    }
-
 
343
    if (isSetCouponCode()) {
348
    lastComparison = TBaseHelper.compareTo(couponCode, typedOther.couponCode);
344
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
349
    if (lastComparison != 0) {
345
      if (lastComparison != 0) {
350
      return lastComparison;
346
        return lastComparison;
-
 
347
      }
351
    }
348
    }
352
    lastComparison = Boolean.valueOf(isSetPromotion()).compareTo(isSetPromotion());
349
    lastComparison = Boolean.valueOf(isSetPromotion()).compareTo(typedOther.isSetPromotion());
353
    if (lastComparison != 0) {
350
    if (lastComparison != 0) {
354
      return lastComparison;
351
      return lastComparison;
355
    }
352
    }
-
 
353
    if (isSetPromotion()) {
356
    lastComparison = TBaseHelper.compareTo(promotion, typedOther.promotion);
354
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotion, typedOther.promotion);
357
    if (lastComparison != 0) {
355
      if (lastComparison != 0) {
358
      return lastComparison;
356
        return lastComparison;
-
 
357
      }
359
    }
358
    }
360
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(isSetArguments());
359
    lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
361
    if (lastComparison != 0) {
360
    if (lastComparison != 0) {
362
      return lastComparison;
361
      return lastComparison;
363
    }
362
    }
-
 
363
    if (isSetArguments()) {
364
    lastComparison = TBaseHelper.compareTo(arguments, typedOther.arguments);
364
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
365
    if (lastComparison != 0) {
365
      if (lastComparison != 0) {
366
      return lastComparison;
366
        return lastComparison;
-
 
367
      }
367
    }
368
    }
368
    return 0;
369
    return 0;
369
  }
370
  }
370
 
371
 
-
 
372
  public _Fields fieldForId(int fieldId) {
-
 
373
    return _Fields.findByThriftId(fieldId);
-
 
374
  }
-
 
375
 
371
  public void read(TProtocol iprot) throws TException {
376
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
372
    TField field;
377
    org.apache.thrift.protocol.TField field;
373
    iprot.readStructBegin();
378
    iprot.readStructBegin();
374
    while (true)
379
    while (true)
375
    {
380
    {
376
      field = iprot.readFieldBegin();
381
      field = iprot.readFieldBegin();
377
      if (field.type == TType.STOP) { 
382
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
378
        break;
383
        break;
379
      }
384
      }
380
      _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
381
      if (fieldId == null) {
-
 
382
        TProtocolUtil.skip(iprot, field.type);
-
 
383
      } else {
-
 
384
        switch (fieldId) {
385
      switch (field.id) {
385
          case COUPON_CODE:
386
        case 1: // COUPON_CODE
386
            if (field.type == TType.STRING) {
387
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
387
              this.couponCode = iprot.readString();
388
            this.couponCode = iprot.readString();
388
            } else { 
389
          } else { 
389
              TProtocolUtil.skip(iprot, field.type);
390
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
390
            }
391
          }
391
            break;
392
          break;
392
          case PROMOTION:
393
        case 2: // PROMOTION
393
            if (field.type == TType.STRUCT) {
394
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
394
              this.promotion = new Promotion();
395
            this.promotion = new Promotion();
395
              this.promotion.read(iprot);
396
            this.promotion.read(iprot);
396
            } else { 
397
          } else { 
397
              TProtocolUtil.skip(iprot, field.type);
398
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
398
            }
399
          }
399
            break;
400
          break;
400
          case ARGUMENTS:
401
        case 3: // ARGUMENTS
401
            if (field.type == TType.STRING) {
402
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
402
              this.arguments = iprot.readString();
403
            this.arguments = iprot.readString();
403
            } else { 
404
          } else { 
404
              TProtocolUtil.skip(iprot, field.type);
405
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
405
            }
406
          }
406
            break;
407
          break;
407
        }
408
        default:
408
        iprot.readFieldEnd();
409
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
409
      }
410
      }
-
 
411
      iprot.readFieldEnd();
410
    }
412
    }
411
    iprot.readStructEnd();
413
    iprot.readStructEnd();
412
    validate();
414
    validate();
413
  }
415
  }
414
 
416
 
415
  public void write(TProtocol oprot) throws TException {
417
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
416
    validate();
418
    validate();
417
 
419
 
418
    oprot.writeStructBegin(STRUCT_DESC);
420
    oprot.writeStructBegin(STRUCT_DESC);
419
    if (this.couponCode != null) {
421
    if (this.couponCode != null) {
420
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
422
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
Line 465... Line 467...
465
    first = false;
467
    first = false;
466
    sb.append(")");
468
    sb.append(")");
467
    return sb.toString();
469
    return sb.toString();
468
  }
470
  }
469
 
471
 
470
  public void validate() throws TException {
472
  public void validate() throws org.apache.thrift.TException {
471
    // check for required fields
473
    // check for required fields
472
  }
474
  }
473
 
475
 
-
 
476
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-
 
477
    try {
-
 
478
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-
 
479
    } catch (org.apache.thrift.TException te) {
-
 
480
      throw new java.io.IOException(te);
-
 
481
    }
-
 
482
  }
-
 
483
 
-
 
484
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-
 
485
    try {
-
 
486
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-
 
487
    } catch (org.apache.thrift.TException te) {
-
 
488
      throw new java.io.IOException(te);
-
 
489
    }
-
 
490
  }
-
 
491
 
474
}
492
}
475
 
493