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);
510 rajveer 31
  private static final TField AIRWAY_BILLNO_FIELD_DESC = new TField("airway_billno", TType.STRING, (short)3);
483 rajveer 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;
510 rajveer 36
  private String airway_billno;
483 rajveer 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;
510 rajveer 100
  private static final int __DELIVERY_ESTIMATE_ISSET_ID = 2;
101
  private BitSet __isset_bit_vector = new BitSet(3);
483 rajveer 102
 
103
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
104
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.I64)));
106
    put(_Fields.PROVIDER_ID, new FieldMetaData("provider_id", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.I64)));
108
    put(_Fields.AIRWAY_BILLNO, new FieldMetaData("airway_billno", TFieldRequirementType.DEFAULT, 
510 rajveer 109
        new FieldValueMetaData(TType.STRING)));
483 rajveer 110
    put(_Fields.DELIVERY_ESTIMATE, new FieldMetaData("delivery_estimate", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.I64)));
112
  }});
113
 
114
  static {
115
    FieldMetaData.addStructMetaDataMap(LogisticsInfo.class, metaDataMap);
116
  }
117
 
118
  public LogisticsInfo() {
119
  }
120
 
121
  public LogisticsInfo(
122
    long warehouse_id,
123
    long provider_id,
510 rajveer 124
    String airway_billno,
483 rajveer 125
    long delivery_estimate)
126
  {
127
    this();
128
    this.warehouse_id = warehouse_id;
129
    setWarehouse_idIsSet(true);
130
    this.provider_id = provider_id;
131
    setProvider_idIsSet(true);
132
    this.airway_billno = airway_billno;
133
    this.delivery_estimate = delivery_estimate;
134
    setDelivery_estimateIsSet(true);
135
  }
136
 
137
  /**
138
   * Performs a deep copy on <i>other</i>.
139
   */
