Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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