Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11592 amit.gupta 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.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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class CartPlus implements org.apache.thrift.TBase<CartPlus, CartPlus._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CartPlus");
25
 
26
  private static final org.apache.thrift.protocol.TField CART_FIELD_DESC = new org.apache.thrift.protocol.TField("cart", org.apache.thrift.protocol.TType.STRUCT, (short)1);
27
  private static final org.apache.thrift.protocol.TField PIN_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("pinCode", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField NEED_INSURANCE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("needInsuranceInfo", org.apache.thrift.protocol.TType.BOOL, (short)3);
29
  private static final org.apache.thrift.protocol.TField VALIDATE_CART_MESSAGES_FIELD_DESC = new org.apache.thrift.protocol.TField("validateCartMessages", org.apache.thrift.protocol.TType.LIST, (short)4);
30
 
31
  private Cart cart; // required
32
  private String pinCode; // required
33
  private boolean needInsuranceInfo; // required
34
  private List<String> validateCartMessages; // required
35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
38
    CART((short)1, "cart"),
39
    PIN_CODE((short)2, "pinCode"),
40
    NEED_INSURANCE_INFO((short)3, "needInsuranceInfo"),
41
    VALIDATE_CART_MESSAGES((short)4, "validateCartMessages");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
55
      switch(fieldId) {
56
        case 1: // CART
57
          return CART;
58
        case 2: // PIN_CODE
59
          return PIN_CODE;
60
        case 3: // NEED_INSURANCE_INFO
61
          return NEED_INSURANCE_INFO;
62
        case 4: // VALIDATE_CART_MESSAGES
63
          return VALIDATE_CART_MESSAGES;
64
        default:
65
          return null;
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __NEEDINSURANCEINFO_ISSET_ID = 0;
105
  private BitSet __isset_bit_vector = new BitSet(1);
106
 
107
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
108
  static {
109
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
110
    tmpMap.put(_Fields.CART, new org.apache.thrift.meta_data.FieldMetaData("cart", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Cart.class)));
112
    tmpMap.put(_Fields.PIN_CODE, new org.apache.thrift.meta_data.FieldMetaData("pinCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
113
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
114
    tmpMap.put(_Fields.NEED_INSURANCE_INFO, new org.apache.thrift.meta_data.FieldMetaData("needInsuranceInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
116
    tmpMap.put(_Fields.VALIDATE_CART_MESSAGES, new org.apache.thrift.meta_data.FieldMetaData("validateCartMessages", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
118
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
119
    metaDataMap = Collections.unmodifiableMap(tmpMap);
120
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CartPlus.class, metaDataMap);
121
  }
122
 
123
  public CartPlus() {
124
  }
125
 
126
  public CartPlus(
127
    Cart cart,
128
    String pinCode,
129
    boolean needInsuranceInfo,
130
    List<String> validateCartMessages)
131
  {
132
    this();
133
    this.cart = cart;
134
    this.pinCode = pinCode;
135
    this.needInsuranceInfo = needInsuranceInfo;
136
    setNeedInsuranceInfoIsSet(true);
137
    this.validateCartMessages = validateCartMessages;
138
  }
139
 
140
  /**
141
   * Performs a deep copy on <i>other</i>.
142
   */
143
  public CartPlus(CartPlus other) {
144
    __isset_bit_vector.clear();
145
    __isset_bit_vector.or(other.__isset_bit_vector);
146
    if (other.isSetCart()) {
147
      this.cart = new Cart(other.cart);
148
    }
149
    if (other.isSetPinCode()) {
150
      this.pinCode = other.pinCode;
151
    }
152
    this.needInsuranceInfo = other.needInsuranceInfo;
153
    if (other.isSetValidateCartMessages()) {
154
      List<String> __this__validateCartMessages = new ArrayList<String>();
155
      for (String other_element : other.validateCartMessages) {
156
        __this__validateCartMessages.add(other_element);
157
      }
158
      this.validateCartMessages = __this__validateCartMessages;
159
    }
160
  }
161
 
162
  public CartPlus deepCopy() {
163
    return new CartPlus(this);
164
  }
165
 
166
  @Override
167
  public void clear() {
168
    this.cart = null;
169
    this.pinCode = null;
170
    setNeedInsuranceInfoIsSet(false);
171
    this.needInsuranceInfo = false;
172
    this.validateCartMessages = null;
173
  }
174
 
175
  public Cart getCart() {
176
    return this.cart;
177
  }
178
 
179
  public void setCart(Cart cart) {
180
    this.cart = cart;
181
  }
182
 
183
  public void unsetCart() {
184
    this.cart = null;
185
  }
186
 
187
  /** Returns true if field cart is set (has been assigned a value) and false otherwise */
188
  public boolean isSetCart() {
189
    return this.cart != null;
190
  }
191
 
192
  public void setCartIsSet(boolean value) {
193
    if (!value) {
194
      this.cart = null;
195
    }
196
  }
197
 
198
  public String getPinCode() {
199
    return this.pinCode;
200
  }
201
 
202
  public void setPinCode(String pinCode) {
203
    this.pinCode = pinCode;
204
  }
205
 
206
  public void unsetPinCode() {
207
    this.pinCode = null;
208
  }
209
 
210
  /** Returns true if field pinCode is set (has been assigned a value) and false otherwise */
211
  public boolean isSetPinCode() {
212
    return this.pinCode != null;
213
  }
214
 
215
  public void setPinCodeIsSet(boolean value) {
216
    if (!value) {
217
      this.pinCode = null;
218
    }
219
  }
220
 
221
  public boolean isNeedInsuranceInfo() {
222
    return this.needInsuranceInfo;
223
  }
224
 
225
  public void setNeedInsuranceInfo(boolean needInsuranceInfo) {
226
    this.needInsuranceInfo = needInsuranceInfo;
227
    setNeedInsuranceInfoIsSet(true);
228
  }
229
 
230
  public void unsetNeedInsuranceInfo() {
231
    __isset_bit_vector.clear(__NEEDINSURANCEINFO_ISSET_ID);
232
  }
233
 
234
  /** Returns true if field needInsuranceInfo is set (has been assigned a value) and false otherwise */
235
  public boolean isSetNeedInsuranceInfo() {
236
    return __isset_bit_vector.get(__NEEDINSURANCEINFO_ISSET_ID);
237
  }
238
 
239
  public void setNeedInsuranceInfoIsSet(boolean value) {
240
    __isset_bit_vector.set(__NEEDINSURANCEINFO_ISSET_ID, value);
241
  }
242
 
243
  public int getValidateCartMessagesSize() {
244
    return (this.validateCartMessages == null) ? 0 : this.validateCartMessages.size();
245
  }
246
 
247
  public java.util.Iterator<String> getValidateCartMessagesIterator() {
248
    return (this.validateCartMessages == null) ? null : this.validateCartMessages.iterator();
249
  }
250
 
251
  public void addToValidateCartMessages(String elem) {
252
    if (this.validateCartMessages == null) {
253
      this.validateCartMessages = new ArrayList<String>();
254
    }
255
    this.validateCartMessages.add(elem);
256
  }
257
 
258
  public List<String> getValidateCartMessages() {
259
    return this.validateCartMessages;
260
  }
261
 
262
  public void setValidateCartMessages(List<String> validateCartMessages) {
263
    this.validateCartMessages = validateCartMessages;
264
  }
265
 
266
  public void unsetValidateCartMessages() {
267
    this.validateCartMessages = null;
268
  }
269
 
270
  /** Returns true if field validateCartMessages is set (has been assigned a value) and false otherwise */
271
  public boolean isSetValidateCartMessages() {
272
    return this.validateCartMessages != null;
273
  }
274
 
275
  public void setValidateCartMessagesIsSet(boolean value) {
276
    if (!value) {
277
      this.validateCartMessages = null;
278
    }
279
  }
280
 
281
  public void setFieldValue(_Fields field, Object value) {
282
    switch (field) {
283
    case CART:
284
      if (value == null) {
285
        unsetCart();
286
      } else {
287
        setCart((Cart)value);
288
      }
289
      break;
290
 
291
    case PIN_CODE:
292
      if (value == null) {
293
        unsetPinCode();
294
      } else {
295
        setPinCode((String)value);
296
      }
297
      break;
298
 
299
    case NEED_INSURANCE_INFO:
300
      if (value == null) {
301
        unsetNeedInsuranceInfo();
302
      } else {
303
        setNeedInsuranceInfo((Boolean)value);
304
      }
305
      break;
306
 
307
    case VALIDATE_CART_MESSAGES:
308
      if (value == null) {
309
        unsetValidateCartMessages();
310
      } else {
311
        setValidateCartMessages((List<String>)value);
312
      }
313
      break;
314
 
315
    }
316
  }
317
 
318
  public Object getFieldValue(_Fields field) {
319
    switch (field) {
320
    case CART:
321
      return getCart();
322
 
323
    case PIN_CODE:
324
      return getPinCode();
325
 
326
    case NEED_INSURANCE_INFO:
327
      return Boolean.valueOf(isNeedInsuranceInfo());
328
 
329
    case VALIDATE_CART_MESSAGES:
330
      return getValidateCartMessages();
331
 
332
    }
333
    throw new IllegalStateException();
334
  }
335
 
336
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
337
  public boolean isSet(_Fields field) {
338
    if (field == null) {
339
      throw new IllegalArgumentException();
340
    }
341
 
342
    switch (field) {
343
    case CART:
344
      return isSetCart();
345
    case PIN_CODE:
346
      return isSetPinCode();
347
    case NEED_INSURANCE_INFO:
348
      return isSetNeedInsuranceInfo();
349
    case VALIDATE_CART_MESSAGES:
350
      return isSetValidateCartMessages();
351
    }
352
    throw new IllegalStateException();
353
  }
354
 
355
  @Override
356
  public boolean equals(Object that) {
357
    if (that == null)
358
      return false;
359
    if (that instanceof CartPlus)
360
      return this.equals((CartPlus)that);
361
    return false;
362
  }
363
 
364
  public boolean equals(CartPlus that) {
365
    if (that == null)
366
      return false;
367
 
368
    boolean this_present_cart = true && this.isSetCart();
369
    boolean that_present_cart = true && that.isSetCart();
370
    if (this_present_cart || that_present_cart) {
371
      if (!(this_present_cart && that_present_cart))
372
        return false;
373
      if (!this.cart.equals(that.cart))
374
        return false;
375
    }
376
 
377
    boolean this_present_pinCode = true && this.isSetPinCode();
378
    boolean that_present_pinCode = true && that.isSetPinCode();
379
    if (this_present_pinCode || that_present_pinCode) {
380
      if (!(this_present_pinCode && that_present_pinCode))
381
        return false;
382
      if (!this.pinCode.equals(that.pinCode))
383
        return false;
384
    }
385
 
386
    boolean this_present_needInsuranceInfo = true;
387
    boolean that_present_needInsuranceInfo = true;
388
    if (this_present_needInsuranceInfo || that_present_needInsuranceInfo) {
389
      if (!(this_present_needInsuranceInfo && that_present_needInsuranceInfo))
390
        return false;
391
      if (this.needInsuranceInfo != that.needInsuranceInfo)
392
        return false;
393
    }
394
 
395
    boolean this_present_validateCartMessages = true && this.isSetValidateCartMessages();
396
    boolean that_present_validateCartMessages = true && that.isSetValidateCartMessages();
397
    if (this_present_validateCartMessages || that_present_validateCartMessages) {
398
      if (!(this_present_validateCartMessages && that_present_validateCartMessages))
399
        return false;
400
      if (!this.validateCartMessages.equals(that.validateCartMessages))
401
        return false;
402
    }
403
 
404
    return true;
405
  }
406
 
407
  @Override
408
  public int hashCode() {
409
    return 0;
410
  }
411
 
412
  public int compareTo(CartPlus other) {
413
    if (!getClass().equals(other.getClass())) {
414
      return getClass().getName().compareTo(other.getClass().getName());
415
    }
416
 
417
    int lastComparison = 0;
418
    CartPlus typedOther = (CartPlus)other;
419
 
420
    lastComparison = Boolean.valueOf(isSetCart()).compareTo(typedOther.isSetCart());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetCart()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cart, typedOther.cart);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
430
    lastComparison = Boolean.valueOf(isSetPinCode()).compareTo(typedOther.isSetPinCode());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetPinCode()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pinCode, typedOther.pinCode);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
439
    }
440
    lastComparison = Boolean.valueOf(isSetNeedInsuranceInfo()).compareTo(typedOther.isSetNeedInsuranceInfo());
441
    if (lastComparison != 0) {
442
      return lastComparison;
443
    }
444
    if (isSetNeedInsuranceInfo()) {
445
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.needInsuranceInfo, typedOther.needInsuranceInfo);
446
      if (lastComparison != 0) {
447
        return lastComparison;
448
      }
449
    }
450
    lastComparison = Boolean.valueOf(isSetValidateCartMessages()).compareTo(typedOther.isSetValidateCartMessages());
451
    if (lastComparison != 0) {
452
      return lastComparison;
453
    }
454
    if (isSetValidateCartMessages()) {
455
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validateCartMessages, typedOther.validateCartMessages);
456
      if (lastComparison != 0) {
457
        return lastComparison;
458
      }
459
    }
460
    return 0;
461
  }
462
 
463
  public _Fields fieldForId(int fieldId) {
464
    return _Fields.findByThriftId(fieldId);
465
  }
466
 
467
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
468
    org.apache.thrift.protocol.TField field;
469
    iprot.readStructBegin();
470
    while (true)
471
    {
472
      field = iprot.readFieldBegin();
473
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
474
        break;
475
      }
476
      switch (field.id) {
477
        case 1: // CART
478
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
479
            this.cart = new Cart();
480
            this.cart.read(iprot);
481
          } else { 
482
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
483
          }
484
          break;
485
        case 2: // PIN_CODE
486
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
487
            this.pinCode = iprot.readString();
488
          } else { 
489
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
490
          }
