Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
6805 anupam.sin 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 ItemInsurerMapping implements org.apache.thrift.TBase<ItemInsurerMapping, ItemInsurerMapping._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemInsurerMapping");
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 INSURER_FIELD_DESC = new org.apache.thrift.protocol.TField("insurer", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField PREMIUM_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("premiumType", org.apache.thrift.protocol.TType.I32, (short)3);
29
  private static final org.apache.thrift.protocol.TField PREMIUM_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("premiumValue", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
30
 
31
  private long itemId; // required
32
  private long insurer; // required
33
  private PremiumType premiumType; // required
34
  private double premiumValue; // 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
    ITEM_ID((short)1, "itemId"),
39
    INSURER((short)2, "insurer"),
40
    /**
41
     * 
42
     * @see PremiumType
43
     */
44
    PREMIUM_TYPE((short)3, "premiumType"),
45
    PREMIUM_VALUE((short)4, "premiumValue");
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: // ITEM_ID
61
          return ITEM_ID;
62
        case 2: // INSURER
63
          return INSURER;
64
        case 3: // PREMIUM_TYPE
65
          return PREMIUM_TYPE;
66
        case 4: // PREMIUM_VALUE
67
          return PREMIUM_VALUE;
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 __ITEMID_ISSET_ID = 0;
109
  private static final int __INSURER_ISSET_ID = 1;
110
  private static final int __PREMIUMVALUE_ISSET_ID = 2;
111
  private BitSet __isset_bit_vector = new BitSet(3);
112
 
113
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
114
  static {
115
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
116
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
118
    tmpMap.put(_Fields.INSURER, new org.apache.thrift.meta_data.FieldMetaData("insurer", org.apache.thrift.TFieldRequirementType.DEFAULT, 
119
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
120
    tmpMap.put(_Fields.PREMIUM_TYPE, new org.apache.thrift.meta_data.FieldMetaData("premiumType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
121
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PremiumType.class)));
122
    tmpMap.put(_Fields.PREMIUM_VALUE, new org.apache.thrift.meta_data.FieldMetaData("premiumValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
123
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
124
    metaDataMap = Collections.unmodifiableMap(tmpMap);
125
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInsurerMapping.class, metaDataMap);
126
  }
127
 
128
  public ItemInsurerMapping() {
129
  }
130
 
131
  public ItemInsurerMapping(
132
    long itemId,
133
    long insurer,
134
    PremiumType premiumType,
135
    double premiumValue)
136
  {
137
    this();
138
    this.itemId = itemId;
139
    setItemIdIsSet(true);
140
    this.insurer = insurer;
141
    setInsurerIsSet(true);
142
    this.premiumType = premiumType;
143
    this.premiumValue = premiumValue;
144
    setPremiumValueIsSet(true);
145
  }
146
 
147
  /**
148
   * Performs a deep copy on <i>other</i>.
149
   */
150
  public ItemInsurerMapping(ItemInsurerMapping other) {
151
    __isset_bit_vector.clear();
152
    __isset_bit_vector.or(other.__isset_bit_vector);
153
    this.itemId = other.itemId;
154
    this.insurer = other.insurer;
155
    if (other.isSetPremiumType()) {
156
      this.premiumType = other.premiumType;
157
    }
158
    this.premiumValue = other.premiumValue;
159
  }
160
 
161
  public ItemInsurerMapping deepCopy() {
162
    return new ItemInsurerMapping(this);
163
  }
164
 
165
  @Override
166
  public void clear() {
167
    setItemIdIsSet(false);
168
    this.itemId = 0;
169
    setInsurerIsSet(false);
170
    this.insurer = 0;
171
    this.premiumType = null;
172
    setPremiumValueIsSet(false);
173
    this.premiumValue = 0.0;
174
  }
175
 
176
  public long getItemId() {
177
    return this.itemId;
178
  }
179
 
180
  public void setItemId(long itemId) {
181
    this.itemId = itemId;
182
    setItemIdIsSet(true);
183
  }
184
 
185
  public void unsetItemId() {
186
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
187
  }
188
 
189
  /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
190
  public boolean isSetItemId() {
191
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
192
  }
193
 
194
  public void setItemIdIsSet(boolean value) {
195
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
196
  }
197
 
198
  public long getInsurer() {
199
    return this.insurer;
200
  }
201
 
202
  public void setInsurer(long insurer) {
203
    this.insurer = insurer;
204
    setInsurerIsSet(true);
205
  }
206
 
207
  public void unsetInsurer() {
208
    __isset_bit_vector.clear(__INSURER_ISSET_ID);
209
  }
210
 
211
  /** Returns true if field insurer is set (has been assigned a value) and false otherwise */
212
  public boolean isSetInsurer() {
213
    return __isset_bit_vector.get(__INSURER_ISSET_ID);
214
  }
215
 
216
  public void setInsurerIsSet(boolean value) {
217
    __isset_bit_vector.set(__INSURER_ISSET_ID, value);
218
  }
219
 
220
  /**
221
   * 
222
   * @see PremiumType
223
   */
224
  public PremiumType getPremiumType() {
225
    return this.premiumType;
226
  }
227
 
228
  /**
229
   * 
230
   * @see PremiumType
231
   */
232
  public void setPremiumType(PremiumType premiumType) {
233
    this.premiumType = premiumType;
234
  }
235
 
236
  public void unsetPremiumType() {
237
    this.premiumType = null;
238
  }
239
 
240
  /** Returns true if field premiumType is set (has been assigned a value) and false otherwise */
241
  public boolean isSetPremiumType() {
242
    return this.premiumType != null;
243
  }
244
 
245
  public void setPremiumTypeIsSet(boolean value) {
246
    if (!value) {
247
      this.premiumType = null;
248
    }
249
  }
250
 
251
  public double getPremiumValue() {
252
    return this.premiumValue;
253
  }
254
 
255
  public void setPremiumValue(double premiumValue) {
256
    this.premiumValue = premiumValue;
257
    setPremiumValueIsSet(true);
258
  }
259
 
260
  public void unsetPremiumValue() {
261
    __isset_bit_vector.clear(__PREMIUMVALUE_ISSET_ID);
262
  }
263
 
264
  /** Returns true if field premiumValue is set (has been assigned a value) and false otherwise */
265
  public boolean isSetPremiumValue() {
266
    return __isset_bit_vector.get(__PREMIUMVALUE_ISSET_ID);
267
  }
268
 
269
  public void setPremiumValueIsSet(boolean value) {
270
    __isset_bit_vector.set(__PREMIUMVALUE_ISSET_ID, value);
271
  }
272
 
273
  public void setFieldValue(_Fields field, Object value) {
274
    switch (field) {
275
    case ITEM_ID:
276
      if (value == null) {
277
        unsetItemId();
278
      } else {
279
        setItemId((Long)value);
280
      }
281
      break;
282
 
283
    case INSURER:
284
      if (value == null) {
285
        unsetInsurer();
286
      } else {
287
        setInsurer((Long)value);
288
      }
289
      break;
290
 
291
    case PREMIUM_TYPE:
292
      if (value == null) {
293
        unsetPremiumType();
294
      } else {
295
        setPremiumType((PremiumType)value);
296
      }
297
      break;
298
 
299
    case PREMIUM_VALUE:
300
      if (value == null) {
301
        unsetPremiumValue();
302
      } else {
303
        setPremiumValue((Double)value);
304
      }
305
      break;
306
 
307
    }
308
  }
309
 
310
  public Object getFieldValue(_Fields field) {
311
    switch (field) {
312
    case ITEM_ID:
313
      return Long.valueOf(getItemId());
314
 
315
    case INSURER:
316
      return Long.valueOf(getInsurer());
317
 
318
    case PREMIUM_TYPE:
319
      return getPremiumType();
320
 
321
    case PREMIUM_VALUE:
322
      return Double.valueOf(getPremiumValue());
323
 
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 ITEM_ID:
336
      return isSetItemId();
337
    case INSURER:
338
      return isSetInsurer();
339
    case PREMIUM_TYPE:
340
      return isSetPremiumType();
341
    case PREMIUM_VALUE:
342
      return isSetPremiumValue();
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 ItemInsurerMapping)
352
      return this.equals((ItemInsurerMapping)that);
353
    return false;
354
  }
355
 
356
  public boolean equals(ItemInsurerMapping that) {
357
    if (that == null)
358
      return false;
359
 
360
    boolean this_present_itemId = true;
361
    boolean that_present_itemId = true;
362
    if (this_present_itemId || that_present_itemId) {
363
      if (!(this_present_itemId && that_present_itemId))
364
        return false;
365
      if (this.itemId != that.itemId)
366
        return false;
367
    }
368
 
369
    boolean this_present_insurer = true;
370
    boolean that_present_insurer = true;
371
    if (this_present_insurer || that_present_insurer) {
372
      if (!(this_present_insurer && that_present_insurer))
373
        return false;
374
      if (this.insurer != that.insurer)
375
        return false;
376
    }
377
 
378
    boolean this_present_premiumType = true && this.isSetPremiumType();
379
    boolean that_present_premiumType = true && that.isSetPremiumType();
380
    if (this_present_premiumType || that_present_premiumType) {
381
      if (!(this_present_premiumType && that_present_premiumType))
382
        return false;
383
      if (!this.premiumType.equals(that.premiumType))
384
        return false;
385
    }
386
 
387
    boolean this_present_premiumValue = true;
388
    boolean that_present_premiumValue = true;
389
    if (this_present_premiumValue || that_present_premiumValue) {
390
      if (!(this_present_premiumValue && that_present_premiumValue))
391
        return false;
392
      if (this.premiumValue != that.premiumValue)
393
        return false;
394
    }
395
 
396
    return true;
397
  }
398
 
399
  @Override
400
  public int hashCode() {
401
    return 0;
402
  }
403
 
404
  public int compareTo(ItemInsurerMapping other) {
405
    if (!getClass().equals(other.getClass())) {
406
      return getClass().getName().compareTo(other.getClass().getName());
407
    }
408
 
409
    int lastComparison = 0;
410
    ItemInsurerMapping typedOther = (ItemInsurerMapping)other;
411
 
412
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
413
    if (lastComparison != 0) {
414
      return lastComparison;
415
    }
416
    if (isSetItemId()) {
417
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
418
      if (lastComparison != 0) {
419
        return lastComparison;
420
      }
421
    }
422
    lastComparison = Boolean.valueOf(isSetInsurer()).compareTo(typedOther.isSetInsurer());
423
    if (lastComparison != 0) {
424
      return lastComparison;
425
    }
426
    if (isSetInsurer()) {
427
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.insurer, typedOther.insurer);
428
      if (lastComparison != 0) {
429
        return lastComparison;
430
      }
431
    }
432
    lastComparison = Boolean.valueOf(isSetPremiumType()).compareTo(typedOther.isSetPremiumType());
433
    if (lastComparison != 0) {
434
      return lastComparison;
435
    }
436
    if (isSetPremiumType()) {
437
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.premiumType, typedOther.premiumType);
438
      if (lastComparison != 0) {
439
        return lastComparison;
440
      }
441
    }
442
    lastComparison = Boolean.valueOf(isSetPremiumValue()).compareTo(typedOther.isSetPremiumValue());
443
    if (lastComparison != 0) {
444
      return lastComparison;
445
    }
446
    if (isSetPremiumValue()) {
447
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.premiumValue, typedOther.premiumValue);
448
      if (lastComparison != 0) {
449
        return lastComparison;
450
      }
451
    }
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: // ITEM_ID
470
          if (field.type == org.apache.thrift.protocol.TType.I64) {
471
            this.itemId = iprot.readI64();
472
            setItemIdIsSet(true);
473
          } else { 
474
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
475
          }
476
          break;
477
        case 2: // INSURER
478
          if (field.type == org.apache.thrift.protocol.TType.I64) {
479
            this.insurer = iprot.readI64();
480
            setInsurerIsSet(true);
481
          } else { 
482
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
483
          }
484
          break;
485
        case 3: // PREMIUM_TYPE
486
          if (field.type == org.apache.thrift.protocol.TType.I32) {
487
            this.premiumType = PremiumType.findByValue(iprot.readI32());
488
          } else { 
489
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
490
          }
491
          break;
492
        case 4: // PREMIUM_VALUE
493
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
494
            this.premiumValue = iprot.readDouble();
495
            setPremiumValueIsSet(true);
496
          } else { 
497
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
498
          }
499
          break;
500
        default:
501
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
502
      }
