Subversion Repositories SmartDukaan

Rev

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

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