Subversion Repositories SmartDukaan

Rev

Rev 8282 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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