491
          break;
492
        case 3: // NEED_INSURANCE_INFO
493
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
494
            this.needInsuranceInfo = iprot.readBool();
495
            setNeedInsuranceInfoIsSet(true);
496
          } else { 
497
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
498
          }
499
          break;
500
        case 4: // VALIDATE_CART_MESSAGES
501
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
502
            {
503
              org.apache.thrift.protocol.TList _list12 = iprot.readListBegin();
504
              this.validateCartMessages = new ArrayList<String>(_list12.size);
505
              for (int _i13 = 0; _i13 < _list12.size; ++_i13)
506
              {
507
                String _elem14; // required
508
                _elem14 = iprot.readString();
509
                this.validateCartMessages.add(_elem14);
510
              }
511
              iprot.readListEnd();
512
            }
513
          } else { 
514
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
515
          }
516
          break;
517
        default:
518
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
519
      }
520
      iprot.readFieldEnd();
521
    }
522
    iprot.readStructEnd();
523
    validate();
524
  }
525
 
526
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
527
    validate();
528
 
529
    oprot.writeStructBegin(STRUCT_DESC);
530
    if (this.cart != null) {
531
      oprot.writeFieldBegin(CART_FIELD_DESC);
532
      this.cart.write(oprot);
533
      oprot.writeFieldEnd();
534
    }
