Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
305 ashish 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.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.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 Alert implements TBase<Alert._Fields>, java.io.Serializable, Cloneable, Comparable<Alert> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Alert");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
483 rajveer 30
  private static final TField ORDER_ID_FIELD_DESC = new TField("order_id", TType.I64, (short)2);
305 ashish 31
  private static final TField TYPE_FIELD_DESC = new TField("type", TType.I64, (short)3);
32
  private static final TField TIME_SET_FIELD_DESC = new TField("time_set", TType.I64, (short)4);
33
  private static final TField COMMENT_FIELD_DESC = new TField("comment", TType.STRING, (short)5);
34
  private static final TField TIME_UNSET_FIELD_DESC = new TField("time_unset", TType.I64, (short)6);
35
 
36
  private long id;
483 rajveer 37
  private long order_id;
305 ashish 38
  private long type;
39
  private long time_set;
40
  private String comment;
41
  private long time_unset;
42
 
43
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
44
  public enum _Fields implements TFieldIdEnum {
45
    ID((short)1, "id"),
483 rajveer 46
    ORDER_ID((short)2, "order_id"),
305 ashish 47
    TYPE((short)3, "type"),
48
    TIME_SET((short)4, "time_set"),
49
    COMMENT((short)5, "comment"),
50
    TIME_UNSET((short)6, "time_unset");
51
 
52
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
53
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
54
 
55
    static {
56
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
57
        byId.put((int)field._thriftId, field);
58
        byName.put(field.getFieldName(), field);
59
      }
60
    }
61
 
62
    /**
63
     * Find the _Fields constant that matches fieldId, or null if its not found.
64
     */
65
    public static _Fields findByThriftId(int fieldId) {
66
      return byId.get(fieldId);
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;
483 rajveer 105
  private static final int __ORDER_ID_ISSET_ID = 1;
305 ashish 106
  private static final int __TYPE_ISSET_ID = 2;
107
  private static final int __TIME_SET_ISSET_ID = 3;
108
  private static final int __TIME_UNSET_ISSET_ID = 4;
109
  private BitSet __isset_bit_vector = new BitSet(5);
110
 
111
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
112
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
113
        new FieldValueMetaData(TType.I64)));
483 rajveer 114
    put(_Fields.ORDER_ID, new FieldMetaData("order_id", TFieldRequirementType.DEFAULT, 
305 ashish 115
        new FieldValueMetaData(TType.I64)));
116
    put(_Fields.TYPE, new FieldMetaData("type", TFieldRequirementType.DEFAULT, 
117
        new FieldValueMetaData(TType.I64)));
118
    put(_Fields.TIME_SET, new FieldMetaData("time_set", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.I64)));
120
    put(_Fields.COMMENT, new FieldMetaData("comment", TFieldRequirementType.DEFAULT, 
121
        new FieldValueMetaData(TType.STRING)));
122
    put(_Fields.TIME_UNSET, new FieldMetaData("time_unset", TFieldRequirementType.DEFAULT, 
123
        new FieldValueMetaData(TType.I64)));
124
  }});
125
 
126
  static {
127
    FieldMetaData.addStructMetaDataMap(Alert.class, metaDataMap);
128
  }
129
 
130
  public Alert() {
131
  }
132
 
133
  public Alert(
134
    long id,
483 rajveer 135
    long order_id,
305 ashish 136
    long type,
137
    long time_set,
138
    String comment,
139
    long time_unset)
140
  {
141
    this();
142
    this.id = id;
143
    setIdIsSet(true);
483 rajveer 144
    this.order_id = order_id;
145
    setOrder_idIsSet(true);
305 ashish 146
    this.type = type;
147
    setTypeIsSet(true);
148
    this.time_set = time_set;
149
    setTime_setIsSet(true);
150
    this.comment = comment;
151
    this.time_unset = time_unset;
152
    setTime_unsetIsSet(true);
153
  }
154
 
155
  /**
156
   * Performs a deep copy on <i>other</i>.
157
   */
158
  public Alert(Alert other) {
159
    __isset_bit_vector.clear();
160
    __isset_bit_vector.or(other.__isset_bit_vector);
161
    this.id = other.id;
483 rajveer 162
    this.order_id = other.order_id;
305 ashish 163
    this.type = other.type;
164
    this.time_set = other.time_set;
165
    if (other.isSetComment()) {
166
      this.comment = other.comment;
167
    }
168
    this.time_unset = other.time_unset;
169
  }
