Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
483 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 LogisticsInfo implements TBase<LogisticsInfo._Fields>, java.io.Serializable, Cloneable, Comparable<LogisticsInfo> {
27
  private static final TStruct STRUCT_DESC = new TStruct("LogisticsInfo");
28
 
29
  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);
30
  private static final TField PROVIDER_ID_FIELD_DESC = new TField("provider_id", TType.I64, (short)2);
31
  private static final TField AIRWAY_BILLNO_FIELD_DESC = new TField("airway_billno", TType.I64, (short)3);
32
  private static final TField DELIVERY_ESTIMATE_FIELD_DESC = new TField("delivery_estimate", TType.I64, (short)4);
33
 
34
  private long warehouse_id;
35
  private long provider_id;
36
  private long airway_billno;
37
  private long delivery_estimate;
38
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
41
    WAREHOUSE_ID((short)1, "warehouse_id"),
42
    PROVIDER_ID((short)2, "provider_id"),
43
    AIRWAY_BILLNO((short)3, "airway_billno"),
44
    DELIVERY_ESTIMATE((short)4, "delivery_estimate");
45
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byId.put((int)field._thriftId, field);
52
        byName.put(field.getFieldName(), field);
53
      }
54
    }
55
 
56
    /**
57
     * Find the _Fields constant that matches fieldId, or null if its not found.
58
     */
59
    public static _Fields findByThriftId(int fieldId) {
60
      return byId.get(fieldId);
61
    }
62
 
63
    /**
64
     * Find the _Fields constant that matches fieldId, throwing an exception
65
     * if it is not found.
66
     */
67
    public static _Fields findByThriftIdOrThrow(int fieldId) {
68
      _Fields fields = findByThriftId(fieldId);
69
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
70
      return fields;
71
    }
72
 
73
    /**
74
     * Find the _Fields constant that matches name, or null if its not found.
75
     */
76
    public static _Fields findByName(String name) {
77
      return byName.get(name);
78
    }
79
 
80
    private final short _thriftId;
81
    private final String _fieldName;
82
 
83
    _Fields(short thriftId, String fieldName) {
84
      _thriftId = thriftId;
85
      _fieldName = fieldName;
86
    }
87
 
88
    public short getThriftFieldId() {
89
      return _thriftId;
90
    }
91
 
92
    public String getFieldName() {
93
      return _fieldName;
94
    }
95
  }
96
 
97
  // isset id assignments
98
  private static final int __WAREHOUSE_ID_ISSET_ID = 0;
99
  private static final int __PROVIDER_ID_ISSET_ID = 1;
100
  private static final int __AIRWAY_BILLNO_ISSET_ID = 2;
101
  private static final int __DELIVERY_ESTIMATE_ISSET_ID = 3;
102
  private BitSet __isset_bit_vector = new BitSet(4);
103
 
104
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
105
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
106
        new FieldValueMetaData(TType.I64)));
107
    put(_Fields.PROVIDER_ID, new FieldMetaData("provider_id", TFieldRequirementType.DEFAULT, 
108
        new FieldValueMetaData(TType.I64)));
109
    put(_Fields.AIRWAY_BILLNO, new FieldMetaData("airway_billno", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.I64)));
111
    put(_Fields.DELIVERY_ESTIMATE, new FieldMetaData("delivery_estimate", TFieldRequirementType.DEFAULT, 
112
        new FieldValueMetaData(TType.I64)));
113
  }});
114
 
115
  static {
116
    FieldMetaData.addStructMetaDataMap(LogisticsInfo.class, metaDataMap);
117
  }
118
 
119
  public LogisticsInfo() {
120
  }
121
 
122
  public LogisticsInfo(
123
    long warehouse_id,
124
    long provider_id,
125
    long airway_billno,
126
    long delivery_estimate)
127
  {
128
    this();
129
    this.warehouse_id = warehouse_id;
130
    setWarehouse_idIsSet(true);
131
    this.provider_id = provider_id;
132
    setProvider_idIsSet(true);
133
    this.airway_billno = airway_billno;
134
    setAirway_billnoIsSet(true);
135
    this.delivery_estimate = delivery_estimate;
136
    setDelivery_estimateIsSet(true);
137
  }
138
 
139
  /**
140
   * Performs a deep copy on <i>other</i>.
141
   */
