Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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