Subversion Repositories SmartDukaan

Rev

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

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