142
  public LogisticsInfo(LogisticsInfo other) {
143
    __isset_bit_vector.clear();
144
    __isset_bit_vector.or(other.__isset_bit_vector);
145
    this.warehouse_id = other.warehouse_id;
146
    this.provider_id = other.provider_id;
147
    this.airway_billno = other.airway_billno;
148
    this.delivery_estimate = other.delivery_estimate;
149
  }
150
 
151
  public LogisticsInfo deepCopy() {
152
    return new LogisticsInfo(this);
153
  }
154
 
155
  @Deprecated
156
  public LogisticsInfo clone() {
157
    return new LogisticsInfo(this);
158
  }
159
 
160
  public long getWarehouse_id() {
161
    return this.warehouse_id;
162
  }
163
 
164
  public LogisticsInfo setWarehouse_id(long warehouse_id) {
165
    this.warehouse_id = warehouse_id;
166
    setWarehouse_idIsSet(true);
167
    return this;
168
  }
169
 
170
  public void unsetWarehouse_id() {
171
    __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
172
  }
173
 
174
  /** Returns true if field warehouse_id is set (has been asigned a value) and false otherwise */
175
  public boolean isSetWarehouse_id() {
176
    return __isset_bit_vector.get(__WAREHOUSE_ID_ISSET_ID);
177
  }
178
 
179
  public void setWarehouse_idIsSet(boolean value) {
180
    __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
181
  }
182
 
183
  public long getProvider_id() {
184
    return this.provider_id;
185
  }
186
 
187
  public LogisticsInfo setProvider_id(long provider_id) {
188
    this.provider_id = provider_id;
189
    setProvider_idIsSet(true);
190
    return this;
191
  }
192
 
193
  public void unsetProvider_id() {
194
    __isset_bit_vector.clear(__PROVIDER_ID_ISSET_ID);
195
  }
196
 
197
  /** Returns true if field provider_id is set (has been asigned a value) and false otherwise */
198
  public boolean isSetProvider_id() {
199
    return __isset_bit_vector.get(__PROVIDER_ID_ISSET_ID);
200
  }
201
 
202
  public void setProvider_idIsSet(boolean value) {
203
    __isset_bit_vector.set(__PROVIDER_ID_ISSET_ID, value);
204
  }
205
 
206
  public long getAirway_billno() {
207
    return this.airway_billno;
208
  }
209
 
210
  public LogisticsInfo setAirway_billno(long airway_billno) {
211
    this.airway_billno = airway_billno;
212
    setAirway_billnoIsSet(true);
213
    return this;
214
  }
215
 
216
  public void unsetAirway_billno() {
217
    __isset_bit_vector.clear(__AIRWAY_BILLNO_ISSET_ID);
218
  }
219
 
220
  /** Returns true if field airway_billno is set (has been asigned a value) and false otherwise */
221
  public boolean isSetAirway_billno() {
222
    return __isset_bit_vector.get(__AIRWAY_BILLNO_ISSET_ID);
223
  }
224
 
225
  public void setAirway_billnoIsSet(boolean value) {
226
    __isset_bit_vector.set(__AIRWAY_BILLNO_ISSET_ID, value);
227
  }
228
 
229
  public long getDelivery_estimate() {
230
    return this.delivery_estimate;
231
  }
232
 
233
  public LogisticsInfo setDelivery_estimate(long delivery_estimate) {
234
    this.delivery_estimate = delivery_estimate;
235
    setDelivery_estimateIsSet(true);
236
    return this;
237
  }
238
 
239
  public void unsetDelivery_estimate() {
240
    __isset_bit_vector.clear(__DELIVERY_ESTIMATE_ISSET_ID);
241
  }
242
 
243
  /** Returns true if field delivery_estimate is set (has been asigned a value) and false otherwise */
244
  public boolean isSetDelivery_estimate() {
245
    return __isset_bit_vector.get(__DELIVERY_ESTIMATE_ISSET_ID);
246
  }
247
 
248
  public void setDelivery_estimateIsSet(boolean value) {
249
    __isset_bit_vector.set(__DELIVERY_ESTIMATE_ISSET_ID, value);
250
  }
251
 
252
  public void setFieldValue(_Fields field, Object value) {
253
    switch (field) {
254
    case WAREHOUSE_ID:
255
      if (value == null) {
256
        unsetWarehouse_id();
257
      } else {
258
        setWarehouse_id((Long)value);
259
      }
260
      break;
261
 
262
    case PROVIDER_ID:
263
      if (value == null) {
264
        unsetProvider_id();
265
      } else {
266
        setProvider_id((Long)value);
267
      }
268
      break;
269
 
270
    case AIRWAY_BILLNO:
271
      if (value == null) {
272
        unsetAirway_billno();
273
      } else {
274
        setAirway_billno((Long)value);
275
      }
276
      break;
277
 
278
    case DELIVERY_ESTIMATE:
279
      if (value == null) {
280
        unsetDelivery_estimate();
281
      } else {
282
        setDelivery_estimate((Long)value);
283
      }
284
      break;
285
 
286
    }
287
  }
