Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21838 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.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 StateGstRates implements org.apache.thrift.TBase<StateGstRates, StateGstRates._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("StateGstRates");
25
 
26
  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)1);
27
  private static final org.apache.thrift.protocol.TField GST_RATES_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("gstRatesMap", org.apache.thrift.protocol.TType.MAP, (short)2);
28
 
29
  private String stateCode; // required
30
  private Map<String,GstRate> gstRatesMap; // required
31
 
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
34
    STATE_CODE((short)1, "stateCode"),
35
    GST_RATES_MAP((short)2, "gstRatesMap");
36
 
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
38
 
39
    static {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
41
        byName.put(field.getFieldName(), field);
42
      }
43
    }
44
 
45
    /**
46
     * Find the _Fields constant that matches fieldId, or null if its not found.
47
     */
48
    public static _Fields findByThriftId(int fieldId) {
49
      switch(fieldId) {
50
        case 1: // STATE_CODE
51
          return STATE_CODE;
52
        case 2: // GST_RATES_MAP
53
          return GST_RATES_MAP;
54
        default:
55
          return null;
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, throwing an exception
61
     * if it is not found.
62
     */
63
    public static _Fields findByThriftIdOrThrow(int fieldId) {
64
      _Fields fields = findByThriftId(fieldId);
65
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
66
      return fields;
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches name, or null if its not found.
71
     */
72
    public static _Fields findByName(String name) {
73
      return byName.get(name);
74
    }
75
 
76
    private final short _thriftId;
77
    private final String _fieldName;
78
 
79
    _Fields(short thriftId, String fieldName) {
80
      _thriftId = thriftId;
81
      _fieldName = fieldName;
82
    }
83
 
84
    public short getThriftFieldId() {
85
      return _thriftId;
86
    }
87
 
88
    public String getFieldName() {
89
      return _fieldName;
90
    }
91
  }
92
 
93
  // isset id assignments
94
 
95
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
96
  static {
97
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
98
    tmpMap.put(_Fields.STATE_CODE, new org.apache.thrift.meta_data.FieldMetaData("stateCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
99
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
100
    tmpMap.put(_Fields.GST_RATES_MAP, new org.apache.thrift.meta_data.FieldMetaData("gstRatesMap", org.apache.thrift.TFieldRequirementType.DEFAULT, 
101
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
102
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
103
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GstRate.class))));
104
    metaDataMap = Collections.unmodifiableMap(tmpMap);
105
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StateGstRates.class, metaDataMap);
106
  }
107
 
108
  public StateGstRates() {
109
  }
110
 
111
  public StateGstRates(
112
    String stateCode,
113
    Map<String,GstRate> gstRatesMap)
114
  {
115
    this();
116
    this.stateCode = stateCode;
117
    this.gstRatesMap = gstRatesMap;
118
  }
119
 
120
  /**
121
   * Performs a deep copy on <i>other</i>.
122
   */
123
  public StateGstRates(StateGstRates other) {
124
    if (other.isSetStateCode()) {
125
      this.stateCode = other.stateCode;
126
    }
127
    if (other.isSetGstRatesMap()) {
128
      Map<String,GstRate> __this__gstRatesMap = new HashMap<String,GstRate>();
129
      for (Map.Entry<String, GstRate> other_element : other.gstRatesMap.entrySet()) {
130
 
131
        String other_element_key = other_element.getKey();
132
        GstRate other_element_value = other_element.getValue();
133
 
134
        String __this__gstRatesMap_copy_key = other_element_key;
135
 
136
        GstRate __this__gstRatesMap_copy_value = new GstRate(other_element_value);
137
 
138
        __this__gstRatesMap.put(__this__gstRatesMap_copy_key, __this__gstRatesMap_copy_value);
139
      }
140
      this.gstRatesMap = __this__gstRatesMap;
141
    }
142
  }
143
 
144
  public StateGstRates deepCopy() {
145
    return new StateGstRates(this);
146
  }
147
 
148
  @Override
149
  public void clear() {
150
    this.stateCode = null;
151
    this.gstRatesMap = null;
152
  }
153
 
154
  public String getStateCode() {
155
    return this.stateCode;
156
  }
157
 
158
  public void setStateCode(String stateCode) {
159
    this.stateCode = stateCode;
160
  }
161
 
162
  public void unsetStateCode() {
163
    this.stateCode = null;
164
  }
165
 
166
  /** Returns true if field stateCode is set (has been assigned a value) and false otherwise */
167
  public boolean isSetStateCode() {
168
    return this.stateCode != null;
169
  }
170
 
171
  public void setStateCodeIsSet(boolean value) {
172
    if (!value) {
173
      this.stateCode = null;
174
    }
175
  }
176
 
177
  public int getGstRatesMapSize() {
178
    return (this.gstRatesMap == null) ? 0 : this.gstRatesMap.size();
179
  }
180
 
181
  public void putToGstRatesMap(String key, GstRate val) {
182
    if (this.gstRatesMap == null) {
183
      this.gstRatesMap = new HashMap<String,GstRate>();
184
    }
185
    this.gstRatesMap.put(key, val);
186
  }
187
 
188
  public Map<String,GstRate> getGstRatesMap() {
189
    return this.gstRatesMap;
190
  }
191
 
192
  public void setGstRatesMap(Map<String,GstRate> gstRatesMap) {
193
    this.gstRatesMap = gstRatesMap;
194
  }
195
 
196
  public void unsetGstRatesMap() {
197
    this.gstRatesMap = null;
198
  }
199
 
200
  /** Returns true if field gstRatesMap is set (has been assigned a value) and false otherwise */
201
  public boolean isSetGstRatesMap() {
202
    return this.gstRatesMap != null;
203
  }
204
 
205
  public void setGstRatesMapIsSet(boolean value) {
206
    if (!value) {
207
      this.gstRatesMap = null;
208
    }
209
  }
210
 
211
  public void setFieldValue(_Fields field, Object value) {
212
    switch (field) {
213
    case STATE_CODE:
214
      if (value == null) {
215
        unsetStateCode();
216
      } else {
217
        setStateCode((String)value);
218
      }
219
      break;
220
 
221
    case GST_RATES_MAP:
222
      if (value == null) {
223
        unsetGstRatesMap();
224
      } else {
225
        setGstRatesMap((Map<String,GstRate>)value);
226
      }
227
      break;
228
 
229
    }
230
  }
231
 
232
  public Object getFieldValue(_Fields field) {
233
    switch (field) {
234
    case STATE_CODE:
235
      return getStateCode();
236
 
237
    case GST_RATES_MAP:
238
      return getGstRatesMap();
239
 
240
    }
241
    throw new IllegalStateException();
242
  }
243
 
244
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
245
  public boolean isSet(_Fields field) {
246
    if (field == null) {
247
      throw new IllegalArgumentException();
248
    }
249
 
250
    switch (field) {
251
    case STATE_CODE:
252
      return isSetStateCode();
253
    case GST_RATES_MAP:
254
      return isSetGstRatesMap();
255
    }
256
    throw new IllegalStateException();
257
  }
258
 
259
  @Override
260
  public boolean equals(Object that) {
261
    if (that == null)
262
      return false;
263
    if (that instanceof StateGstRates)
264
      return this.equals((StateGstRates)that);
265
    return false;
266
  }
267
 
268
  public boolean equals(StateGstRates that) {
269
    if (that == null)
270
      return false;
271
 
272
    boolean this_present_stateCode = true && this.isSetStateCode();
273
    boolean that_present_stateCode = true && that.isSetStateCode();
274
    if (this_present_stateCode || that_present_stateCode) {
275
      if (!(this_present_stateCode && that_present_stateCode))
276
        return false;
277
      if (!this.stateCode.equals(that.stateCode))
278
        return false;
279
    }
280
 
281
    boolean this_present_gstRatesMap = true && this.isSetGstRatesMap();
282
    boolean that_present_gstRatesMap = true && that.isSetGstRatesMap();
283
    if (this_present_gstRatesMap || that_present_gstRatesMap) {
284
      if (!(this_present_gstRatesMap && that_present_gstRatesMap))
285
        return false;
286
      if (!this.gstRatesMap.equals(that.gstRatesMap))
287
        return false;
288
    }
289
 
290
    return true;
291
  }
292
 
293
  @Override
294
  public int hashCode() {
295
    return 0;
296
  }
297
 
298
  public int compareTo(StateGstRates other) {
299
    if (!getClass().equals(other.getClass())) {
300
      return getClass().getName().compareTo(other.getClass().getName());
301
    }
302
 
303
    int lastComparison = 0;
304
    StateGstRates typedOther = (StateGstRates)other;
305
 
306
    lastComparison = Boolean.valueOf(isSetStateCode()).compareTo(typedOther.isSetStateCode());
307
    if (lastComparison != 0) {
308
      return lastComparison;
309
    }
310
    if (isSetStateCode()) {
311
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateCode, typedOther.stateCode);
312
      if (lastComparison != 0) {
313
        return lastComparison;
314
      }
315
    }
316
    lastComparison = Boolean.valueOf(isSetGstRatesMap()).compareTo(typedOther.isSetGstRatesMap());
317
    if (lastComparison != 0) {
318
      return lastComparison;
319
    }
320
    if (isSetGstRatesMap()) {
321
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gstRatesMap, typedOther.gstRatesMap);
322
      if (lastComparison != 0) {
323
        return lastComparison;
324
      }
325
    }
