Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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