Subversion Repositories SmartDukaan

Rev

Rev 7281 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7281 kshitij.so 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.inventory;
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 AmazonInventorySnapshot implements org.apache.thrift.TBase<AmazonInventorySnapshot, AmazonInventorySnapshot._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AmazonInventorySnapshot");
25
 
26
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("item_id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField AVAILABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("availability", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField RESERVED_FIELD_DESC = new org.apache.thrift.protocol.TField("reserved", org.apache.thrift.protocol.TType.I64, (short)3);
10450 vikram.rag 29
  private static final org.apache.thrift.protocol.TField IS_OOS_FIELD_DESC = new org.apache.thrift.protocol.TField("is_oos", org.apache.thrift.protocol.TType.BOOL, (short)4);
7281 kshitij.so 30
 
31
  private long item_id; // required
32
  private long availability; // required
33
  private long reserved; // required
10450 vikram.rag 34
  private boolean is_oos; // required
7281 kshitij.so 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, "item_id"),
39
    AVAILABILITY((short)2, "availability"),
10450 vikram.rag 40
    RESERVED((short)3, "reserved"),
41
    IS_OOS((short)4, "is_oos");
7281 kshitij.so 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: // ITEM_ID
57
          return ITEM_ID;
58
        case 2: // AVAILABILITY
59
          return AVAILABILITY;
60
        case 3: // RESERVED
61
          return RESERVED;
10450 vikram.rag 62
        case 4: // IS_OOS
63
          return IS_OOS;
7281 kshitij.so 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 __ITEM_ID_ISSET_ID = 0;
105
  private static final int __AVAILABILITY_ISSET_ID = 1;
106
  private static final int __RESERVED_ISSET_ID = 2;
10450 vikram.rag 107
  private static final int __IS_OOS_ISSET_ID = 3;
108
  private BitSet __isset_bit_vector = new BitSet(4);
7281 kshitij.so 109
 