170
 
171
  public Alert deepCopy() {
172
    return new Alert(this);
173
  }
174
 
175
  @Deprecated
176
  public Alert clone() {
177
    return new Alert(this);
178
  }
179
 
180
  public long getId() {
181
    return this.id;
182
  }
183
 
184
  public Alert setId(long id) {
185
    this.id = id;
186
    setIdIsSet(true);
187
    return this;
188
  }
189
 
190
  public void unsetId() {
191
    __isset_bit_vector.clear(__ID_ISSET_ID);
192
  }
193
 
194
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
195
  public boolean isSetId() {
196
    return __isset_bit_vector.get(__ID_ISSET_ID);
197
  }
198
 
199
  public void setIdIsSet(boolean value) {
200
    __isset_bit_vector.set(__ID_ISSET_ID, value);
201
  }
202
 
483 rajveer 203
  public long getOrder_id() {
204
    return this.order_id;
305 ashish 205
  }
206
 
483 rajveer 207
  public Alert setOrder_id(long order_id) {
208
    this.order_id = order_id;
209
    setOrder_idIsSet(true);
305 ashish 210
    return this;
211
  }
212
 
483 rajveer 213
  public void unsetOrder_id() {
214
    __isset_bit_vector.clear(__ORDER_ID_ISSET_ID);
305 ashish 215
  }
216
 
483 rajveer 217
  /** Returns true if field order_id is set (has been asigned a value) and false otherwise */
218
  public boolean isSetOrder_id() {
219
    return __isset_bit_vector.get(__ORDER_ID_ISSET_ID);
305 ashish 220
  }
221
 
483 rajveer 222
  public void setOrder_idIsSet(boolean value) {
223
    __isset_bit_vector.set(__ORDER_ID_ISSET_ID, value);
305 ashish 224
  }
225
 
226
  public long getType() {
227
    return this.type;
228
  }
229
 
230
  public Alert setType(long type) {
231
    this.type = type;
232
    setTypeIsSet(true);
233
    return this;
234
  }
235
 
236
  public void unsetType() {
237
    __isset_bit_vector.clear(__TYPE_ISSET_ID);
238
  }
239
 
240
  /** Returns true if field type is set (has been asigned a value) and false otherwise */
241
  public boolean isSetType() {
242
    return __isset_bit_vector.get(__TYPE_ISSET_ID);
243
  }
244
 
245
  public void setTypeIsSet(boolean value) {
246
    __isset_bit_vector.set(__TYPE_ISSET_ID, value);
247
  }
248
 
249
  public long getTime_set() {
250
    return this.time_set;
251
  }
252
 
253
  public Alert setTime_set(long time_set) {
254
    this.time_set = time_set;
255
    setTime_setIsSet(true);
256
    return this;
257
  }
258
 
259
  public void unsetTime_set() {
260
    __isset_bit_vector.clear(__TIME_SET_ISSET_ID);
261
  }
262
 
263
  /** Returns true if field time_set is set (has been asigned a value) and false otherwise */
264
  public boolean isSetTime_set() {
265
    return __isset_bit_vector.get(__TIME_SET_ISSET_ID);
266
  }
267
 
268
  public void setTime_setIsSet(boolean value) {
269
    __isset_bit_vector.set(__TIME_SET_ISSET_ID, value);
270
  }
271
 
272
  public String getComment() {
273
    return this.comment;
274
  }
275
 
276
  public Alert setComment(String comment) {
277
    this.comment = comment;
278
    return this;
279
  }
280
 
281
  public void unsetComment() {
282
    this.comment = null;
283
  }
284
 
285
  /** Returns true if field comment is set (has been asigned a value) and false otherwise */
286
  public boolean isSetComment() {
287
    return this.comment != null;
288
  }
289
 
290
  public void setCommentIsSet(boolean value) {
291
    if (!value) {
292
      this.comment = null;
293
    }
294
  }
295
 
296
  public long getTime_unset() {
297
    return this.time_unset;
298
  }
299
 
