Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4386 anupam.sin 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.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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class Awb implements org.apache.thrift.TBase<Awb, Awb._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Awb");
25
 
26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField AWB_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("awbNumber", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField PROVIDER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("providerId", org.apache.thrift.protocol.TType.I64, (short)3);
29
  private static final org.apache.thrift.protocol.TField DELIVERY_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("deliveryType", org.apache.thrift.protocol.TType.STRING, (short)4);
30
 
31
  private long id; // required
32
  private String awbNumber; // required
33
  private long providerId; // required
34
  private String deliveryType; // required
35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
38
    ID((short)1, "id"),
39
    AWB_NUMBER((short)2, "awbNumber"),
40
    PROVIDER_ID((short)3, "providerId"),
41
    DELIVERY_TYPE((short)4, "deliveryType");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
55
      switch(fieldId) {
56
        case 1: // ID
57
          return ID;
58
        case 2: // AWB_NUMBER
59
          return AWB_NUMBER;
60
        case 3: // PROVIDER_ID
61
          return PROVIDER_ID;
62
        case 4: // DELIVERY_TYPE
63
          return DELIVERY_TYPE;
64
        default:
65
          return null;
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __ID_ISSET_ID = 0;
105
  private static final int __PROVIDERID_ISSET_ID = 1;
106
  private BitSet __isset_bit_vector = new BitSet(2);
107
 
108
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
109
  static {
110
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
111
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
113
    tmpMap.put(_Fields.AWB_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("awbNumber", org.apache.thrift.TFieldRequirementType.DEFAULT, 
114
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
115
    tmpMap.put(_Fields.PROVIDER_ID, new org.apache.thrift.meta_data.FieldMetaData("providerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
116
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
117
    tmpMap.put(_Fields.DELIVERY_TYPE, new org.apache.thrift.meta_data.FieldMetaData("deliveryType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
118
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
119
    metaDataMap = Collections.unmodifiableMap(tmpMap);
120
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Awb.class, metaDataMap);
121
  }
122
 
123
  public Awb() {
124
  }
125
 
126
  public Awb(
127
    long id,
128
    String awbNumber,
129
    long providerId,
130
    String deliveryType)
131
  {
132
    this();
133
    this.id = id;
134
    setIdIsSet(true);
135
    this.awbNumber = awbNumber;
136
    this.providerId = providerId;
137
    setProviderIdIsSet(true);
138
    this.deliveryType = deliveryType;
139
  }
140
 
141
  /**
142
   * Performs a deep copy on <i>other</i>.
143
   */
144
  public Awb(Awb other) {
145
    __isset_bit_vector.clear();
146
    __isset_bit_vector.or(other.__isset_bit_vector);
147
    this.id = other.id;
148
    if (other.isSetAwbNumber()) {
149
      this.awbNumber = other.awbNumber;
150
    }
151
    this.providerId = other.providerId;
152
    if (other.isSetDeliveryType()) {
153
      this.deliveryType = other.deliveryType;
154
    }
155
  }
156
 
157
  public Awb deepCopy() {
158
    return new Awb(this);
159
  }
160
 
161
  @Override
162
  public void clear() {
163
    setIdIsSet(false);
164
    this.id = 0;
165
    this.awbNumber = null;
166
    setProviderIdIsSet(false);
167
    this.providerId = 0;
168
    this.deliveryType = null;
169
  }
170
 
171
  public long getId() {
172
    return this.id;
173
  }
174
 
175
  public void setId(long id) {
176
    this.id = id;
177
    setIdIsSet(true);
178
  }
179
 
180
  public void unsetId() {
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
182
  }
183
 
184
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
185
  public boolean isSetId() {
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
187
  }
188
 
189
  public void setIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__ID_ISSET_ID, value);
191
  }
192
 
193
  public String getAwbNumber() {
194
    return this.awbNumber;
195
  }
196
 
197
  public void setAwbNumber(String awbNumber) {
198
    this.awbNumber = awbNumber;
199
  }
200
 
201
  public void unsetAwbNumber() {
202
    this.awbNumber = null;
203
  }
204
 
205
  /** Returns true if field awbNumber is set (has been assigned a value) and false otherwise */
206
  public boolean isSetAwbNumber() {
207
    return this.awbNumber != null;
208
  }
209
 
210
  public void setAwbNumberIsSet(boolean value) {
211
    if (!value) {
212
      this.awbNumber = null;
213
    }
214
  }
215
 
216
  public long getProviderId() {
217
    return this.providerId;
218
  }
219
 
220
  public void setProviderId(long providerId) {
221
    this.providerId = providerId;
222
    setProviderIdIsSet(true);
223
  }
224
 
225
  public void unsetProviderId() {
226
    __isset_bit_vector.clear(__PROVIDERID_ISSET_ID);
227
  }
228
 
229
  /** Returns true if field providerId is set (has been assigned a value) and false otherwise */
230
  public boolean isSetProviderId() {
231
    return __isset_bit_vector.get(__PROVIDERID_ISSET_ID);
232
  }
233
 
234
  public void setProviderIdIsSet(boolean value) {
235
    __isset_bit_vector.set(__PROVIDERID_ISSET_ID, value);
236
  }
237
 
238
  public String getDeliveryType() {
239
    return this.deliveryType;
240
  }
241
 
242
  public void setDeliveryType(String deliveryType) {
243
    this.deliveryType = deliveryType;
244
  }
245
 
246
  public void unsetDeliveryType() {
247
    this.deliveryType = null;
248
  }
249
 
250
  /** Returns true if field deliveryType is set (has been assigned a value) and false otherwise */
251
  public boolean isSetDeliveryType() {
252
    return this.deliveryType != null;
253
  }
254
 
255
  public void setDeliveryTypeIsSet(boolean value) {
256
    if (!value) {
257
      this.deliveryType = null;
258
    }
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case ID:
264
      if (value == null) {
265
        unsetId();
266
      } else {
267
        setId((Long)value);
268
      }
269
      break;
270
 
271
    case AWB_NUMBER:
272
      if (value == null) {
273
        unsetAwbNumber();
274
      } else {
275
        setAwbNumber((String)value);
276
      }
277
      break;
278
 
279
    case PROVIDER_ID:
280
      if (value == null) {
281
        unsetProviderId();
282
      } else {
283
        setProviderId((Long)value);
284
      }
285
      break;
286
 
287
    case DELIVERY_TYPE:
288
      if (value == null) {
289
        unsetDeliveryType();
290
      } else {
291
        setDeliveryType((String)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case ID:
301
      return Long.valueOf(getId());
302
 
303
    case AWB_NUMBER:
304
      return getAwbNumber();
305
 
306
    case PROVIDER_ID:
307
      return Long.valueOf(getProviderId());
308
 
309
    case DELIVERY_TYPE:
310
      return getDeliveryType();
311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
321
 
322
    switch (field) {
323
    case ID:
324
      return isSetId();
325
    case AWB_NUMBER:
326
      return isSetAwbNumber();
327
    case PROVIDER_ID:
328
      return isSetProviderId();
329
    case DELIVERY_TYPE:
330
      return isSetDeliveryType();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof Awb)
340
      return this.equals((Awb)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(Awb that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_id = true;
349
    boolean that_present_id = true;
350
    if (this_present_id || that_present_id) {
351
      if (!(this_present_id && that_present_id))
352
        return false;
353
      if (this.id != that.id)
354
        return false;
355
    }
356
 
357
    boolean this_present_awbNumber = true && this.isSetAwbNumber();
358
    boolean that_present_awbNumber = true && that.isSetAwbNumber();
359
    if (this_present_awbNumber || that_present_awbNumber) {
360
      if (!(this_present_awbNumber && that_present_awbNumber))
361
        return false;
362
      if (!this.awbNumber.equals(that.awbNumber))
363
        return false;
364
    }
365
 
366
    boolean this_present_providerId = true;
367
    boolean that_present_providerId = true;
368
    if (this_present_providerId || that_present_providerId) {
369
      if (!(this_present_providerId && that_present_providerId))
370
        return false;
371
      if (this.providerId != that.providerId)
372
        return false;
373
    }
374
 
375
    boolean this_present_deliveryType = true && this.isSetDeliveryType();
376
    boolean that_present_deliveryType = true && that.isSetDeliveryType();
377
    if (this_present_deliveryType || that_present_deliveryType) {
378
      if (!(this_present_deliveryType && that_present_deliveryType))
379
        return false;
380
      if (!this.deliveryType.equals(that.deliveryType))
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(Awb other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    Awb typedOther = (Awb)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    if (isSetId()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
409
    }
410
    lastComparison = Boolean.valueOf(isSetAwbNumber()).compareTo(typedOther.isSetAwbNumber());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    if (isSetAwbNumber()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.awbNumber, typedOther.awbNumber);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
419
    }
420
    lastComparison = Boolean.valueOf(isSetProviderId()).compareTo(typedOther.isSetProviderId());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetProviderId()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerId, typedOther.providerId);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
430
    lastComparison = Boolean.valueOf(isSetDeliveryType()).compareTo(typedOther.isSetDeliveryType());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetDeliveryType()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deliveryType, typedOther.deliveryType);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
439
    }
440
    return 0;
441
  }
442
 
443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
454
        break;
455
      }
456
      switch (field.id) {
457
        case 1: // ID
458
          if (field.type == org.apache.thrift.protocol.TType.I64) {
459
            this.id = iprot.readI64();
460
            setIdIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // AWB_NUMBER
466
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
467
            this.awbNumber = iprot.readString();
468
          } else { 
469
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
470
          }
471
          break;
472
        case 3: // PROVIDER_ID
473
          if (field.type == org.apache.thrift.protocol.TType.I64) {
474
            this.providerId = iprot.readI64();
475
            setProviderIdIsSet(true);
476
          } else { 
477
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
478
          }
479
          break;
480
        case 4: // DELIVERY_TYPE
481
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
482
            this.deliveryType = iprot.readString();
483
          } else { 
484
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
485
          }
486
          break;
487
        default:
488
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
489
      }
490
      iprot.readFieldEnd();
491
    }
492
    iprot.readStructEnd();
493
    validate();
494
  }
495
 
496
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
497
    validate();
498
 
499
    oprot.writeStructBegin(STRUCT_DESC);
500
    oprot.writeFieldBegin(ID_FIELD_DESC);
501
    oprot.writeI64(this.id);
502
    oprot.writeFieldEnd();
503
    if (this.awbNumber != null) {
504
      oprot.writeFieldBegin(AWB_NUMBER_FIELD_DESC);
505
      oprot.writeString(this.awbNumber);
506
      oprot.writeFieldEnd();
507
    }
508
    oprot.writeFieldBegin(PROVIDER_ID_FIELD_DESC);
509
    oprot.writeI64(this.providerId);
510
    oprot.writeFieldEnd();
511
    if (this.deliveryType != null) {
512
      oprot.writeFieldBegin(DELIVERY_TYPE_FIELD_DESC);
513
      oprot.writeString(this.deliveryType);
514
      oprot.writeFieldEnd();
515
    }
516
    oprot.writeFieldStop();
517
    oprot.writeStructEnd();
518
  }
519
 
520
  @Override
521
  public String toString() {
522
    StringBuilder sb = new StringBuilder("Awb(");
523
    boolean first = true;
524
 
525
    sb.append("id:");
526
    sb.append(this.id);
527
    first = false;
528
    if (!first) sb.append(", ");
529
    sb.append("awbNumber:");
530
    if (this.awbNumber == null) {
531
      sb.append("null");
532
    } else {
533
      sb.append(this.awbNumber);
534
    }
535
    first = false;
536
    if (!first) sb.append(", ");
537
    sb.append("providerId:");
538
    sb.append(this.providerId);
539
    first = false;
540
    if (!first) sb.append(", ");
541
    sb.append("deliveryType:");
542
    if (this.deliveryType == null) {
543
      sb.append("null");
544
    } else {
545
      sb.append(this.deliveryType);
546
    }
547
    first = false;
548
    sb.append(")");
549
    return sb.toString();
550
  }
551
 
552
  public void validate() throws org.apache.thrift.TException {
553
    // check for required fields
554
  }
555
 
556
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
557
    try {
558
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
559
    } catch (org.apache.thrift.TException te) {
560
      throw new java.io.IOException(te);
561
    }
562
  }
563
 
564
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
565
    try {
566
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
567
      __isset_bit_vector = new BitSet(1);
568
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
569
    } catch (org.apache.thrift.TException te) {
570
      throw new java.io.IOException(te);
571
    }
572
  }
573
 
574
}
575