110
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
111
  static {
112
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
113
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
114
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
115
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
116
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
117
    tmpMap.put(_Fields.RESERVED, new org.apache.thrift.meta_data.FieldMetaData("reserved", org.apache.thrift.TFieldRequirementType.DEFAULT, 
118
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
10450 vikram.rag 119
    tmpMap.put(_Fields.IS_OOS, new org.apache.thrift.meta_data.FieldMetaData("is_oos", org.apache.thrift.TFieldRequirementType.DEFAULT, 
120
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
7281 kshitij.so 121
    metaDataMap = Collections.unmodifiableMap(tmpMap);
122
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AmazonInventorySnapshot.class, metaDataMap);
123
  }
124
 
125
  public AmazonInventorySnapshot() {
126
  }
127
 
128
  public AmazonInventorySnapshot(
129
    long item_id,
130
    long availability,
10450 vikram.rag 131
    long reserved,
132
    boolean is_oos)
7281 kshitij.so 133
  {
134
    this();
135
    this.item_id = item_id;
136
    setItem_idIsSet(true);
137
    this.availability = availability;
138
    setAvailabilityIsSet(true);
139
    this.reserved = reserved;
140
    setReservedIsSet(true);
10450 vikram.rag 141
    this.is_oos = is_oos;
142
    setIs_oosIsSet(true);
7281 kshitij.so 143
  }
144
 
145
  /**
146
   * Performs a deep copy on <i>other</i>.
147
   */
148
  public AmazonInventorySnapshot(AmazonInventorySnapshot other) {
149
    __isset_bit_vector.clear();
150
    __isset_bit_vector.or(other.__isset_bit_vector);
151
    this.item_id = other.item_id;
152
    this.availability = other.availability;
153
    this.reserved = other.reserved;
10450 vikram.rag 154
    this.is_oos = other.is_oos;
7281 kshitij.so 155
  }
156
 
157
  public AmazonInventorySnapshot deepCopy() {
158
    return new AmazonInventorySnapshot(this);
159
  }
160
 
161
  @Override
162
  public void clear() {
163
    setItem_idIsSet(false);
164
    this.item_id = 0;
165
    setAvailabilityIsSet(false);
166
    this.availability = 0;
167
    setReservedIsSet(false);
168
    this.reserved = 0;
10450 vikram.rag 169
    setIs_oosIsSet(false);
170
    this.is_oos = false;
7281 kshitij.so 171
  }
172
 
173
  public long getItem_id() {
174
    return this.item_id;
175
  }
176
 
177
  public void setItem_id(long item_id) {
178
    this.item_id = item_id;
179
    setItem_idIsSet(true);
180
  }
181
 
182
  public void unsetItem_id() {
183
    __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
184
  }
185
 
186
  /** Returns true if field item_id is set (has been assigned a value) and false otherwise */
187
  public boolean isSetItem_id() {
188
    return __isset_bit_vector.get(__ITEM_ID_ISSET_ID);
189
  }
190
 
191
  public void setItem_idIsSet(boolean value) {
192
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
193
  }
194
 
195
  public long getAvailability() {
196
    return this.availability;
197
  }
198
 
199
  public void setAvailability(long availability) {
200
    this.availability = availability;
201
    setAvailabilityIsSet(true);
202
  }
203
 
204
  public void unsetAvailability() {
205
    __isset_bit_vector.clear(__AVAILABILITY_ISSET_ID);
206
  }
207
 
208
  /** Returns true if field availability is set (has been assigned a value) and false otherwise */
209
  public boolean isSetAvailability() {
210
    return __isset_bit_vector.get(__AVAILABILITY_ISSET_ID);
211
  }
212
 
213
  public void setAvailabilityIsSet(boolean value) {
214
    __isset_bit_vector.set(__AVAILABILITY_ISSET_ID, value);
215
  }
216
 
217
  public long getReserved() {
218
    return this.reserved;
219
  }
220
 
221
  public void setReserved(long reserved) {
222
    this.reserved = reserved;
223
    setReservedIsSet(true);
224
  }
225
 
226
  public void unsetReserved() {
227
    __isset_bit_vector.clear(__RESERVED_ISSET_ID);
228
  }
229
 
230
  /** Returns true if field reserved is set (has been assigned a value) and false otherwise */
231
  public boolean isSetReserved() {
232
    return __isset_bit_vector.get(__RESERVED_ISSET_ID);
233
  }
234
 
235
  public void setReservedIsSet(boolean value) {
236
    __isset_bit_vector.set(__RESERVED_ISSET_ID, value);
237
  }
238
 
10450 vikram.rag 239
  public boolean isIs_oos() {
240
    return this.is_oos;
241
  }
242
 
243
  public void setIs_oos(boolean is_oos) {
244
    this.is_oos = is_oos;
245
    setIs_oosIsSet(true);
246
  }
247
 
248
  public void unsetIs_oos() {
249
    __isset_bit_vector.clear(__IS_OOS_ISSET_ID);
250
  }
251
 
252
  /** Returns true if field is_oos is set (has been assigned a value) and false otherwise */
253
  public boolean isSetIs_oos() {
254
    return __isset_bit_vector.get(__IS_OOS_ISSET_ID);
255
  }
256
 
257
  public void setIs_oosIsSet(boolean value) {
258
    __isset_bit_vector.set(__IS_OOS_ISSET_ID, value);
259
  }
260
 
7281 kshitij.so 261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case ITEM_ID:
264
      if (value == null) {
265
        unsetItem_id();
266
      } else {
267
        setItem_id((Long)value);
268
      }
269
      break;
270
 
271
    case AVAILABILITY:
272
      if (value == null) {
273
        unsetAvailability();
274
      } else {
275
        setAvailability((Long)value);
276
      }
277
      break;
278
 
279
    case RESERVED:
280
      if (value == null) {
281
        unsetReserved();
282
      } else {
283
        setReserved((Long)value);
284
      }
285
      break;
286
 
10450 vikram.rag 287
    case IS_OOS:
288
      if (value == null) {
289
        unsetIs_oos();
290
      } else {
291
        setIs_oos((Boolean)value);
292
      }
293
      break;
294
 
7281 kshitij.so 295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case ITEM_ID:
301
      return Long.valueOf(getItem_id());
302
 
303
    case AVAILABILITY:
304
      return Long.valueOf(getAvailability());
305
 
306
    case RESERVED:
307
      return Long.valueOf(getReserved());
308
 
10450 vikram.rag 309
    case IS_OOS:
310
      return Boolean.valueOf(isIs_oos());
311
 
7281 kshitij.so 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 ITEM_ID:
324
      return isSetItem_id();
325
    case AVAILABILITY:
326
      return isSetAvailability();
327
    case RESERVED:
328
      return isSetReserved();
10450 vikram.rag 329
    case IS_OOS:
330
      return isSetIs_oos();
7281 kshitij.so 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 AmazonInventorySnapshot)
340
      return this.equals((AmazonInventorySnapshot)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(AmazonInventorySnapshot that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_item_id = true;
349
    boolean that_present_item_id = true;
350
    if (this_present_item_id || that_present_item_id) {
351
      if (!(this_present_item_id && that_present_item_id))
352
        return false;
353
      if (this.item_id != that.item_id)
354
        return false;
355
    }
356
 
357
    boolean this_present_availability = true;
358
    boolean that_present_availability = true;
359
    if (this_present_availability || that_present_availability) {
360
      if (!(this_present_availability && that_present_availability))
361
        return false;
362
      if (this.availability != that.availability)
363
        return false;
364
    }
365
 
366
    boolean this_present_reserved = true;
367
    boolean that_present_reserved = true;
368
    if (this_present_reserved || that_present_reserved) {
369
      if (!(this_present_reserved && that_present_reserved))
370
        return false;
371
      if (this.reserved != that.reserved)
372
        return false;
373
    }
374
 
10450 vikram.rag 375
    boolean this_present_is_oos = true;
376
    boolean that_present_is_oos = true;
377
    if (this_present_is_oos || that_present_is_oos) {
378
      if (!(this_present_is_oos && that_present_is_oos))
379
        return false;
380
      if (this.is_oos != that.is_oos)
381
        return false;
382
    }
383
 
7281 kshitij.so 384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(AmazonInventorySnapshot other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    AmazonInventorySnapshot typedOther = (AmazonInventorySnapshot)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(typedOther.isSetItem_id());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    if (isSetItem_id()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.item_id, typedOther.item_id);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
409
    }
410
    lastComparison = Boolean.valueOf(isSetAvailability()).compareTo(typedOther.isSetAvailability());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    if (isSetAvailability()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
419
    }
420
    lastComparison = Boolean.valueOf(isSetReserved()).compareTo(typedOther.isSetReserved());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetReserved()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reserved, typedOther.reserved);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
10450 vikram.rag 430
    lastComparison = Boolean.valueOf(isSetIs_oos()).compareTo(typedOther.isSetIs_oos());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetIs_oos()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_oos, typedOther.is_oos);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
439
    }
7281 kshitij.so 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: // ITEM_ID
458
          if (field.type == org.apache.thrift.protocol.TType.I64) {
459
            this.item_id = iprot.readI64();
460
            setItem_idIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // AVAILABILITY
466
          if (field.type == org.apache.thrift.protocol.TType.I64) {
467
            this.availability = iprot.readI64();
468
            setAvailabilityIsSet(true);
469
          } else { 
470
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
471
          }
472
          break;
473
        case 3: // RESERVED
474
          if (field.type == org.apache.thrift.protocol.TType.I64) {
475
            this.reserved = iprot.readI64();
476
            setReservedIsSet(true);
477
          } else { 
478
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
479
          }
480
          break;
10450 vikram.rag 481
        case 4: // IS_OOS
482
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
483
            this.is_oos = iprot.readBool();
484
            setIs_oosIsSet(true);
485
          } else { 
486
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
487
          }
488
          break;
7281 kshitij.so 489
        default:
490
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
491
      }
