Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10546 vikram.rag 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 SnapdealStockAtEOD implements org.apache.thrift.TBase<SnapdealStockAtEOD, SnapdealStockAtEOD._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SnapdealStockAtEOD");
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 DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("date", org.apache.thrift.protocol.TType.I64, (short)3);
29
 
30
  private long item_id; // required
31
  private long availability; // required
32
  private long date; // 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
    AVAILABILITY((short)2, "availability"),
38
    DATE((short)3, "date");
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;
57
        case 3: // DATE
58
          return DATE;
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;
101
  private static final int __DATE_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.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)));
111
    tmpMap.put(_Fields.DATE, new org.apache.thrift.meta_data.FieldMetaData("date", 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(SnapdealStockAtEOD.class, metaDataMap);
115
  }
116
 
117
  public SnapdealStockAtEOD() {
118
  }
119
 
120
  public SnapdealStockAtEOD(
121
    long item_id,
122
    long availability,
123
    long date)
124
  {
125
    this();
126
    this.item_id = item_id;
127
    setItem_idIsSet(true);
128
    this.availability = availability;
129
    setAvailabilityIsSet(true);
130
    this.date = date;
131
    setDateIsSet(true);
132
  }
133
 
134
  /**
135
   * Performs a deep copy on <i>other</i>.
136
   */
137
  public SnapdealStockAtEOD(SnapdealStockAtEOD 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;
142
    this.date = other.date;
143
  }
144
 
145
  public SnapdealStockAtEOD deepCopy() {
146
    return new SnapdealStockAtEOD(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;
155
    setDateIsSet(false);
156
    this.date = 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 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
 
203
  public long getDate() {
204
    return this.date;
205
  }
206
 
207
  public void setDate(long date) {
208
    this.date = date;
209
    setDateIsSet(true);
210
  }
211
 
212
  public void unsetDate() {
213
    __isset_bit_vector.clear(__DATE_ISSET_ID);
214
  }
215
 
216
  /** Returns true if field date is set (has been assigned a value) and false otherwise */
217
  public boolean isSetDate() {
218
    return __isset_bit_vector.get(__DATE_ISSET_ID);
219
  }
220
 
221
  public void setDateIsSet(boolean value) {
222
    __isset_bit_vector.set(__DATE_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 AVAILABILITY:
236
      if (value == null) {
237
        unsetAvailability();
238
      } else {
239
        setAvailability((Long)value);
240
      }
241
      break;
242
 
243
    case DATE:
244
      if (value == null) {
245
        unsetDate();
246
      } else {
247
        setDate((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 AVAILABILITY:
260
      return Long.valueOf(getAvailability());
261
 
262
    case DATE:
263
      return Long.valueOf(getDate());
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 AVAILABILITY:
279
      return isSetAvailability();
280
    case DATE:
281
      return isSetDate();
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 SnapdealStockAtEOD)
291
      return this.equals((SnapdealStockAtEOD)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(SnapdealStockAtEOD 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
 
317
    boolean this_present_date = true;
318
    boolean that_present_date = true;
319
    if (this_present_date || that_present_date) {
320
      if (!(this_present_date && that_present_date))
321
        return false;
322
      if (this.date != that.date)
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(SnapdealStockAtEOD other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    SnapdealStockAtEOD typedOther = (SnapdealStockAtEOD)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
    }
362
    lastComparison = Boolean.valueOf(isSetDate()).compareTo(typedOther.isSetDate());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetDate()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.date, typedOther.date);
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: // 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;
405
        case 3: // DATE
406
          if (field.type == org.apache.thrift.protocol.TType.I64) {
407
            this.date = iprot.readI64();
408
            setDateIsSet(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(AVAILABILITY_FIELD_DESC);
430
    oprot.writeI64(this.availability);
431
    oprot.writeFieldEnd();
432
    oprot.writeFieldBegin(DATE_FIELD_DESC);
433
    oprot.writeI64(this.date);
434
    oprot.writeFieldEnd();
435
    oprot.writeFieldStop();
436
    oprot.writeStructEnd();
437
  }
438
 
439
  @Override
440
  public String toString() {
441
    StringBuilder sb = new StringBuilder("SnapdealStockAtEOD(");
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;
451
    if (!first) sb.append(", ");
452
    sb.append("date:");
453
    sb.append(this.date);
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