Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1342 chandransh 1
/**
2
 * Autogenerated by Thrift
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.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
1350 chandransh 26
public class VendorItemPricing implements TBase<VendorItemPricing._Fields>, java.io.Serializable, Cloneable, Comparable<VendorItemPricing> {
1342 chandransh 27
  private static final TStruct STRUCT_DESC = new TStruct("VendorItemPricing");
28
 
1350 chandransh 29
  private static final TField VENDOR_ID_FIELD_DESC = new TField("vendorId", TType.I64, (short)1);
30
  private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)2);
1342 chandransh 31
  private static final TField TRANSFER_PRICE_FIELD_DESC = new TField("transferPrice", TType.DOUBLE, (short)3);
32
  private static final TField MOP_FIELD_DESC = new TField("mop", TType.DOUBLE, (short)4);
33
  private static final TField DEALER_PRICE_FIELD_DESC = new TField("dealerPrice", TType.DOUBLE, (short)5);
34
 
1350 chandransh 35
  private long vendorId;
36
  private long itemId;
1342 chandransh 37
  private double transferPrice;
38
  private double mop;
39
  private double dealerPrice;
40
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
1350 chandransh 43
    VENDOR_ID((short)1, "vendorId"),
44
    ITEM_ID((short)2, "itemId"),
1342 chandransh 45
    TRANSFER_PRICE((short)3, "transferPrice"),
46
    MOP((short)4, "mop"),
47
    DEALER_PRICE((short)5, "dealerPrice");
48
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
 
52
    static {
53
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
54
        byId.put((int)field._thriftId, field);
55
        byName.put(field.getFieldName(), field);
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, or null if its not found.
61
     */
62
    public static _Fields findByThriftId(int fieldId) {
63
      return byId.get(fieldId);
64
    }
65
 
66
    /**
67
     * Find the _Fields constant that matches fieldId, throwing an exception
68
     * if it is not found.
69
     */
70
    public static _Fields findByThriftIdOrThrow(int fieldId) {
71
      _Fields fields = findByThriftId(fieldId);
72
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
73
      return fields;
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches name, or null if its not found.
78
     */
79
    public static _Fields findByName(String name) {
80
      return byName.get(name);
81
    }
82
 
83
    private final short _thriftId;
84
    private final String _fieldName;
85
 
86
    _Fields(short thriftId, String fieldName) {
87
      _thriftId = thriftId;
88
      _fieldName = fieldName;
89
    }
90
 
91
    public short getThriftFieldId() {
92
      return _thriftId;
93
    }
94
 
95
    public String getFieldName() {
96
      return _fieldName;
97
    }
98
  }
99
 
100
  // isset id assignments
1350 chandransh 101
  private static final int __VENDORID_ISSET_ID = 0;
102
  private static final int __ITEMID_ISSET_ID = 1;
103
  private static final int __TRANSFERPRICE_ISSET_ID = 2;
104
  private static final int __MOP_ISSET_ID = 3;
105
  private static final int __DEALERPRICE_ISSET_ID = 4;
106
  private BitSet __isset_bit_vector = new BitSet(5);
1342 chandransh 107
 
108
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
1350 chandransh 109
    put(_Fields.VENDOR_ID, new FieldMetaData("vendorId", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.I64)));
111
    put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
112
        new FieldValueMetaData(TType.I64)));
1342 chandransh 113
    put(_Fields.TRANSFER_PRICE, new FieldMetaData("transferPrice", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.DOUBLE)));
115
    put(_Fields.MOP, new FieldMetaData("mop", TFieldRequirementType.DEFAULT, 
116
        new FieldValueMetaData(TType.DOUBLE)));
117
    put(_Fields.DEALER_PRICE, new FieldMetaData("dealerPrice", TFieldRequirementType.DEFAULT, 
118
        new FieldValueMetaData(TType.DOUBLE)));
119
  }});
120
 
121
  static {
122
    FieldMetaData.addStructMetaDataMap(VendorItemPricing.class, metaDataMap);
123
  }
124
 
125
  public VendorItemPricing() {
126
  }
127
 
128
  public VendorItemPricing(
1350 chandransh 129
    long vendorId,
130
    long itemId,
1342 chandransh 131
    double transferPrice,
132
    double mop,
133
    double dealerPrice)
