Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19413 amit.gupta 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 ProviderInfo implements org.apache.thrift.TBase<ProviderInfo, ProviderInfo._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ProviderInfo");
25
 
26
  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)1);
27
  private static final org.apache.thrift.protocol.TField IS_COD_AVAILABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("isCodAvailable", org.apache.thrift.protocol.TType.BOOL, (short)2);
28
  private static final org.apache.thrift.protocol.TField IS_OTG_AVAILABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("isOtgAvailable", org.apache.thrift.protocol.TType.BOOL, (short)3);
29
  private static final org.apache.thrift.protocol.TField DELAY_DAYS_FIELD_DESC = new org.apache.thrift.protocol.TField("delayDays", org.apache.thrift.protocol.TType.I64, (short)4);
30
 
31
  private long providerId; // required
32
  private boolean isCodAvailable; // required
33
  private boolean isOtgAvailable; // required
34
  private long delayDays; // 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
    PROVIDER_ID((short)1, "providerId"),
39
    IS_COD_AVAILABLE((short)2, "isCodAvailable"),
40
    IS_OTG_AVAILABLE((short)3, "isOtgAvailable"),
41
    DELAY_DAYS((short)4, "delayDays");
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: // PROVIDER_ID
57
          return PROVIDER_ID;
58
        case 2: // IS_COD_AVAILABLE
59
          return IS_COD_AVAILABLE;
60
        case 3: // IS_OTG_AVAILABLE
61
          return IS_OTG_AVAILABLE;
62
        case 4: // DELAY_DAYS
63
          return DELAY_DAYS;
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 __PROVIDERID_ISSET_ID = 0;
105
  private static final int __ISCODAVAILABLE_ISSET_ID = 1;
106
  private static final int __ISOTGAVAILABLE_ISSET_ID = 2;
107
  private static final int __DELAYDAYS_ISSET_ID = 3;
108
  private BitSet __isset_bit_vector = new BitSet(4);
109
 