300
  public Alert setTime_unset(long time_unset) {
301
    this.time_unset = time_unset;
302
    setTime_unsetIsSet(true);
303
    return this;
304
  }
305
 
306
  public void unsetTime_unset() {
307
    __isset_bit_vector.clear(__TIME_UNSET_ISSET_ID);
308
  }
309
 
310
  /** Returns true if field time_unset is set (has been asigned a value) and false otherwise */
311
  public boolean isSetTime_unset() {
312
    return __isset_bit_vector.get(__TIME_UNSET_ISSET_ID);
313
  }
314
 
315
  public void setTime_unsetIsSet(boolean value) {
316
    __isset_bit_vector.set(__TIME_UNSET_ISSET_ID, value);
317
  }
318
 
319
  public void setFieldValue(_Fields field, Object value) {
320
    switch (field) {
321
    case ID:
322
      if (value == null) {
323
        unsetId();
324
      } else {
325
        setId((Long)value);
326
      }
327
      break;
328
 
483 rajveer 329
    case ORDER_ID:
305 ashish 330
      if (value == null) {
483 rajveer 331
        unsetOrder_id();
305 ashish 332
      } else {
483 rajveer 333
        setOrder_id((Long)value);
305 ashish 334
      }
335
      break;
336
 
337
    case TYPE:
338
      if (value == null) {
339
        unsetType();
340
      } else {
341
        setType((Long)value);
342
      }
343
      break;
344
 
345
    case TIME_SET:
346
      if (value == null) {
347
        unsetTime_set();
348
      } else {
349
        setTime_set((Long)value);
350
      }
351
      break;
352
 
353
    case COMMENT:
354
      if (value == null) {
355
        unsetComment();
356
      } else {
357
        setComment((String)value);
358
      }
359
      break;
360
 
361
    case TIME_UNSET:
362
      if (value == null) {
363
        unsetTime_unset();
364
      } else {
365
        setTime_unset((Long)value);
366
      }
367
      break;
368
 
369
    }
370
  }
371
 
372
  public void setFieldValue(int fieldID, Object value) {
373
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
374
  }
375
 
376
  public Object getFieldValue(_Fields field) {
377
    switch (field) {
378
    case ID:
379
      return new Long(getId());
380
 
483 rajveer 381
    case ORDER_ID:
382
      return new Long(getOrder_id());
305 ashish 383
 
384
    case TYPE:
385
      return new Long(getType());
386
 
387
    case TIME_SET:
388
      return new Long(getTime_set());
389
 
390
    case COMMENT:
391
      return getComment();
392
 
393
    case TIME_UNSET:
394
      return new Long(getTime_unset());
395
 
396
    }
397
    throw new IllegalStateException();
398
  }
399
 
400
  public Object getFieldValue(int fieldId) {
401
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
402
  }
403
 
404
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
405
  public boolean isSet(_Fields field) {
406
    switch (field) {
407
    case ID:
408
      return isSetId();
483 rajveer 409
    case ORDER_ID:
410
      return isSetOrder_id();
305 ashish 411
    case TYPE:
412
      return isSetType();
413
    case TIME_SET:
414
      return isSetTime_set();
415
    case COMMENT:
416
      return isSetComment();
417
    case TIME_UNSET:
418
      return isSetTime_unset();
419
    }
420
    throw new IllegalStateException();
421
  }
422
 
423
  public boolean isSet(int fieldID) {
424
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
425
  }
426
 
427
  @Override
428
  public boolean equals(Object that) {
429
    if (that == null)
430
      return false;
431
    if (that instanceof Alert)
432
      return this.equals((Alert)that);
433
    return false;
434
  }
435
 