134
  {
135
    this();
1350 chandransh 136
    this.vendorId = vendorId;
137
    setVendorIdIsSet(true);
138
    this.itemId = itemId;
139
    setItemIdIsSet(true);
1342 chandransh 140
    this.transferPrice = transferPrice;
141
    setTransferPriceIsSet(true);
142
    this.mop = mop;
143
    setMopIsSet(true);
144
    this.dealerPrice = dealerPrice;
145
    setDealerPriceIsSet(true);
146
  }
147
 
148
  /**
149
   * Performs a deep copy on <i>other</i>.
150
   */
151
  public VendorItemPricing(VendorItemPricing other) {
152
    __isset_bit_vector.clear();
153
    __isset_bit_vector.or(other.__isset_bit_vector);
1350 chandransh 154
    this.vendorId = other.vendorId;
155
    this.itemId = other.itemId;
1342 chandransh 156
    this.transferPrice = other.transferPrice;
157
    this.mop = other.mop;
158
    this.dealerPrice = other.dealerPrice;
159
  }
160
 
161
  public VendorItemPricing deepCopy() {
162
    return new VendorItemPricing(this);
163
  }
164
 
165
  @Deprecated
166
  public VendorItemPricing clone() {
167
    return new VendorItemPricing(this);
168
  }
169
 
1350 chandransh 170
  public long getVendorId() {
171
    return this.vendorId;
1342 chandransh 172
  }
173
 
1350 chandransh 174
  public VendorItemPricing setVendorId(long vendorId) {
175
    this.vendorId = vendorId;
176
    setVendorIdIsSet(true);
1342 chandransh 177
    return this;
178
  }
179
 
1350 chandransh 180
  public void unsetVendorId() {
181
    __isset_bit_vector.clear(__VENDORID_ISSET_ID);
1342 chandransh 182
  }
183
 
1350 chandransh 184
  /** Returns true if field vendorId is set (has been asigned a value) and false otherwise */
185
  public boolean isSetVendorId() {
186
    return __isset_bit_vector.get(__VENDORID_ISSET_ID);
1342 chandransh 187
  }
188
 
1350 chandransh 189
  public void setVendorIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__VENDORID_ISSET_ID, value);
1342 chandransh 191
  }
192
 
1350 chandransh 193
  public long getItemId() {
194
    return this.itemId;
1342 chandransh 195
  }
196
 
1350 chandransh 197
  public VendorItemPricing setItemId(long itemId) {
198
    this.itemId = itemId;
199
    setItemIdIsSet(true);
1342 chandransh 200
    return this;
201
  }
202
 
1350 chandransh 203
  public void unsetItemId() {
204
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
1342 chandransh 205
  }
206
 
1350 chandransh 207
  /** Returns true if field itemId is set (has been asigned a value) and false otherwise */
208
  public boolean isSetItemId() {
209
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
1342 chandransh 210
  }
211
 
1350 chandransh 212
  public void setItemIdIsSet(boolean value) {
213
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
1342 chandransh 214
  }
215
 
216
  public double getTransferPrice() {
217
    return this.transferPrice;
218
  }
219
 
220
  public VendorItemPricing setTransferPrice(double transferPrice) {
221
    this.transferPrice = transferPrice;
222
    setTransferPriceIsSet(true);
223
    return this;
224
  }
225
 
226
  public void unsetTransferPrice() {
227
    __isset_bit_vector.clear(__TRANSFERPRICE_ISSET_ID);
228
  }
229
 
230
  /** Returns true if field transferPrice is set (has been asigned a value) and false otherwise */
231
  public boolean isSetTransferPrice() {
232
    return __isset_bit_vector.get(__TRANSFERPRICE_ISSET_ID);
233
  }
234
 
235
  public void setTransferPriceIsSet(boolean value) {
236
    __isset_bit_vector.set(__TRANSFERPRICE_ISSET_ID, value);
237
  }
238
 
239
  public double getMop() {
240
    return this.mop;
241
  }
242
 
243
  public VendorItemPricing setMop(double mop) {
244
    this.mop = mop;
245
    setMopIsSet(true);
246
    return this;
247
  }
248
 
249
  public void unsetMop() {
250
    __isset_bit_vector.clear(__MOP_ISSET_ID);
251
  }