503
      iprot.readFieldEnd();
504
    }
505
    iprot.readStructEnd();
506
    validate();
507
  }
508
 
509
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
510
    validate();
511
 
512
    oprot.writeStructBegin(STRUCT_DESC);
513
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
514
    oprot.writeI64(this.itemId);
515
    oprot.writeFieldEnd();
516
    oprot.writeFieldBegin(INSURER_FIELD_DESC);
517
    oprot.writeI64(this.insurer);
518
    oprot.writeFieldEnd();
519
    if (this.premiumType != null) {
520
      oprot.writeFieldBegin(PREMIUM_TYPE_FIELD_DESC);
521
      oprot.writeI32(this.premiumType.getValue());
522
      oprot.writeFieldEnd();
523
    }
524
    oprot.writeFieldBegin(PREMIUM_VALUE_FIELD_DESC);
525
    oprot.writeDouble(this.premiumValue);
526
    oprot.writeFieldEnd();
527
    oprot.writeFieldStop();
528
    oprot.writeStructEnd();
529
  }
530
 
531
  @Override
532
  public String toString() {
533
    StringBuilder sb = new StringBuilder("ItemInsurerMapping(");
534
    boolean first = true;
535
 
536
    sb.append("itemId:");
537
    sb.append(this.itemId);
538
    first = false;
539
    if (!first) sb.append(", ");
540
    sb.append("insurer:");
541
    sb.append(this.insurer);
542
    first = false;
543
    if (!first) sb.append(", ");
544
    sb.append("premiumType:");
545
    if (this.premiumType == null) {
546
      sb.append("null");
547
    } else {
548
      sb.append(this.premiumType);
549
    }
550
    first = false;
551
    if (!first) sb.append(", ");
552
    sb.append("premiumValue:");
553
    sb.append(this.premiumValue);
554
    first = false;
555
    sb.append(")");
556
    return sb.toString();
557
  }
558
 
559
  public void validate() throws org.apache.thrift.TException {
560
    // check for required fields
561
  }
562
 
563
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
564
    try {
565
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
566
    } catch (org.apache.thrift.TException te) {
567
      throw new java.io.IOException(te);
568
    }
569
  }
570
 
571
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
572
    try {
573
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
574
      __isset_bit_vector = new BitSet(1);
575
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
576
    } catch (org.apache.thrift.TException te) {
577
      throw new java.io.IOException(te);
578
    }
579
  }
580
 
581
}
582