535
    if (this.pinCode != null) {
536
      oprot.writeFieldBegin(PIN_CODE_FIELD_DESC);
537
      oprot.writeString(this.pinCode);
538
      oprot.writeFieldEnd();
539
    }
540
    oprot.writeFieldBegin(NEED_INSURANCE_INFO_FIELD_DESC);
541
    oprot.writeBool(this.needInsuranceInfo);
542
    oprot.writeFieldEnd();
543
    if (this.validateCartMessages != null) {
544
      oprot.writeFieldBegin(VALIDATE_CART_MESSAGES_FIELD_DESC);
545
      {
546
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.validateCartMessages.size()));
547
        for (String _iter15 : this.validateCartMessages)
548
        {
549
          oprot.writeString(_iter15);
550
        }
551
        oprot.writeListEnd();
552
      }
553
      oprot.writeFieldEnd();
554
    }
555
    oprot.writeFieldStop();
556
    oprot.writeStructEnd();
557
  }
558
 
559
  @Override
560
  public String toString() {
561
    StringBuilder sb = new StringBuilder("CartPlus(");
562
    boolean first = true;
563
 
564
    sb.append("cart:");
565
    if (this.cart == null) {
566
      sb.append("null");
567
    } else {
568
      sb.append(this.cart);
569
    }
570
    first = false;
571
    if (!first) sb.append(", ");
572
    sb.append("pinCode:");
573
    if (this.pinCode == null) {
574
      sb.append("null");
575
    } else {
576
      sb.append(this.pinCode);
577
    }
578
    first = false;
579
    if (!first) sb.append(", ");
580
    sb.append("needInsuranceInfo:");
581
    sb.append(this.needInsuranceInfo);
582
    first = false;
583
    if (!first) sb.append(", ");
584
    sb.append("validateCartMessages:");
585
    if (this.validateCartMessages == null) {
586
      sb.append("null");
587
    } else {
588
      sb.append(this.validateCartMessages);
589
    }
590
    first = false;
591
    sb.append(")");
592
    return sb.toString();
593
  }
594
 
595
  public void validate() throws org.apache.thrift.TException {
596
    // check for required fields
597
  }
598
 
599
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
600
    try {
601
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
602
    } catch (org.apache.thrift.TException te) {
603
      throw new java.io.IOException(te);
604
    }
605
  }
606
 
607
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
608
    try {
609
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
610
      __isset_bit_vector = new BitSet(1);
611
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
612
    } catch (org.apache.thrift.TException te) {
613
      throw new java.io.IOException(te);
614
    }
615
  }
616
 
617
}
618