252
 
253
  /** Returns true if field mop is set (has been asigned a value) and false otherwise */
254
  public boolean isSetMop() {
255
    return __isset_bit_vector.get(__MOP_ISSET_ID);
256
  }
257
 
258
  public void setMopIsSet(boolean value) {
259
    __isset_bit_vector.set(__MOP_ISSET_ID, value);
260
  }
261
 
262
  public double getDealerPrice() {
263
    return this.dealerPrice;
264
  }
265
 
266
  public VendorItemPricing setDealerPrice(double dealerPrice) {
267
    this.dealerPrice = dealerPrice;
268
    setDealerPriceIsSet(true);
269
    return this;
270
  }
271
 
272
  public void unsetDealerPrice() {
273
    __isset_bit_vector.clear(__DEALERPRICE_ISSET_ID);
274
  }
275
 
276
  /** Returns true if field dealerPrice is set (has been asigned a value) and false otherwise */
277
  public boolean isSetDealerPrice() {
278
    return __isset_bit_vector.get(__DEALERPRICE_ISSET_ID);
279
  }
280
 
281
  public void setDealerPriceIsSet(boolean value) {
282
    __isset_bit_vector.set(__DEALERPRICE_ISSET_ID, value);
283
  }
284
 
285
  public void setFieldValue(_Fields field, Object value) {
286
    switch (field) {
1350 chandransh 287
    case VENDOR_ID:
1342 chandransh 288
      if (value == null) {
1350 chandransh 289
        unsetVendorId();
1342 chandransh 290
      } else {
1350 chandransh 291
        setVendorId((Long)value);
1342 chandransh 292
      }
293
      break;
294
 
1350 chandransh 295
    case ITEM_ID:
1342 chandransh 296
      if (value == null) {
1350 chandransh 297
        unsetItemId();
1342 chandransh 298
      } else {
1350 chandransh 299
        setItemId((Long)value);
1342 chandransh 300
      }
301
      break;
302
 
303
    case TRANSFER_PRICE:
304
      if (value == null) {
305
        unsetTransferPrice();
306
      } else {
307
        setTransferPrice((Double)value);
308
      }
309
      break;
310
 
311
    case MOP:
312
      if (value == null) {
313
        unsetMop();
314
      } else {
315
        setMop((Double)value);
316
      }
317
      break;
318
 
319
    case DEALER_PRICE:
320
      if (value == null) {
321
        unsetDealerPrice();
322
      } else {
323
        setDealerPrice((Double)value);
324
      }
325
      break;
326
 
327
    }
328
  }
329
 
330
  public void setFieldValue(int fieldID, Object value) {
331
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
332
  }
333
 
334
  public Object getFieldValue(_Fields field) {
335
    switch (field) {
1350 chandransh 336
    case VENDOR_ID:
337
      return new Long(getVendorId());
1342 chandransh 338
 
1350 chandransh 339
    case ITEM_ID:
340
      return new Long(getItemId());
1342 chandransh 341
 
342
    case TRANSFER_PRICE:
343
      return new Double(getTransferPrice());
344
 
345
    case MOP:
346
      return new Double(getMop());
347
 
348
    case DEALER_PRICE:
349
      return new Double(getDealerPrice());
350
 
351
    }
352
    throw new IllegalStateException();
353
  }
354
 
355
  public Object getFieldValue(int fieldId) {
356
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
357
  }
358
 
359
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
360
  public boolean isSet(_Fields field) {
361
    switch (field) {
1350 chandransh 362
    case VENDOR_ID:
363
      return isSetVendorId();
364
    case ITEM_ID:
365
      return isSetItemId();
1342 chandransh 366
    case TRANSFER_PRICE:
367
      return isSetTransferPrice();
368
    case MOP:
369
      return isSetMop();
370
    case DEALER_PRICE:
371
      return isSetDealerPrice();
372
    }
373
    throw new IllegalStateException();
374
  }
375
 
376
  public boolean isSet(int fieldID) {
377
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
378
  }
379
 
380
  @Override
381
  public boolean equals(Object that) {
382
    if (that == null)
383
      return false;
384
    if (that instanceof VendorItemPricing)
385
      return this.equals((VendorItemPricing)that);
386
    return false;
387
  }
