Subversion Repositories SmartDukaan

Rev

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