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 GstRate implements org.apache.thrift.TBase<GstRate, GstRate._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GstRate");
25
 
26
  private static final org.apache.thrift.protocol.TField SGST_RATE_FIELD_DESC = new org.apache.thrift.protocol.TField("sgstRate", org.apache.thrift.protocol.TType.DOUBLE, (short)1);
27
  private static final org.apache.thrift.protocol.TField CGST_RATE_FIELD_DESC = new org.apache.thrift.protocol.TField("cgstRate", org.apache.thrift.protocol.TType.DOUBLE, (short)2);
28
  private static final org.apache.thrift.protocol.TField IGST_RATE_FIELD_DESC = new org.apache.thrift.protocol.TField("igstRate", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
29
  private static final org.apache.thrift.protocol.TField HSN_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("hsnCode", org.apache.thrift.protocol.TType.STRING, (short)4);
30
 
31
  private double sgstRate; // required
32
  private double cgstRate; // required
33
  private double igstRate; // required
34
  private String hsnCode; // 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
    SGST_RATE((short)1, "sgstRate"),
39
    CGST_RATE((short)2, "cgstRate"),
40
    IGST_RATE((short)3, "igstRate"),
41
    HSN_CODE((short)4, "hsnCode");
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: // SGST_RATE
57
          return SGST_RATE;
58
        case 2: // CGST_RATE
59
          return CGST_RATE;
60
        case 3: // IGST_RATE
61
          return IGST_RATE;
62
        case 4: // HSN_CODE
63
          return HSN_CODE;
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 __SGSTRATE_ISSET_ID = 0;
105
  private static final int __CGSTRATE_ISSET_ID = 1;
106
  private static final int __IGSTRATE_ISSET_ID = 2;
107
  private BitSet __isset_bit_vector = new BitSet(3);
108
 
109
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
110
  static {
111
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
112
    tmpMap.put(_Fields.SGST_RATE, new org.apache.thrift.meta_data.FieldMetaData("sgstRate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
113
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
114
    tmpMap.put(_Fields.CGST_RATE, new org.apache.thrift.meta_data.FieldMetaData("cgstRate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
116
    tmpMap.put(_Fields.IGST_RATE, new org.apache.thrift.meta_data.FieldMetaData("igstRate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
118
    tmpMap.put(_Fields.HSN_CODE, new org.apache.thrift.meta_data.FieldMetaData("hsnCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
119
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
120
    metaDataMap = Collections.unmodifiableMap(tmpMap);
121
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GstRate.class, metaDataMap);
122
  }
123
 
124
  public GstRate() {
125
  }
126
 
127
  public GstRate(
128
    double sgstRate,
129
    double cgstRate,
130
    double igstRate,
131
    String hsnCode)
132
  {
133
    this();
134
    this.sgstRate = sgstRate;
135
    setSgstRateIsSet(true);
136
    this.cgstRate = cgstRate;
137
    setCgstRateIsSet(true);
138
    this.igstRate = igstRate;
139
    setIgstRateIsSet(true);
140
    this.hsnCode = hsnCode;
141
  }
142
 
143
  /**
144
   * Performs a deep copy on <i>other</i>.
145
   */
146
  public GstRate(GstRate other) {
147
    __isset_bit_vector.clear();
148
    __isset_bit_vector.or(other.__isset_bit_vector);
149
    this.sgstRate = other.sgstRate;
150
    this.cgstRate = other.cgstRate;
151
    this.igstRate = other.igstRate;
152
    if (other.isSetHsnCode()) {
153
      this.hsnCode = other.hsnCode;
154
    }
155
  }
156
 
157
  public GstRate deepCopy() {
158
    return new GstRate(this);
159
  }
160
 
161
  @Override
162
  public void clear() {
163
    setSgstRateIsSet(false);
164
    this.sgstRate = 0.0;
165
    setCgstRateIsSet(false);
166
    this.cgstRate = 0.0;
167
    setIgstRateIsSet(false);
168
    this.igstRate = 0.0;
169
    this.hsnCode = null;
170
  }
171
 
172
  public double getSgstRate() {
173
    return this.sgstRate;
174
  }
175
 
176
  public void setSgstRate(double sgstRate) {
177
    this.sgstRate = sgstRate;
178
    setSgstRateIsSet(true);
179
  }
180
 
181
  public void unsetSgstRate() {
182
    __isset_bit_vector.clear(__SGSTRATE_ISSET_ID);
183
  }
184
 
185
  /** Returns true if field sgstRate is set (has been assigned a value) and false otherwise */
186
  public boolean isSetSgstRate() {
187
    return __isset_bit_vector.get(__SGSTRATE_ISSET_ID);
188
  }
189
 
190
  public void setSgstRateIsSet(boolean value) {
191
    __isset_bit_vector.set(__SGSTRATE_ISSET_ID, value);
192
  }
193
 
194
  public double getCgstRate() {
195
    return this.cgstRate;
196
  }
197
 
198
  public void setCgstRate(double cgstRate) {
199
    this.cgstRate = cgstRate;
200
    setCgstRateIsSet(true);
201
  }
202
 
203
  public void unsetCgstRate() {
204
    __isset_bit_vector.clear(__CGSTRATE_ISSET_ID);
205
  }
206
 
207
  /** Returns true if field cgstRate is set (has been assigned a value) and false otherwise */
208
  public boolean isSetCgstRate() {
209
    return __isset_bit_vector.get(__CGSTRATE_ISSET_ID);
210
  }
211
 
212
  public void setCgstRateIsSet(boolean value) {
213
    __isset_bit_vector.set(__CGSTRATE_ISSET_ID, value);
214
  }
215
 
216
  public double getIgstRate() {
217
    return this.igstRate;
218
  }
219
 
220
  public void setIgstRate(double igstRate) {
221
    this.igstRate = igstRate;
222
    setIgstRateIsSet(true);
223
  }
224
 
225
  public void unsetIgstRate() {
226
    __isset_bit_vector.clear(__IGSTRATE_ISSET_ID);
227
  }
228
 
229
  /** Returns true if field igstRate is set (has been assigned a value) and false otherwise */
230
  public boolean isSetIgstRate() {
231
    return __isset_bit_vector.get(__IGSTRATE_ISSET_ID);
232
  }
233
 
234
  public void setIgstRateIsSet(boolean value) {
235
    __isset_bit_vector.set(__IGSTRATE_ISSET_ID, value);
236
  }
237
 
238
  public String getHsnCode() {
239
    return this.hsnCode;
240
  }
241
 
242
  public void setHsnCode(String hsnCode) {
243
    this.hsnCode = hsnCode;
244
  }
245
 
246
  public void unsetHsnCode() {
247
    this.hsnCode = null;
248
  }
249
 
250
  /** Returns true if field hsnCode is set (has been assigned a value) and false otherwise */
251
  public boolean isSetHsnCode() {
252
    return this.hsnCode != null;
253
  }
254
 
255
  public void setHsnCodeIsSet(boolean value) {
256
    if (!value) {
257
      this.hsnCode = null;
258
    }
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case SGST_RATE:
264
      if (value == null) {
265
        unsetSgstRate();
266
      } else {
267
        setSgstRate((Double)value);
268
      }
269
      break;
270
 
271
    case CGST_RATE:
272
      if (value == null) {
273
        unsetCgstRate();
274
      } else {
275
        setCgstRate((Double)value);
276
      }
277
      break;
278
 
279
    case IGST_RATE:
280
      if (value == null) {
281
        unsetIgstRate();
282
      } else {
283
        setIgstRate((Double)value);
284
      }
285
      break;
286
 
287
    case HSN_CODE:
288
      if (value == null) {
289
        unsetHsnCode();
290
      } else {
291
        setHsnCode((String)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case SGST_RATE:
301
      return Double.valueOf(getSgstRate());
302
 
303
    case CGST_RATE:
304
      return Double.valueOf(getCgstRate());
305
 
306
    case IGST_RATE:
307
      return Double.valueOf(getIgstRate());
308
 
309
    case HSN_CODE:
310
      return getHsnCode();
311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
321
 
322
    switch (field) {
323
    case SGST_RATE:
324
      return isSetSgstRate();
325
    case CGST_RATE:
326
      return isSetCgstRate();
327
    case IGST_RATE:
328
      return isSetIgstRate();
329
    case HSN_CODE:
330
      return isSetHsnCode();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof GstRate)
340
      return this.equals((GstRate)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(GstRate that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_sgstRate = true;
349
    boolean that_present_sgstRate = true;
350
    if (this_present_sgstRate || that_present_sgstRate) {
351
      if (!(this_present_sgstRate && that_present_sgstRate))
352
        return false;
353
      if (this.sgstRate != that.sgstRate)
354
        return false;
355
    }
356
 
357
    boolean this_present_cgstRate = true;
358
    boolean that_present_cgstRate = true;
359
    if (this_present_cgstRate || that_present_cgstRate) {
360
      if (!(this_present_cgstRate && that_present_cgstRate))
361
        return false;
362
      if (this.cgstRate != that.cgstRate)
363
        return false;
364
    }
365
 
366
    boolean this_present_igstRate = true;
367
    boolean that_present_igstRate = true;
368
    if (this_present_igstRate || that_present_igstRate) {
369
      if (!(this_present_igstRate && that_present_igstRate))
370
        return false;
371
      if (this.igstRate != that.igstRate)
372
        return false;
373
    }
374
 
375
    boolean this_present_hsnCode = true && this.isSetHsnCode();
376
    boolean that_present_hsnCode = true && that.isSetHsnCode();
377
    if (this_present_hsnCode || that_present_hsnCode) {
378
      if (!(this_present_hsnCode && that_present_hsnCode))
379
        return false;
380
      if (!this.hsnCode.equals(that.hsnCode))
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(GstRate other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    GstRate typedOther = (GstRate)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetSgstRate()).compareTo(typedOther.isSetSgstRate());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    if (isSetSgstRate()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sgstRate, typedOther.sgstRate);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
409
    }
410
    lastComparison = Boolean.valueOf(isSetCgstRate()).compareTo(typedOther.isSetCgstRate());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    if (isSetCgstRate()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cgstRate, typedOther.cgstRate);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
419
    }
420
    lastComparison = Boolean.valueOf(isSetIgstRate()).compareTo(typedOther.isSetIgstRate());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetIgstRate()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.igstRate, typedOther.igstRate);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
430
    lastComparison = Boolean.valueOf(isSetHsnCode()).compareTo(typedOther.isSetHsnCode());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetHsnCode()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hsnCode, typedOther.hsnCode);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
439
    }
440
    return 0;
441
  }
442
 
443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
454
        break;
455
      }
456
      switch (field.id) {
457
        case 1: // SGST_RATE
458
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
459
            this.sgstRate = iprot.readDouble();
460
            setSgstRateIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // CGST_RATE
466
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
467
            this.cgstRate = iprot.readDouble();
468
            setCgstRateIsSet(true);
469
          } else { 
470
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
471
          }
472
          break;
473
        case 3: // IGST_RATE
474
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
475
            this.igstRate = iprot.readDouble();
476
            setIgstRateIsSet(true);
477
          } else { 
478
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
479
          }
480
          break;
481
        case 4: // HSN_CODE
482
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
483
            this.hsnCode = iprot.readString();
484
          } else { 
485
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
486
          }
487
          break;
488
        default:
489
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
490
      }
491
      iprot.readFieldEnd();
492
    }
493
    iprot.readStructEnd();
494
    validate();
495
  }
496
 
497
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
498
    validate();
499
 
500
    oprot.writeStructBegin(STRUCT_DESC);
501
    oprot.writeFieldBegin(SGST_RATE_FIELD_DESC);
502
    oprot.writeDouble(this.sgstRate);
503
    oprot.writeFieldEnd();
504
    oprot.writeFieldBegin(CGST_RATE_FIELD_DESC);
505
    oprot.writeDouble(this.cgstRate);
506
    oprot.writeFieldEnd();
507
    oprot.writeFieldBegin(IGST_RATE_FIELD_DESC);
508
    oprot.writeDouble(this.igstRate);
509
    oprot.writeFieldEnd();
510
    if (this.hsnCode != null) {
511
      oprot.writeFieldBegin(HSN_CODE_FIELD_DESC);
512
      oprot.writeString(this.hsnCode);
513
      oprot.writeFieldEnd();
514
    }
515
    oprot.writeFieldStop();
516
    oprot.writeStructEnd();
517
  }
518
 
519
  @Override
520
  public String toString() {
521
    StringBuilder sb = new StringBuilder("GstRate(");
522
    boolean first = true;
523
 
524
    sb.append("sgstRate:");
525
    sb.append(this.sgstRate);
526
    first = false;
527
    if (!first) sb.append(", ");
528
    sb.append("cgstRate:");
529
    sb.append(this.cgstRate);
530
    first = false;
531
    if (!first) sb.append(", ");
532
    sb.append("igstRate:");
533
    sb.append(this.igstRate);
534
    first = false;
535
    if (!first) sb.append(", ");
536
    sb.append("hsnCode:");
537
    if (this.hsnCode == null) {
538
      sb.append("null");
539
    } else {
540
      sb.append(this.hsnCode);
541
    }
542
    first = false;
543
    sb.append(")");
544
    return sb.toString();
545
  }
546
 
547
  public void validate() throws org.apache.thrift.TException {
548
    // check for required fields
549
  }
550
 
551
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
552
    try {
553
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
554
    } catch (org.apache.thrift.TException te) {
555
      throw new java.io.IOException(te);
556
    }
557
  }
558
 
559
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
560
    try {
561
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
562
      __isset_bit_vector = new BitSet(1);
563
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
564
    } catch (org.apache.thrift.TException te) {
565
      throw new java.io.IOException(te);
566
    }
567
  }
568
 
569
}
570