388
 
389
  public boolean equals(VendorItemPricing that) {
390
    if (that == null)
391
      return false;
392
 
1350 chandransh 393
    boolean this_present_vendorId = true;
394
    boolean that_present_vendorId = true;
395
    if (this_present_vendorId || that_present_vendorId) {
396
      if (!(this_present_vendorId && that_present_vendorId))
1342 chandransh 397
        return false;
1350 chandransh 398
      if (this.vendorId != that.vendorId)
1342 chandransh 399
        return false;
400
    }
401
 
1350 chandransh 402
    boolean this_present_itemId = true;
403
    boolean that_present_itemId = true;
404
    if (this_present_itemId || that_present_itemId) {
405
      if (!(this_present_itemId && that_present_itemId))
1342 chandransh 406
        return false;
1350 chandransh 407
      if (this.itemId != that.itemId)
1342 chandransh 408
        return false;
409
    }
410
 
411
    boolean this_present_transferPrice = true;
412
    boolean that_present_transferPrice = true;
413
    if (this_present_transferPrice || that_present_transferPrice) {
414
      if (!(this_present_transferPrice && that_present_transferPrice))
415
        return false;
416
      if (this.transferPrice != that.transferPrice)
417
        return false;
418
    }
419
 
420
    boolean this_present_mop = true;
421
    boolean that_present_mop = true;
422
    if (this_present_mop || that_present_mop) {
423
      if (!(this_present_mop && that_present_mop))
424
        return false;
425
      if (this.mop != that.mop)
426
        return false;
427
    }
428
 
429
    boolean this_present_dealerPrice = true;
430
    boolean that_present_dealerPrice = true;
431
    if (this_present_dealerPrice || that_present_dealerPrice) {
432
      if (!(this_present_dealerPrice && that_present_dealerPrice))
433
        return false;
434
      if (this.dealerPrice != that.dealerPrice)
435
        return false;
436
    }
437
 
438
    return true;
439
  }
440
 
441
  @Override
442
  public int hashCode() {
443
    return 0;
444
  }
445
 
1350 chandransh 446
  public int compareTo(VendorItemPricing other) {
447
    if (!getClass().equals(other.getClass())) {
448
      return getClass().getName().compareTo(other.getClass().getName());
449
    }
450
 
451
    int lastComparison = 0;
452
    VendorItemPricing typedOther = (VendorItemPricing)other;
453
 
454
    lastComparison = Boolean.valueOf(isSetVendorId()).compareTo(isSetVendorId());
455
    if (lastComparison != 0) {
456
      return lastComparison;
457
    }
458
    lastComparison = TBaseHelper.compareTo(vendorId, typedOther.vendorId);
459
    if (lastComparison != 0) {
460
      return lastComparison;
461
    }
462
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
463
    if (lastComparison != 0) {
464
      return lastComparison;
465
    }
466
    lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
467
    if (lastComparison != 0) {
468
      return lastComparison;
469
    }
470
    lastComparison = Boolean.valueOf(isSetTransferPrice()).compareTo(isSetTransferPrice());
471
    if (lastComparison != 0) {
472
      return lastComparison;
473
    }
474
    lastComparison = TBaseHelper.compareTo(transferPrice, typedOther.transferPrice);
475
    if (lastComparison != 0) {
476
      return lastComparison;
477
    }
478
    lastComparison = Boolean.valueOf(isSetMop()).compareTo(isSetMop());
479
    if (lastComparison != 0) {
480
      return lastComparison;
481
    }
482
    lastComparison = TBaseHelper.compareTo(mop, typedOther.mop);
483
    if (lastComparison != 0) {
484
      return lastComparison;
485
    }
486
    lastComparison = Boolean.valueOf(isSetDealerPrice()).compareTo(isSetDealerPrice());
487
    if (lastComparison != 0) {
488
      return lastComparison;
489
    }
490
    lastComparison = TBaseHelper.compareTo(dealerPrice, typedOther.dealerPrice);
491
    if (lastComparison != 0) {
492
      return lastComparison;
493
    }
494
    return 0;
495
  }
496
 
