Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19247 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 BulkAddInventory implements org.apache.thrift.TBase<BulkAddInventory, BulkAddInventory._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BulkAddInventory");
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 WAREHOUSE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("warehouse_id", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField INVENTORY_FIELD_DESC = new org.apache.thrift.protocol.TField("inventory", org.apache.thrift.protocol.TType.I64, (short)3);
29
 
30
  private long item_id; // required
31
  private long warehouse_id; // required
32
  private long inventory; // required
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"),
37
    WAREHOUSE_ID((short)2, "warehouse_id"),
38
    INVENTORY((short)3, "inventory");
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: // WAREHOUSE_ID
56
          return WAREHOUSE_ID;
57
        case 3: // INVENTORY
58
          return INVENTORY;
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 __WAREHOUSE_ID_ISSET_ID = 1;
101
  private static final int __INVENTORY_ISSET_ID = 2;
102
  private BitSet __isset_bit_vector = new BitSet(3);
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.WAREHOUSE_ID, new org.apache.thrift.meta_data.FieldMetaData("warehouse_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
111
    tmpMap.put(_Fields.INVENTORY, new org.apache.thrift.meta_data.FieldMetaData("inventory", org.apache.thrift.TFieldRequirementType.DEFAULT, 
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BulkAddInventory.class, metaDataMap);
115
  }
116
 
117
  public BulkAddInventory() {
118
  }
119
 
120
  public BulkAddInventory(
121
    long item_id,
122
    long warehouse_id,
123
    long inventory)
124
  {
125
    this();
126
    this.item_id = item_id;
127
    setItem_idIsSet(true);
128
    this.warehouse_id = warehouse_id;
129
    setWarehouse_idIsSet(true);
130
    this.inventory = inventory;
131
    setInventoryIsSet(true);
132
  }
133
 
134
  /**
135
   * Performs a deep copy on <i>other</i>.
136
   */
137
  public BulkAddInventory(BulkAddInventory other) {
138
    __isset_bit_vector.clear();
139
    __isset_bit_vector.or(other.__isset_bit_vector);
140
    this.item_id = other.item_id;
141
    this.warehouse_id = other.warehouse_id;
142
    this.inventory = other.inventory;
143
  }
144
 
145
  public BulkAddInventory deepCopy() {
146
    return new BulkAddInventory(this);
147
  }
148
 
149
  @Override
150
  public void clear() {
151
    setItem_idIsSet(false);
152
    this.item_id = 0;
153
    setWarehouse_idIsSet(false);
154
    this.warehouse_id = 0;
155
    setInventoryIsSet(false);
156
    this.inventory = 0;
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 getWarehouse_id() {
182
    return this.warehouse_id;
183
  }
184
 
185
  public void setWarehouse_id(long warehouse_id) {
186
    this.warehouse_id = warehouse_id;
187
    setWarehouse_idIsSet(true);
188
  }
189
 
190
  public void unsetWarehouse_id() {
191
    __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
192
  }
193
 
194
  /** Returns true if field warehouse_id is set (has been assigned a value) and false otherwise */
195
  public boolean isSetWarehouse_id() {
196
    return __isset_bit_vector.get(__WAREHOUSE_ID_ISSET_ID);
197
  }
198
 
199
  public void setWarehouse_idIsSet(boolean value) {
200
    __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
201
  }
202
 
203
  public long getInventory() {
204
    return this.inventory;
205
  }
206
 
207
  public void setInventory(long inventory) {
208
    this.inventory = inventory;
209
    setInventoryIsSet(true);
210
  }
211
 
212
  public void unsetInventory() {
213
    __isset_bit_vector.clear(__INVENTORY_ISSET_ID);
214
  }
215
 
216
  /** Returns true if field inventory is set (has been assigned a value) and false otherwise */
217
  public boolean isSetInventory() {
218
    return __isset_bit_vector.get(__INVENTORY_ISSET_ID);
219
  }
220
 
221
  public void setInventoryIsSet(boolean value) {
222
    __isset_bit_vector.set(__INVENTORY_ISSET_ID, value);
223
  }
224
 
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 WAREHOUSE_ID:
236
      if (value == null) {
237
        unsetWarehouse_id();
238
      } else {
239
        setWarehouse_id((Long)value);
240
      }
241
      break;
242
 
243
    case INVENTORY:
244
      if (value == null) {
245
        unsetInventory();
246
      } else {
247
        setInventory((Long)value);
248
      }
249
      break;
250
 
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 WAREHOUSE_ID:
260
      return Long.valueOf(getWarehouse_id());
261
 
262
    case INVENTORY:
263
      return Long.valueOf(getInventory());
264
 
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 WAREHOUSE_ID:
279
      return isSetWarehouse_id();
280
    case INVENTORY:
281
      return isSetInventory();
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 BulkAddInventory)
291
      return this.equals((BulkAddInventory)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(BulkAddInventory 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_warehouse_id = true;
309
    boolean that_present_warehouse_id = true;
310
    if (this_present_warehouse_id || that_present_warehouse_id) {
311
      if (!(this_present_warehouse_id && that_present_warehouse_id))
312
        return false;
313
      if (this.warehouse_id != that.warehouse_id)
314
        return false;
315
    }
316
 
317
    boolean this_present_inventory = true;
318
    boolean that_present_inventory = true;
319
    if (this_present_inventory || that_present_inventory) {
320
      if (!(this_present_inventory && that_present_inventory))
321
        return false;
322
      if (this.inventory != that.inventory)
323
        return false;
324
    }
325
 
326
    return true;
327
  }
328
 
329
  @Override
330
  public int hashCode() {
331
    return 0;
332
  }
333
 
334
  public int compareTo(BulkAddInventory other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    BulkAddInventory typedOther = (BulkAddInventory)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(isSetWarehouse_id()).compareTo(typedOther.isSetWarehouse_id());
353
    if (lastComparison != 0) {
354
      return lastComparison;
355
    }
356
    if (isSetWarehouse_id()) {
357
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.warehouse_id, typedOther.warehouse_id);
358
      if (lastComparison != 0) {
359
        return lastComparison;
360
      }
361
    }
362
    lastComparison = Boolean.valueOf(isSetInventory()).compareTo(typedOther.isSetInventory());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetInventory()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inventory, typedOther.inventory);
368
      if (lastComparison != 0) {
369
        return lastComparison;
370
      }
371
    }
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: // WAREHOUSE_ID
398
          if (field.type == org.apache.thrift.protocol.TType.I64) {
399
            this.warehouse_id = iprot.readI64();
400
            setWarehouse_idIsSet(true);
401
          } else { 
402
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
403
          }
404
          break;
405
        case 3: // INVENTORY
406
          if (field.type == org.apache.thrift.protocol.TType.I64) {
407
            this.inventory = iprot.readI64();
408
            setInventoryIsSet(true);
409
          } else { 
410
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
411
          }
412
          break;
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(WAREHOUSE_ID_FIELD_DESC);
430
    oprot.writeI64(this.warehouse_id);
431
    oprot.writeFieldEnd();
432
    oprot.writeFieldBegin(INVENTORY_FIELD_DESC);
433
    oprot.writeI64(this.inventory);
434
    oprot.writeFieldEnd();
435
    oprot.writeFieldStop();
436
    oprot.writeStructEnd();
437
  }
438
 
439
  @Override
440
  public String toString() {
441
    StringBuilder sb = new StringBuilder("BulkAddInventory(");
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("warehouse_id:");
449
    sb.append(this.warehouse_id);
450
    first = false;
451
    if (!first) sb.append(", ");
452
    sb.append("inventory:");
453
    sb.append(this.inventory);
454
    first = false;
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