492
      iprot.readFieldEnd();
493
    }
494
    iprot.readStructEnd();
495
    validate();
496
  }
497
 
498
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
499
    validate();
500
 
501
    oprot.writeStructBegin(STRUCT_DESC);
502
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
503
    oprot.writeI64(this.item_id);
504
    oprot.writeFieldEnd();
505
    oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
506
    oprot.writeI64(this.availability);
507
    oprot.writeFieldEnd();
508
    oprot.writeFieldBegin(RESERVED_FIELD_DESC);
509
    oprot.writeI64(this.reserved);
510
    oprot.writeFieldEnd();
10450 vikram.rag 511
    oprot.writeFieldBegin(IS_OOS_FIELD_DESC);
512
    oprot.writeBool(this.is_oos);
513
    oprot.writeFieldEnd();
7281 kshitij.so 514
    oprot.writeFieldStop();
515
    oprot.writeStructEnd();
516
  }
517
 
518
  @Override
519
  public String toString() {
520
    StringBuilder sb = new StringBuilder("AmazonInventorySnapshot(");
521
    boolean first = true;
522
 
523
    sb.append("item_id:");
524
    sb.append(this.item_id);
525
    first = false;
526
    if (!first) sb.append(", ");
527
    sb.append("availability:");
528
    sb.append(this.availability);
529
    first = false;
530
    if (!first) sb.append(", ");
531
    sb.append("reserved:");
532
    sb.append(this.reserved);
533
    first = false;
10450 vikram.rag 534
    if (!first) sb.append(", ");
535
    sb.append("is_oos:");
536
    sb.append(this.is_oos);
537
    first = false;
7281 kshitij.so 538
    sb.append(")");
539
    return sb.toString();
540
  }
541
 
542
  public void validate() throws org.apache.thrift.TException {
543
    // check for required fields
544
  }
545
 
546
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
547
    try {
548
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
549
    } catch (org.apache.thrift.TException te) {
550
      throw new java.io.IOException(te);
551
    }
552
  }
553
 
554
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
555
    try {
556
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
557
      __isset_bit_vector = new BitSet(1);
558
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
559
    } catch (org.apache.thrift.TException te) {
560
      throw new java.io.IOException(te);
561
    }
562
  }
563
 
564
}
565