1342 chandransh 497
  public void read(TProtocol iprot) throws TException {
498
    TField field;
499
    iprot.readStructBegin();
500
    while (true)
501
    {
502
      field = iprot.readFieldBegin();
503
      if (field.type == TType.STOP) { 
504
        break;
505
      }
506
      _Fields fieldId = _Fields.findByThriftId(field.id);
507
      if (fieldId == null) {
508
        TProtocolUtil.skip(iprot, field.type);
509
      } else {
510
        switch (fieldId) {
1350 chandransh 511
          case VENDOR_ID:
512
            if (field.type == TType.I64) {
513
              this.vendorId = iprot.readI64();
514
              setVendorIdIsSet(true);
1342 chandransh 515
            } else { 
516
              TProtocolUtil.skip(iprot, field.type);
517
            }
518
            break;
1350 chandransh 519
          case ITEM_ID:
520
            if (field.type == TType.I64) {
521
              this.itemId = iprot.readI64();
522
              setItemIdIsSet(true);
1342 chandransh 523
            } else { 
524
              TProtocolUtil.skip(iprot, field.type);
525
            }
526
            break;
527
          case TRANSFER_PRICE:
528
            if (field.type == TType.DOUBLE) {
529
              this.transferPrice = iprot.readDouble();
530
              setTransferPriceIsSet(true);
531
            } else { 
532
              TProtocolUtil.skip(iprot, field.type);
533
            }
534
            break;
535
          case MOP:
536
            if (field.type == TType.DOUBLE) {
537
              this.mop = iprot.readDouble();
538
              setMopIsSet(true);
539
            } else { 
540
              TProtocolUtil.skip(iprot, field.type);
541
            }
542
            break;
543
          case DEALER_PRICE:
544
            if (field.type == TType.DOUBLE) {
545
              this.dealerPrice = iprot.readDouble();
546
              setDealerPriceIsSet(true);
547
            } else { 
548
              TProtocolUtil.skip(iprot, field.type);
549
            }
550
            break;
551
        }
552
        iprot.readFieldEnd();
553
      }
554
    }
555
    iprot.readStructEnd();
556
    validate();
557
  }
558
 
559
  public void write(TProtocol oprot) throws TException {
560
    validate();
561
 
562
    oprot.writeStructBegin(STRUCT_DESC);
1350 chandransh 563
    oprot.writeFieldBegin(VENDOR_ID_FIELD_DESC);
564
    oprot.writeI64(this.vendorId);
565
    oprot.writeFieldEnd();
566
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
567
    oprot.writeI64(this.itemId);
568
    oprot.writeFieldEnd();
1342 chandransh 569
    oprot.writeFieldBegin(TRANSFER_PRICE_FIELD_DESC);
570
    oprot.writeDouble(this.transferPrice);
571
    oprot.writeFieldEnd();
572
    oprot.writeFieldBegin(MOP_FIELD_DESC);
573
    oprot.writeDouble(this.mop);
574
    oprot.writeFieldEnd();
575
    oprot.writeFieldBegin(DEALER_PRICE_FIELD_DESC);
576
    oprot.writeDouble(this.dealerPrice);
577
    oprot.writeFieldEnd();
578
    oprot.writeFieldStop();
579
    oprot.writeStructEnd();
580
  }
581
 
582
  @Override
583
  public String toString() {
584
    StringBuilder sb = new StringBuilder("VendorItemPricing(");
585
    boolean first = true;
586
 
1350 chandransh 587
    sb.append("vendorId:");
588
    sb.append(this.vendorId);
1342 chandransh 589
    first = false;
590
    if (!first) sb.append(", ");
1350 chandransh 591
    sb.append("itemId:");
592
    sb.append(this.itemId);
1342 chandransh 593
    first = false;
594
    if (!first) sb.append(", ");
595
    sb.append("transferPrice:");
596
    sb.append(this.transferPrice);
597
    first = false;
598
    if (!first) sb.append(", ");
599
    sb.append("mop:");
600
    sb.append(this.mop);
601
    first = false;
602
    if (!first) sb.append(", ");
603
    sb.append("dealerPrice:");
604
    sb.append(this.dealerPrice);
605
    first = false;
606
    sb.append(")");
607
    return sb.toString();
608
  }
609
 
610
  public void validate() throws TException {
611
    // check for required fields
612
  }
613
 
614
}
615