Subversion Repositories SmartDukaan

Rev

Rev 12280 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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