436
  public boolean equals(Alert that) {
437
    if (that == null)
438
      return false;
439
 
440
    boolean this_present_id = true;
441
    boolean that_present_id = true;
442
    if (this_present_id || that_present_id) {
443
      if (!(this_present_id && that_present_id))
444
        return false;
445
      if (this.id != that.id)
446
        return false;
447
    }
448
 
483 rajveer 449
    boolean this_present_order_id = true;
450
    boolean that_present_order_id = true;
451
    if (this_present_order_id || that_present_order_id) {
452
      if (!(this_present_order_id && that_present_order_id))
305 ashish 453
        return false;
483 rajveer 454
      if (this.order_id != that.order_id)
305 ashish 455
        return false;
456
    }
457
 
458
    boolean this_present_type = true;
459
    boolean that_present_type = true;
460
    if (this_present_type || that_present_type) {
461
      if (!(this_present_type && that_present_type))
462
        return false;
463
      if (this.type != that.type)
464
        return false;
465
    }
466
 
467
    boolean this_present_time_set = true;
468
    boolean that_present_time_set = true;
469
    if (this_present_time_set || that_present_time_set) {
470
      if (!(this_present_time_set && that_present_time_set))
471
        return false;
472
      if (this.time_set != that.time_set)
473
        return false;
474
    }
475
 
476
    boolean this_present_comment = true && this.isSetComment();
477
    boolean that_present_comment = true && that.isSetComment();
478
    if (this_present_comment || that_present_comment) {
479
      if (!(this_present_comment && that_present_comment))
480
        return false;
481
      if (!this.comment.equals(that.comment))
482
        return false;
483
    }
484
 
485
    boolean this_present_time_unset = true;
486
    boolean that_present_time_unset = true;
487
    if (this_present_time_unset || that_present_time_unset) {
488
      if (!(this_present_time_unset && that_present_time_unset))
489
        return false;
490
      if (this.time_unset != that.time_unset)
491
        return false;
492
    }
493
 
494
    return true;
495
  }
496
 
497
  @Override
498
  public int hashCode() {
499
    return 0;
500
  }
501
 
502
  public int compareTo(Alert other) {
503
    if (!getClass().equals(other.getClass())) {
504
      return getClass().getName().compareTo(other.getClass().getName());
505
    }
506
 
507
    int lastComparison = 0;
508
    Alert typedOther = (Alert)other;
509
 
510
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
511
    if (lastComparison != 0) {
512
      return lastComparison;
513
    }
514
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
515
    if (lastComparison != 0) {
516
      return lastComparison;
517
    }
483 rajveer 518
    lastComparison = Boolean.valueOf(isSetOrder_id()).compareTo(isSetOrder_id());
305 ashish 519
    if (lastComparison != 0) {
520
      return lastComparison;
521
    }
483 rajveer 522
    lastComparison = TBaseHelper.compareTo(order_id, typedOther.order_id);
305 ashish 523
    if (lastComparison != 0) {
524
      return lastComparison;
525
    }
526
    lastComparison = Boolean.valueOf(isSetType()).compareTo(isSetType());
527
    if (lastComparison != 0) {
528
      return lastComparison;
529
    }
530
    lastComparison = TBaseHelper.compareTo(type, typedOther.type);
531
    if (lastComparison != 0) {
532
      return lastComparison;
533
    }
534
    lastComparison = Boolean.valueOf(isSetTime_set()).compareTo(isSetTime_set());
535
    if (lastComparison != 0) {
536
      return lastComparison;
537
    }
538
    lastComparison = TBaseHelper.compareTo(time_set, typedOther.time_set);
539
    if (lastComparison != 0) {
540
      return lastComparison;
541
    }
542
    lastComparison = Boolean.valueOf(isSetComment()).compareTo(isSetComment());
543
    if (lastComparison != 0) {
544
      return lastComparison;
545
    }
546
    lastComparison = TBaseHelper.compareTo(comment, typedOther.comment);
547
    if (lastComparison != 0) {
548
      return lastComparison;
549
    }
550
    lastComparison = Boolean.valueOf(isSetTime_unset()).compareTo(isSetTime_unset());
551
    if (lastComparison != 0) {
552
      return lastComparison;
553
    }
554
    lastComparison = TBaseHelper.compareTo(time_unset, typedOther.time_unset);
555
    if (lastComparison != 0) {
556
      return lastComparison;
557
    }
558
    return 0;
559
  }
560
 