288
 
289
  public void setFieldValue(int fieldID, Object value) {
290
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
291
  }
292
 
293
  public Object getFieldValue(_Fields field) {
294
    switch (field) {
295
    case WAREHOUSE_ID:
296
      return new Long(getWarehouse_id());
297
 
298
    case PROVIDER_ID:
299
      return new Long(getProvider_id());
300
 
301
    case AIRWAY_BILLNO:
302
      return new Long(getAirway_billno());
303
 
304
    case DELIVERY_ESTIMATE:
305
      return new Long(getDelivery_estimate());
306
 
307
    }
308
    throw new IllegalStateException();
309
  }
310
 
311
  public Object getFieldValue(int fieldId) {
312
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
313
  }
314
 
315
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
316
  public boolean isSet(_Fields field) {
317
    switch (field) {
318
    case WAREHOUSE_ID:
319
      return isSetWarehouse_id();
320
    case PROVIDER_ID:
321
      return isSetProvider_id();
322
    case AIRWAY_BILLNO:
323
      return isSetAirway_billno();
324
    case DELIVERY_ESTIMATE:
325
      return isSetDelivery_estimate();
326
    }
327
    throw new IllegalStateException();
328
  }
329
 
330
  public boolean isSet(int fieldID) {
331
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
332
  }
333
 
334
  @Override
335
  public boolean equals(Object that) {
336
    if (that == null)
337
      return false;
338
    if (that instanceof LogisticsInfo)
339
      return this.equals((LogisticsInfo)that);
340
    return false;
341
  }
342
 
343
  public boolean equals(LogisticsInfo that) {
344
    if (that == null)
345
      return false;
346
 
347
    boolean this_present_warehouse_id = true;
348
    boolean that_present_warehouse_id = true;
349
    if (this_present_warehouse_id || that_present_warehouse_id) {
350
      if (!(this_present_warehouse_id && that_present_warehouse_id))
351
        return false;
352
      if (this.warehouse_id != that.warehouse_id)
353
        return false;
354
    }
355
 
356
    boolean this_present_provider_id = true;
357
    boolean that_present_provider_id = true;
358
    if (this_present_provider_id || that_present_provider_id) {
359
      if (!(this_present_provider_id && that_present_provider_id))
360
        return false;
361
      if (this.provider_id != that.provider_id)
362
        return false;
363
    }
364
 
365
    boolean this_present_airway_billno = true;
366
    boolean that_present_airway_billno = true;
367
    if (this_present_airway_billno || that_present_airway_billno) {
368
      if (!(this_present_airway_billno && that_present_airway_billno))
369
        return false;
370
      if (this.airway_billno != that.airway_billno)
371
        return false;
372
    }
373
 
374
    boolean this_present_delivery_estimate = true;
375
    boolean that_present_delivery_estimate = true;
376
    if (this_present_delivery_estimate || that_present_delivery_estimate) {
377
      if (!(this_present_delivery_estimate && that_present_delivery_estimate))
378
        return false;
379
      if (this.delivery_estimate != that.delivery_estimate)
380
        return false;
381
    }
382
 
383
    return true;
384
  }
385
 
386
  @Override
387
  public int hashCode() {
388
    return 0;
389
  }
390
 
391
  public int compareTo(LogisticsInfo other) {
392
    if (!getClass().equals(other.getClass())) {
393
      return getClass().getName().compareTo(other.getClass().getName());
394
    }
395
 
396
    int lastComparison = 0;
397
    LogisticsInfo typedOther = (LogisticsInfo)other;
398
 
399
    lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
400
    if (lastComparison != 0) {
401
      return lastComparison;
402
    }
403
    lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
404
    if (lastComparison != 0) {
405
      return lastComparison;
406
    }
407
    lastComparison = Boolean.valueOf(isSetProvider_id()).compareTo(isSetProvider_id());
408
    if (lastComparison != 0) {
409
      return lastComparison;
410
    }
411
    lastComparison = TBaseHelper.compareTo(provider_id, typedOther.provider_id);
412
    if (lastComparison != 0) {
413
      return lastComparison;
414
    }
415
    lastComparison = Boolean.valueOf(isSetAirway_billno()).compareTo(isSetAirway_billno());
416
    if (lastComparison != 0) {
417
      return lastComparison;
418
    }
419
    lastComparison = TBaseHelper.compareTo(airway_billno, typedOther.airway_billno);
420
    if (lastComparison != 0) {
421
      return lastComparison;
422
    }
423
    lastComparison = Boolean.valueOf(isSetDelivery_estimate()).compareTo(isSetDelivery_estimate());
424
    if (lastComparison != 0) {
425
      return lastComparison;
426
    }
427
    lastComparison = TBaseHelper.compareTo(delivery_estimate, typedOther.delivery_estimate);
428
    if (lastComparison != 0) {
429
      return lastComparison;
430
    }
431
    return 0;
432
  }