140
  public LogisticsInfo(LogisticsInfo other) {
141
    __isset_bit_vector.clear();
142
    __isset_bit_vector.or(other.__isset_bit_vector);
143
    this.warehouse_id = other.warehouse_id;
144
    this.provider_id = other.provider_id;
510 rajveer 145
    if (other.isSetAirway_billno()) {
146
      this.airway_billno = other.airway_billno;
147
    }
483 rajveer 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
 
510 rajveer 206
  public String getAirway_billno() {
483 rajveer 207
    return this.airway_billno;
208
  }
209
 
510 rajveer 210
  public LogisticsInfo setAirway_billno(String airway_billno) {
483 rajveer 211
    this.airway_billno = airway_billno;
212
    return this;
213
  }
214
 
215
  public void unsetAirway_billno() {
510 rajveer 216
    this.airway_billno = null;
483 rajveer 217
  }
218
 
219
  /** Returns true if field airway_billno is set (has been asigned a value) and false otherwise */
220
  public boolean isSetAirway_billno() {
510 rajveer 221
    return this.airway_billno != null;
483 rajveer 222
  }
223
 
224
  public void setAirway_billnoIsSet(boolean value) {
510 rajveer 225
    if (!value) {
226
      this.airway_billno = null;
227
    }
483 rajveer 228
  }
229
 
230
  public long getDelivery_estimate() {
231
    return this.delivery_estimate;
232
  }
233
 
234
  public LogisticsInfo setDelivery_estimate(long delivery_estimate) {
235
    this.delivery_estimate = delivery_estimate;
236
    setDelivery_estimateIsSet(true);
237
    return this;
238
  }
239
 
240
  public void unsetDelivery_estimate() {
241
    __isset_bit_vector.clear(__DELIVERY_ESTIMATE_ISSET_ID);
242
  }
243
 
244
  /** Returns true if field delivery_estimate is set (has been asigned a value) and false otherwise */
245
  public boolean isSetDelivery_estimate() {
246
    return __isset_bit_vector.get(__DELIVERY_ESTIMATE_ISSET_ID);
247
  }
248
 
249
  public void setDelivery_estimateIsSet(boolean value) {
250
    __isset_bit_vector.set(__DELIVERY_ESTIMATE_ISSET_ID, value);
251
  }
252
 
253
  public void setFieldValue(_Fields field, Object value) {
254
    switch (field) {
255
    case WAREHOUSE_ID:
256
      if (value == null) {
257
        unsetWarehouse_id();
258
      } else {
259
        setWarehouse_id((Long)value);
260
      }
261
      break;
262
 
263
    case PROVIDER_ID:
264
      if (value == null) {
265
        unsetProvider_id();
266
      } else {
267
        setProvider_id((Long)value);
268
      }
269
      break;
270
 
271
    case AIRWAY_BILLNO:
272
      if (value == null) {
273
        unsetAirway_billno();
274
      } else {
510 rajveer 275
        setAirway_billno((String)value);
483 rajveer 276
      }
277
      break;
278
 
279
    case DELIVERY_ESTIMATE:
280
      if (value == null) {
281
        unsetDelivery_estimate();
282
      } else {
283
        setDelivery_estimate((Long)value);
284
      }
285
      break;
286
 
287
    }
288
  }
289
 
290
  public void setFieldValue(int fieldID, Object value) {
291
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
292
  }
293
 
294
  public Object getFieldValue(_Fields field) {
295
    switch (field) {
296
    case WAREHOUSE_ID:
297
      return new Long(getWarehouse_id());
298
 
299
    case PROVIDER_ID:
300
      return new Long(getProvider_id());
301
 
302
    case AIRWAY_BILLNO:
510 rajveer 303
      return getAirway_billno();
483 rajveer 304
 
305
    case DELIVERY_ESTIMATE:
306
      return new Long(getDelivery_estimate());
307
 
308
    }
309
    throw new IllegalStateException();
310
  }
311
 
312
  public Object getFieldValue(int fieldId) {
313
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    switch (field) {
319
    case WAREHOUSE_ID:
320
      return isSetWarehouse_id();
321
    case PROVIDER_ID:
322
      return isSetProvider_id();
323
    case AIRWAY_BILLNO:
324
      return isSetAirway_billno();
325
    case DELIVERY_ESTIMATE:
326
      return isSetDelivery_estimate();
327
    }
328
    throw new IllegalStateException();
329
  }
330
 
331
  public boolean isSet(int fieldID) {
332
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof LogisticsInfo)
340
      return this.equals((LogisticsInfo)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(LogisticsInfo that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_warehouse_id = true;
349
    boolean that_present_warehouse_id = true;
350
    if (this_present_warehouse_id || that_present_warehouse_id) {
351
      if (!(this_present_warehouse_id && that_present_warehouse_id))
352
        return false;
353
      if (this.warehouse_id != that.warehouse_id)
354
        return false;
355
    }
356
 
357
    boolean this_present_provider_id = true;
358
    boolean that_present_provider_id = true;
359
    if (this_present_provider_id || that_present_provider_id) {
360
      if (!(this_present_provider_id && that_present_provider_id))
361
        return false;
362
      if (this.provider_id != that.provider_id)
363
        return false;
364
    }
365
 
510 rajveer 366
    boolean this_present_airway_billno = true && this.isSetAirway_billno();
367
    boolean that_present_airway_billno = true && that.isSetAirway_billno();
483 rajveer 368
    if (this_present_airway_billno || that_present_airway_billno) {
369
      if (!(this_present_airway_billno && that_present_airway_billno))
370
        return false;
510 rajveer 371
      if (!this.airway_billno.equals(that.airway_billno))
483 rajveer 372
        return false;
373
    }
374
 
375
    boolean this_present_delivery_estimate = true;
376
    boolean that_present_delivery_estimate = true;
377
    if (this_present_delivery_estimate || that_present_delivery_estimate) {
378
      if (!(this_present_delivery_estimate && that_present_delivery_estimate))
379
        return false;
380
      if (this.delivery_estimate != that.delivery_estimate)
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(LogisticsInfo other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    LogisticsInfo typedOther = (LogisticsInfo)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
405
    if (lastComparison != 0) {
406
      return lastComparison;
407
    }
408
    lastComparison = Boolean.valueOf(isSetProvider_id()).compareTo(isSetProvider_id());
409
    if (lastComparison != 0) {
410
      return lastComparison;
411
    }
412
    lastComparison = TBaseHelper.compareTo(provider_id, typedOther.provider_id);
413
    if (lastComparison != 0) {
414
      return lastComparison;
415
    }
416
    lastComparison = Boolean.valueOf(isSetAirway_billno()).compareTo(isSetAirway_billno());
417
    if (lastComparison != 0) {
418
      return lastComparison;
419
    }
420
    lastComparison = TBaseHelper.compareTo(airway_billno, typedOther.airway_billno);
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    lastComparison = Boolean.valueOf(isSetDelivery_estimate()).compareTo(isSetDelivery_estimate());
425
    if (lastComparison != 0) {
426
      return lastComparison;
427
    }
428
    lastComparison = TBaseHelper.compareTo(delivery_estimate, typedOther.delivery_estimate);
429
    if (lastComparison != 0) {
430
      return lastComparison;
431
    }
432
    return 0;
433
  }
434
 
435
  public void read(TProtocol iprot) throws TException {
436
    TField field;
437
    iprot.readStructBegin();
438
    while (true)
439
    {
440
      field = iprot.readFieldBegin();
441
      if (field.type == TType.STOP) { 
442
        break;
443
      }
444
      _Fields fieldId = _Fields.findByThriftId(field.id);
445
      if (fieldId == null) {
446
        TProtocolUtil.skip(iprot, field.type);
447
      } else {
448
        switch (fieldId) {
449
          case WAREHOUSE_ID:
450
            if (field.type == TType.I64) {
451
              this.warehouse_id = iprot.readI64();
452
              setWarehouse_idIsSet(true);
453
            } else { 
454
              TProtocolUtil.skip(iprot, field.type);
455
            }
456
            break;
457
          case PROVIDER_ID:
458
            if (field.type == TType.I64) {
459
              this.provider_id = iprot.readI64();
460
              setProvider_idIsSet(true);
461
            } else { 
462
              TProtocolUtil.skip(iprot, field.type);
463
            }
464
            break;
465
          case AIRWAY_BILLNO:
510 rajveer 466
            if (field.type == TType.STRING) {
467
              this.airway_billno = iprot.readString();
483 rajveer 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();
510 rajveer 498
    if (this.airway_billno != null) {
499
      oprot.writeFieldBegin(AIRWAY_BILLNO_FIELD_DESC);
500
      oprot.writeString(this.airway_billno);
501
      oprot.writeFieldEnd();
502
    }
483 rajveer 503
    oprot.writeFieldBegin(DELIVERY_ESTIMATE_FIELD_DESC);
504
    oprot.writeI64(this.delivery_estimate);
505
    oprot.writeFieldEnd();
506
    oprot.writeFieldStop();
507
    oprot.writeStructEnd();
508
  }
509
 
510
  @Override
511
  public String toString() {
512
    StringBuilder sb = new StringBuilder("LogisticsInfo(");
513
    boolean first = true;
514
 
515
    sb.append("warehouse_id:");
516
    sb.append(this.warehouse_id);
517
    first = false;
518
    if (!first) sb.append(", ");
519
    sb.append("provider_id:");
520
    sb.append(this.provider_id);
521
    first = false;
522
    if (!first) sb.append(", ");
523
    sb.append("airway_billno:");
510 rajveer 524
    if (this.airway_billno == null) {
525
      sb.append("null");
526
    } else {
527
      sb.append(this.airway_billno);
528
    }
483 rajveer 529
    first = false;
530
    if (!first) sb.append(", ");
531
    sb.append("delivery_estimate:");
532
    sb.append(this.delivery_estimate);
533
    first = false;
534
    sb.append(")");
535
    return sb.toString();
536
  }
537
 
538
  public void validate() throws TException {
539
    // check for required fields
540
  }
541
 
542
}
543