110
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
111
  static {
112
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
113
    tmpMap.put(_Fields.PROVIDER_ID, new org.apache.thrift.meta_data.FieldMetaData("providerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
114
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
115
    tmpMap.put(_Fields.IS_COD_AVAILABLE, new org.apache.thrift.meta_data.FieldMetaData("isCodAvailable", org.apache.thrift.TFieldRequirementType.DEFAULT, 
116
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
117
    tmpMap.put(_Fields.IS_OTG_AVAILABLE, new org.apache.thrift.meta_data.FieldMetaData("isOtgAvailable", org.apache.thrift.TFieldRequirementType.DEFAULT, 
118
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
119
    tmpMap.put(_Fields.DELAY_DAYS, new org.apache.thrift.meta_data.FieldMetaData("delayDays", org.apache.thrift.TFieldRequirementType.DEFAULT, 
120
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
121
    metaDataMap = Collections.unmodifiableMap(tmpMap);
122
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ProviderInfo.class, metaDataMap);
123
  }
124
 
125
  public ProviderInfo() {
126
  }
127
 
128
  public ProviderInfo(
129
    long providerId,
130
    boolean isCodAvailable,
131
    boolean isOtgAvailable,
132
    long delayDays)
133
  {
134
    this();
135
    this.providerId = providerId;
136
    setProviderIdIsSet(true);
137
    this.isCodAvailable = isCodAvailable;
138
    setIsCodAvailableIsSet(true);
139
    this.isOtgAvailable = isOtgAvailable;
140
    setIsOtgAvailableIsSet(true);
141
    this.delayDays = delayDays;
142
    setDelayDaysIsSet(true);
143
  }
144
 
145
  /**
146
   * Performs a deep copy on <i>other</i>.
147
   */
148
  public ProviderInfo(ProviderInfo other) {
149
    __isset_bit_vector.clear();
150
    __isset_bit_vector.or(other.__isset_bit_vector);
151
    this.providerId = other.providerId;
152
    this.isCodAvailable = other.isCodAvailable;
153
    this.isOtgAvailable = other.isOtgAvailable;
154
    this.delayDays = other.delayDays;
155
  }
156
 
157
  public ProviderInfo deepCopy() {
158
    return new ProviderInfo(this);
159
  }
160
 
161
  @Override
162
  public void clear() {
163
    setProviderIdIsSet(false);
164
    this.providerId = 0;
165
    setIsCodAvailableIsSet(false);
166
    this.isCodAvailable = false;
167
    setIsOtgAvailableIsSet(false);
168
    this.isOtgAvailable = false;
169
    setDelayDaysIsSet(false);
170
    this.delayDays = 0;
171
  }
172
 
173
  public long getProviderId() {
174
    return this.providerId;
175
  }
176
 
177
  public void setProviderId(long providerId) {
178
    this.providerId = providerId;
179
    setProviderIdIsSet(true);
180
  }
181
 
182
  public void unsetProviderId() {
183
    __isset_bit_vector.clear(__PROVIDERID_ISSET_ID);
184
  }
185
 
186
  /** Returns true if field providerId is set (has been assigned a value) and false otherwise */
187
  public boolean isSetProviderId() {
188
    return __isset_bit_vector.get(__PROVIDERID_ISSET_ID);
189
  }
190
 
191
  public void setProviderIdIsSet(boolean value) {
192
    __isset_bit_vector.set(__PROVIDERID_ISSET_ID, value);
193
  }
194
 
195
  public boolean isIsCodAvailable() {
196
    return this.isCodAvailable;
197
  }
198
 
199
  public void setIsCodAvailable(boolean isCodAvailable) {
200
    this.isCodAvailable = isCodAvailable;
201
    setIsCodAvailableIsSet(true);
202
  }
203
 
204
  public void unsetIsCodAvailable() {
205
    __isset_bit_vector.clear(__ISCODAVAILABLE_ISSET_ID);
206
  }
207
 
208
  /** Returns true if field isCodAvailable is set (has been assigned a value) and false otherwise */
209
  public boolean isSetIsCodAvailable() {
210
    return __isset_bit_vector.get(__ISCODAVAILABLE_ISSET_ID);
211
  }
212
 
213
  public void setIsCodAvailableIsSet(boolean value) {
214
    __isset_bit_vector.set(__ISCODAVAILABLE_ISSET_ID, value);
215
  }
216
 
217
  public boolean isIsOtgAvailable() {
218
    return this.isOtgAvailable;
219
  }
220
 
221
  public void setIsOtgAvailable(boolean isOtgAvailable) {
222
    this.isOtgAvailable = isOtgAvailable;
223
    setIsOtgAvailableIsSet(true);
224
  }
225
 
226
  public void unsetIsOtgAvailable() {
227
    __isset_bit_vector.clear(__ISOTGAVAILABLE_ISSET_ID);
228
  }
229
 
230
  /** Returns true if field isOtgAvailable is set (has been assigned a value) and false otherwise */
231
  public boolean isSetIsOtgAvailable() {
232
    return __isset_bit_vector.get(__ISOTGAVAILABLE_ISSET_ID);
233
  }
234
 
235
  public void setIsOtgAvailableIsSet(boolean value) {
236
    __isset_bit_vector.set(__ISOTGAVAILABLE_ISSET_ID, value);
237
  }
238
 
239
  public long getDelayDays() {
240
    return this.delayDays;
241
  }
242
 
243
  public void setDelayDays(long delayDays) {
244
    this.delayDays = delayDays;
245
    setDelayDaysIsSet(true);
246
  }
247
 
248
  public void unsetDelayDays() {
249
    __isset_bit_vector.clear(__DELAYDAYS_ISSET_ID);
250
  }
251
 
252
  /** Returns true if field delayDays is set (has been assigned a value) and false otherwise */
253
  public boolean isSetDelayDays() {
254
    return __isset_bit_vector.get(__DELAYDAYS_ISSET_ID);
255
  }
256
 
257
  public void setDelayDaysIsSet(boolean value) {
258
    __isset_bit_vector.set(__DELAYDAYS_ISSET_ID, value);
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case PROVIDER_ID:
264
      if (value == null) {
265
        unsetProviderId();
266
      } else {
267
        setProviderId((Long)value);
268
      }
269
      break;
270
 
271
    case IS_COD_AVAILABLE:
272
      if (value == null) {
273
        unsetIsCodAvailable();
274
      } else {
275
        setIsCodAvailable((Boolean)value);
276
      }
277
      break;
278
 
279
    case IS_OTG_AVAILABLE:
280
      if (value == null) {
281
        unsetIsOtgAvailable();
282
      } else {
283
        setIsOtgAvailable((Boolean)value);
284
      }
285
      break;
286
 
287
    case DELAY_DAYS:
288
      if (value == null) {
289
        unsetDelayDays();
290
      } else {
291
        setDelayDays((Long)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case PROVIDER_ID:
301
      return Long.valueOf(getProviderId());
302
 
303
    case IS_COD_AVAILABLE:
304
      return Boolean.valueOf(isIsCodAvailable());
305
 
306
    case IS_OTG_AVAILABLE:
307
      return Boolean.valueOf(isIsOtgAvailable());
308
 
309
    case DELAY_DAYS:
310
      return Long.valueOf(getDelayDays());
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 PROVIDER_ID:
324
      return isSetProviderId();
325
    case IS_COD_AVAILABLE:
326
      return isSetIsCodAvailable();
327
    case IS_OTG_AVAILABLE:
328
      return isSetIsOtgAvailable();
329
    case DELAY_DAYS:
330
      return isSetDelayDays();
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 ProviderInfo)
340
      return this.equals((ProviderInfo)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(ProviderInfo that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_providerId = true;
349
    boolean that_present_providerId = true;
350
    if (this_present_providerId || that_present_providerId) {
351
      if (!(this_present_providerId && that_present_providerId))
352
        return false;
353
      if (this.providerId != that.providerId)
354
        return false;
355
    }
356
 
357
    boolean this_present_isCodAvailable = true;
358
    boolean that_present_isCodAvailable = true;
359
    if (this_present_isCodAvailable || that_present_isCodAvailable) {
360
      if (!(this_present_isCodAvailable && that_present_isCodAvailable))
361
        return false;
362
      if (this.isCodAvailable != that.isCodAvailable)
363
        return false;
364
    }
365
 
366
    boolean this_present_isOtgAvailable = true;
367
    boolean that_present_isOtgAvailable = true;
368
    if (this_present_isOtgAvailable || that_present_isOtgAvailable) {
369
      if (!(this_present_isOtgAvailable && that_present_isOtgAvailable))
370
        return false;
371
      if (this.isOtgAvailable != that.isOtgAvailable)
372
        return false;
373
    }
374
 
375
    boolean this_present_delayDays = true;
376
    boolean that_present_delayDays = true;
377
    if (this_present_delayDays || that_present_delayDays) {
378
      if (!(this_present_delayDays && that_present_delayDays))
379
        return false;
380
      if (this.delayDays != that.delayDays)
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(ProviderInfo other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    ProviderInfo typedOther = (ProviderInfo)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetProviderId()).compareTo(typedOther.isSetProviderId());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    if (isSetProviderId()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerId, typedOther.providerId);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
409
    }
410
    lastComparison = Boolean.valueOf(isSetIsCodAvailable()).compareTo(typedOther.isSetIsCodAvailable());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    if (isSetIsCodAvailable()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isCodAvailable, typedOther.isCodAvailable);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
419
    }
420
    lastComparison = Boolean.valueOf(isSetIsOtgAvailable()).compareTo(typedOther.isSetIsOtgAvailable());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetIsOtgAvailable()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOtgAvailable, typedOther.isOtgAvailable);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
430
    lastComparison = Boolean.valueOf(isSetDelayDays()).compareTo(typedOther.isSetDelayDays());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetDelayDays()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delayDays, typedOther.delayDays);
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: // PROVIDER_ID
458
          if (field.type == org.apache.thrift.protocol.TType.I64) {
459
            this.providerId = iprot.readI64();
460
            setProviderIdIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // IS_COD_AVAILABLE
466
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
467
            this.isCodAvailable = iprot.readBool();
468
            setIsCodAvailableIsSet(true);
469
          } else { 
470
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
471
          }
472
          break;
473
        case 3: // IS_OTG_AVAILABLE
474
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
475
            this.isOtgAvailable = iprot.readBool();
476
            setIsOtgAvailableIsSet(true);
477
          } else { 
478
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
479
          }
480
          break;
481
        case 4: // DELAY_DAYS
482
          if (field.type == org.apache.thrift.protocol.TType.I64) {
483
            this.delayDays = iprot.readI64();
484
            setDelayDaysIsSet(true);
485
          } else { 
486
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
487
          }
488
          break;
489
        default:
490
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
491
      }
492
      iprot.readFieldEnd();
493
    }
494
    iprot.readStructEnd();
495
    validate();
496
  }
497
 
498
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
499
    validate();
500
 
501
    oprot.writeStructBegin(STRUCT_DESC);
502
    oprot.writeFieldBegin(PROVIDER_ID_FIELD_DESC);
503
    oprot.writeI64(this.providerId);
504
    oprot.writeFieldEnd();
505
    oprot.writeFieldBegin(IS_COD_AVAILABLE_FIELD_DESC);
506
    oprot.writeBool(this.isCodAvailable);
507
    oprot.writeFieldEnd();
508
    oprot.writeFieldBegin(IS_OTG_AVAILABLE_FIELD_DESC);
509
    oprot.writeBool(this.isOtgAvailable);
510
    oprot.writeFieldEnd();
511
    oprot.writeFieldBegin(DELAY_DAYS_FIELD_DESC);
512
    oprot.writeI64(this.delayDays);
513
    oprot.writeFieldEnd();
514
    oprot.writeFieldStop();
515
    oprot.writeStructEnd();
516
  }
517
 
518
  @Override
519
  public String toString() {
520
    StringBuilder sb = new StringBuilder("ProviderInfo(");
521
    boolean first = true;
522
 
523
    sb.append("providerId:");
524
    sb.append(this.providerId);
525
    first = false;
526
    if (!first) sb.append(", ");
527
    sb.append("isCodAvailable:");
528
    sb.append(this.isCodAvailable);
529
    first = false;
530
    if (!first) sb.append(", ");
531
    sb.append("isOtgAvailable:");
532
    sb.append(this.isOtgAvailable);
533
    first = false;
534
    if (!first) sb.append(", ");
535
    sb.append("delayDays:");
536
    sb.append(this.delayDays);
537
    first = false;
538
    sb.append(")");
539
    return sb.toString();
540
  }
541
 
542
  public void validate() throws org.apache.thrift.TException {
543
    // check for required fields
544
  }
545
 
546
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
547
    try {
548
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
549
    } catch (org.apache.thrift.TException te) {
550
      throw new java.io.IOException(te);
551
    }
552
  }
553
 
554
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
555
    try {
556
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
557
      __isset_bit_vector = new BitSet(1);
558
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
559
    } catch (org.apache.thrift.TException te) {
560
      throw new java.io.IOException(te);
561
    }
562
  }
563
 
564
}
565