433
 
434
  public void read(TProtocol iprot) throws TException {
435
    TField field;
436
    iprot.readStructBegin();
437
    while (true)
438
    {
439
      field = iprot.readFieldBegin();
440
      if (field.type == TType.STOP) { 
441
        break;
442
      }
443
      _Fields fieldId = _Fields.findByThriftId(field.id);
444
      if (fieldId == null) {
445
        TProtocolUtil.skip(iprot, field.type);
446
      } else {
447
        switch (fieldId) {
448
          case WAREHOUSE_ID:
449
            if (field.type == TType.I64) {
450
              this.warehouse_id = iprot.readI64();
451
              setWarehouse_idIsSet(true);
452
            } else { 
453
              TProtocolUtil.skip(iprot, field.type);
454
            }
455
            break;
456
          case PROVIDER_ID:
457
            if (field.type == TType.I64) {
458
              this.provider_id = iprot.readI64();
459
              setProvider_idIsSet(true);
460
            } else { 
461
              TProtocolUtil.skip(iprot, field.type);
462
            }
463
            break;
464
          case AIRWAY_BILLNO:
465
            if (field.type == TType.I64) {
466
              this.airway_billno = iprot.readI64();
467
              setAirway_billnoIsSet(true);
468
            } else { 
469
              TProtocolUtil.skip(iprot, field.type);
470
            }
471
            break;
472
          case DELIVERY_ESTIMATE:
473
            if (field.type == TType.I64) {
474
              this.delivery_estimate = iprot.readI64();
475
              setDelivery_estimateIsSet(true);
476
            } else { 
477
              TProtocolUtil.skip(iprot, field.type);
478
            }
479
            break;
480
        }
481
        iprot.readFieldEnd();
482
      }
483
    }
484
    iprot.readStructEnd();
485
    validate();
486
  }
487
 
488
  public void write(TProtocol oprot) throws TException {
489
    validate();
490
 
491
    oprot.writeStructBegin(STRUCT_DESC);
492
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
493
    oprot.writeI64(this.warehouse_id);
494
    oprot.writeFieldEnd();
495
    oprot.writeFieldBegin(PROVIDER_ID_FIELD_DESC);
496
    oprot.writeI64(this.provider_id);
497
    oprot.writeFieldEnd();
498
    oprot.writeFieldBegin(AIRWAY_BILLNO_FIELD_DESC);
499
    oprot.writeI64(this.airway_billno);
500
    oprot.writeFieldEnd();
501
    oprot.writeFieldBegin(DELIVERY_ESTIMATE_FIELD_DESC);
502
    oprot.writeI64(this.delivery_estimate);
503
    oprot.writeFieldEnd();
504
    oprot.writeFieldStop();
505
    oprot.writeStructEnd();
506
  }
507
 
508
  @Override
509
  public String toString() {
510
    StringBuilder sb = new StringBuilder("LogisticsInfo(");
511
    boolean first = true;
512
 
513
    sb.append("warehouse_id:");
514
    sb.append(this.warehouse_id);
515
    first = false;
516
    if (!first) sb.append(", ");
517
    sb.append("provider_id:");
518
    sb.append(this.provider_id);
519
    first = false;
520
    if (!first) sb.append(", ");
521
    sb.append("airway_billno:");
522
    sb.append(this.airway_billno);
523
    first = false;
524
    if (!first) sb.append(", ");
525
    sb.append("delivery_estimate:");
526
    sb.append(this.delivery_estimate);
527
    first = false;
528
    sb.append(")");
529
    return sb.toString();
530
  }
531
 
532
  public void validate() throws TException {
533
    // check for required fields
534
  }
535
 
536
}
537