Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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