Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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