326
    return 0;
327
  }
328
 
329
  public _Fields fieldForId(int fieldId) {
330
    return _Fields.findByThriftId(fieldId);
331
  }
332
 
333
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
334
    org.apache.thrift.protocol.TField field;
335
    iprot.readStructBegin();
336
    while (true)
337
    {
338
      field = iprot.readFieldBegin();
339
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
340
        break;
341
      }
342
      switch (field.id) {
343
        case 1: // STATE_CODE
344
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
345
            this.stateCode = iprot.readString();
346
          } else { 
347
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
348
          }
349
          break;
350
        case 2: // GST_RATES_MAP
351
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
352
            {
353
              org.apache.thrift.protocol.TMap _map17 = iprot.readMapBegin();
354
              this.gstRatesMap = new HashMap<String,GstRate>(2*_map17.size);
355
              for (int _i18 = 0; _i18 < _map17.size; ++_i18)
356
              {
357
                String _key19; // required
358
                GstRate _val20; // required
359
                _key19 = iprot.readString();
360
                _val20 = new GstRate();
361
                _val20.read(iprot);
362
                this.gstRatesMap.put(_key19, _val20);
363
              }
364
              iprot.readMapEnd();
365
            }
366
          } else { 
367
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
368
          }
369
          break;
370
        default:
371
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
372
      }
373
      iprot.readFieldEnd();
374
    }
375
    iprot.readStructEnd();
376
    validate();
377
  }
378
 
379
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
380
    validate();
381
 
382
    oprot.writeStructBegin(STRUCT_DESC);
383
    if (this.stateCode != null) {
384
      oprot.writeFieldBegin(STATE_CODE_FIELD_DESC);
385
      oprot.writeString(this.stateCode);
386
      oprot.writeFieldEnd();
387
    }
388
    if (this.gstRatesMap != null) {
389
      oprot.writeFieldBegin(GST_RATES_MAP_FIELD_DESC);
390
      {
391
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, this.gstRatesMap.size()));
392
        for (Map.Entry<String, GstRate> _iter21 : this.gstRatesMap.entrySet())
393
        {
394
          oprot.writeString(_iter21.getKey());
395
          _iter21.getValue().write(oprot);
396
        }
397
        oprot.writeMapEnd();
398
      }
399
      oprot.writeFieldEnd();
400
    }
401
    oprot.writeFieldStop();
402
    oprot.writeStructEnd();
403
  }
404
 
405
  @Override
406
  public String toString() {
407
    StringBuilder sb = new StringBuilder("StateGstRates(");
408
    boolean first = true;
409
 
410
    sb.append("stateCode:");
411
    if (this.stateCode == null) {
412
      sb.append("null");
413
    } else {
414
      sb.append(this.stateCode);
415
    }
416
    first = false;
417
    if (!first) sb.append(", ");
418
    sb.append("gstRatesMap:");
419
    if (this.gstRatesMap == null) {
420
      sb.append("null");
421
    } else {
422
      sb.append(this.gstRatesMap);
423
    }
424
    first = false;
425
    sb.append(")");
426
    return sb.toString();
427
  }
428
 
429
  public void validate() throws org.apache.thrift.TException {
430
    // check for required fields
431
  }
432
 
433
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
434
    try {
435
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
436
    } catch (org.apache.thrift.TException te) {
437
      throw new java.io.IOException(te);
438
    }
439
  }
440
 
441
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
442
    try {
443
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
444
    } catch (org.apache.thrift.TException te) {
445
      throw new java.io.IOException(te);
446
    }
447
  }
448
 
449
}
450