561
  public void read(TProtocol iprot) throws TException {
562
    TField field;
563
    iprot.readStructBegin();
564
    while (true)
565
    {
566
      field = iprot.readFieldBegin();
567
      if (field.type == TType.STOP) { 
568
        break;
569
      }
570
      _Fields fieldId = _Fields.findByThriftId(field.id);
571
      if (fieldId == null) {
572
        TProtocolUtil.skip(iprot, field.type);
573
      } else {
574
        switch (fieldId) {
575
          case ID:
576
            if (field.type == TType.I64) {
577
              this.id = iprot.readI64();
578
              setIdIsSet(true);
579
            } else { 
580
              TProtocolUtil.skip(iprot, field.type);
581
            }
582
            break;
483 rajveer 583
          case ORDER_ID:
305 ashish 584
            if (field.type == TType.I64) {
483 rajveer 585
              this.order_id = iprot.readI64();
586
              setOrder_idIsSet(true);
305 ashish 587
            } else { 
588
              TProtocolUtil.skip(iprot, field.type);
589
            }
590
            break;
591
          case TYPE:
592
            if (field.type == TType.I64) {
593
              this.type = iprot.readI64();
594
              setTypeIsSet(true);
595
            } else { 
596
              TProtocolUtil.skip(iprot, field.type);
597
            }
598
            break;
599
          case TIME_SET:
600
            if (field.type == TType.I64) {
601
              this.time_set = iprot.readI64();
602
              setTime_setIsSet(true);
603
            } else { 
604
              TProtocolUtil.skip(iprot, field.type);
605
            }
606
            break;
607
          case COMMENT:
608
            if (field.type == TType.STRING) {
609
              this.comment = iprot.readString();
610
            } else { 
611
              TProtocolUtil.skip(iprot, field.type);
612
            }
613
            break;
614
          case TIME_UNSET:
615
            if (field.type == TType.I64) {
616
              this.time_unset = iprot.readI64();
617
              setTime_unsetIsSet(true);
618
            } else { 
619
              TProtocolUtil.skip(iprot, field.type);
620
            }
621
            break;
622
        }
623
        iprot.readFieldEnd();
624
      }
625
    }
626
    iprot.readStructEnd();
627
    validate();
628
  }
629
 
630
  public void write(TProtocol oprot) throws TException {
631
    validate();
632
 
633
    oprot.writeStructBegin(STRUCT_DESC);
634
    oprot.writeFieldBegin(ID_FIELD_DESC);
635
    oprot.writeI64(this.id);
636
    oprot.writeFieldEnd();
483 rajveer 637
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
638
    oprot.writeI64(this.order_id);
305 ashish 639
    oprot.writeFieldEnd();
640
    oprot.writeFieldBegin(TYPE_FIELD_DESC);
641
    oprot.writeI64(this.type);
642
    oprot.writeFieldEnd();
643
    oprot.writeFieldBegin(TIME_SET_FIELD_DESC);
644
    oprot.writeI64(this.time_set);
645
    oprot.writeFieldEnd();
646
    if (this.comment != null) {
647
      oprot.writeFieldBegin(COMMENT_FIELD_DESC);
648
      oprot.writeString(this.comment);
649
      oprot.writeFieldEnd();
650
    }
651
    oprot.writeFieldBegin(TIME_UNSET_FIELD_DESC);
652
    oprot.writeI64(this.time_unset);
653
    oprot.writeFieldEnd();
654
    oprot.writeFieldStop();
655
    oprot.writeStructEnd();
656
  }
657
 
658
  @Override
659
  public String toString() {
660
    StringBuilder sb = new StringBuilder("Alert(");
661
    boolean first = true;
662
 
663
    sb.append("id:");
664
    sb.append(this.id);
665
    first = false;
666
    if (!first) sb.append(", ");
483 rajveer 667
    sb.append("order_id:");
668
    sb.append(this.order_id);
305 ashish 669
    first = false;
670
    if (!first) sb.append(", ");
671
    sb.append("type:");
672
    sb.append(this.type);
673
    first = false;
674
    if (!first) sb.append(", ");
675
    sb.append("time_set:");
676
    sb.append(this.time_set);
677
    first = false;
678
    if (!first) sb.append(", ");
679
    sb.append("comment:");
680
    if (this.comment == null) {
681
      sb.append("null");
682
    } else {
683
      sb.append(this.comment);
684
    }
685
    first = false;
686
    if (!first) sb.append(", ");
687
    sb.append("time_unset:");
688
    sb.append(this.time_unset);
689
    first = false;
690
    sb.append(")");
691
    return sb.toString();
692
  }
693
 
694
  public void validate() throws TException {
695
    // check for required fields
696
  }
697
 
698
}
699