Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
6031 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 UserWalletHistory implements org.apache.thrift.TBase<UserWalletHistory, UserWalletHistory._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserWalletHistory");
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 WALLET_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("walletId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  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)3);
29
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)4);
30
  private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)5);
31
 
32
  private long id; // required
33
  private long walletId; // required
34
  private long orderId; // required
35
  private long amount; // required
36
  private long timestamp; // 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
    WALLET_ID((short)2, "walletId"),
42
    ORDER_ID((short)3, "orderId"),
43
    AMOUNT((short)4, "amount"),
44
    TIMESTAMP((short)5, "timestamp");
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: // WALLET_ID
62
          return WALLET_ID;
63
        case 3: // ORDER_ID
64
          return ORDER_ID;
65
        case 4: // AMOUNT
66
          return AMOUNT;
67
        case 5: // TIMESTAMP
68
          return TIMESTAMP;
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 __WALLETID_ISSET_ID = 1;
111
  private static final int __ORDERID_ISSET_ID = 2;
112
  private static final int __AMOUNT_ISSET_ID = 3;
113
  private static final int __TIMESTAMP_ISSET_ID = 4;
114
  private BitSet __isset_bit_vector = new BitSet(5);
115
 
116
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
117
  static {
118
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
119
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
120
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
121
    tmpMap.put(_Fields.WALLET_ID, new org.apache.thrift.meta_data.FieldMetaData("walletId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
122
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
123
    tmpMap.put(_Fields.ORDER_ID, new org.apache.thrift.meta_data.FieldMetaData("orderId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
124
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
125
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
126
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
127
    tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
128
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
129
    metaDataMap = Collections.unmodifiableMap(tmpMap);
130
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserWalletHistory.class, metaDataMap);
131
  }
132
 
133
  public UserWalletHistory() {
134
  }
135
 
136
  public UserWalletHistory(
137
    long id,
138
    long walletId,
139
    long orderId,
140
    long amount,
141
    long timestamp)
142
  {
143
    this();
144
    this.id = id;
145
    setIdIsSet(true);
146
    this.walletId = walletId;
147
    setWalletIdIsSet(true);
148
    this.orderId = orderId;
149
    setOrderIdIsSet(true);
150
    this.amount = amount;
151
    setAmountIsSet(true);
152
    this.timestamp = timestamp;
153
    setTimestampIsSet(true);
154
  }
155
 
156
  /**
157
   * Performs a deep copy on <i>other</i>.
158
   */
159
  public UserWalletHistory(UserWalletHistory other) {
160
    __isset_bit_vector.clear();
161
    __isset_bit_vector.or(other.__isset_bit_vector);
162
    this.id = other.id;
163
    this.walletId = other.walletId;
164
    this.orderId = other.orderId;
165
    this.amount = other.amount;
166
    this.timestamp = other.timestamp;
167
  }
168
 
169
  public UserWalletHistory deepCopy() {
170
    return new UserWalletHistory(this);
171
  }
172
 
173
  @Override
174
  public void clear() {
175
    setIdIsSet(false);
176
    this.id = 0;
177
    setWalletIdIsSet(false);
178
    this.walletId = 0;
179
    setOrderIdIsSet(false);
180
    this.orderId = 0;
181
    setAmountIsSet(false);
182
    this.amount = 0;
183
    setTimestampIsSet(false);
184
    this.timestamp = 0;
185
  }
186
 
187
  public long getId() {
188
    return this.id;
189
  }
190
 
191
  public void setId(long id) {
192
    this.id = id;
193
    setIdIsSet(true);
194
  }
195
 
196
  public void unsetId() {
197
    __isset_bit_vector.clear(__ID_ISSET_ID);
198
  }
199
 
200
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
201
  public boolean isSetId() {
202
    return __isset_bit_vector.get(__ID_ISSET_ID);
203
  }
204
 
205
  public void setIdIsSet(boolean value) {
206
    __isset_bit_vector.set(__ID_ISSET_ID, value);
207
  }
208
 
209
  public long getWalletId() {
210
    return this.walletId;
211
  }
212
 
213
  public void setWalletId(long walletId) {
214
    this.walletId = walletId;
215
    setWalletIdIsSet(true);
216
  }
217
 
218
  public void unsetWalletId() {
219
    __isset_bit_vector.clear(__WALLETID_ISSET_ID);
220
  }
221
 
222
  /** Returns true if field walletId is set (has been assigned a value) and false otherwise */
223
  public boolean isSetWalletId() {
224
    return __isset_bit_vector.get(__WALLETID_ISSET_ID);
225
  }
226
 
227
  public void setWalletIdIsSet(boolean value) {
228
    __isset_bit_vector.set(__WALLETID_ISSET_ID, value);
229
  }
230
 
231
  public long getOrderId() {
232
    return this.orderId;
233
  }
234
 
235
  public void setOrderId(long orderId) {
236
    this.orderId = orderId;
237
    setOrderIdIsSet(true);
238
  }
239
 
240
  public void unsetOrderId() {
241
    __isset_bit_vector.clear(__ORDERID_ISSET_ID);
242
  }
243
 
244
  /** Returns true if field orderId is set (has been assigned a value) and false otherwise */
245
  public boolean isSetOrderId() {
246
    return __isset_bit_vector.get(__ORDERID_ISSET_ID);
247
  }
248
 
249
  public void setOrderIdIsSet(boolean value) {
250
    __isset_bit_vector.set(__ORDERID_ISSET_ID, value);
251
  }
252
 
253
  public long getAmount() {
254
    return this.amount;
255
  }
256
 
257
  public void setAmount(long amount) {
258
    this.amount = amount;
259
    setAmountIsSet(true);
260
  }
261
 
262
  public void unsetAmount() {
263
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
264
  }
265
 
266
  /** Returns true if field amount is set (has been assigned a value) and false otherwise */
267
  public boolean isSetAmount() {
268
    return __isset_bit_vector.get(__AMOUNT_ISSET_ID);
269
  }
270
 
271
  public void setAmountIsSet(boolean value) {
272
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
273
  }
274
 
275
  public long getTimestamp() {
276
    return this.timestamp;
277
  }
278
 
279
  public void setTimestamp(long timestamp) {
280
    this.timestamp = timestamp;
281
    setTimestampIsSet(true);
282
  }
283
 
284
  public void unsetTimestamp() {
285
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
286
  }
287
 
288
  /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
289
  public boolean isSetTimestamp() {
290
    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
291
  }
292
 
293
  public void setTimestampIsSet(boolean value) {
294
    __isset_bit_vector.set(__TIMESTAMP_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 WALLET_ID:
308
      if (value == null) {
309
        unsetWalletId();
310
      } else {
311
        setWalletId((Long)value);
312
      }
313
      break;
314
 
315
    case ORDER_ID:
316
      if (value == null) {
317
        unsetOrderId();
318
      } else {
319
        setOrderId((Long)value);
320
      }
321
      break;
322
 
323
    case AMOUNT:
324
      if (value == null) {
325
        unsetAmount();
326
      } else {
327
        setAmount((Long)value);
328
      }
329
      break;
330
 
331
    case TIMESTAMP:
332
      if (value == null) {
333
        unsetTimestamp();
334
      } else {
335
        setTimestamp((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 WALLET_ID:
348
      return Long.valueOf(getWalletId());
349
 
350
    case ORDER_ID:
351
      return Long.valueOf(getOrderId());
352
 
353
    case AMOUNT:
354
      return Long.valueOf(getAmount());
355
 
356
    case TIMESTAMP:
357
      return Long.valueOf(getTimestamp());
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 WALLET_ID:
373
      return isSetWalletId();
374
    case ORDER_ID:
375
      return isSetOrderId();
376
    case AMOUNT:
377
      return isSetAmount();
378
    case TIMESTAMP:
379
      return isSetTimestamp();
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 UserWalletHistory)
389
      return this.equals((UserWalletHistory)that);
390
    return false;
391
  }
392
 
393
  public boolean equals(UserWalletHistory 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_walletId = true;
407
    boolean that_present_walletId = true;
408
    if (this_present_walletId || that_present_walletId) {
409
      if (!(this_present_walletId && that_present_walletId))
410
        return false;
411
      if (this.walletId != that.walletId)
412
        return false;
413
    }
414
 
415
    boolean this_present_orderId = true;
416
    boolean that_present_orderId = true;
417
    if (this_present_orderId || that_present_orderId) {
418
      if (!(this_present_orderId && that_present_orderId))
419
        return false;
420
      if (this.orderId != that.orderId)
421
        return false;
422
    }
423
 
424
    boolean this_present_amount = true;
425
    boolean that_present_amount = true;
426
    if (this_present_amount || that_present_amount) {
427
      if (!(this_present_amount && that_present_amount))
428
        return false;
429
      if (this.amount != that.amount)
430
        return false;
431
    }
432
 
433
    boolean this_present_timestamp = true;
434
    boolean that_present_timestamp = true;
435
    if (this_present_timestamp || that_present_timestamp) {
436
      if (!(this_present_timestamp && that_present_timestamp))
437
        return false;
438
      if (this.timestamp != that.timestamp)
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(UserWalletHistory other) {
451
    if (!getClass().equals(other.getClass())) {
452
      return getClass().getName().compareTo(other.getClass().getName());
453
    }
454
 
455
    int lastComparison = 0;
456
    UserWalletHistory typedOther = (UserWalletHistory)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(isSetWalletId()).compareTo(typedOther.isSetWalletId());
469
    if (lastComparison != 0) {
470
      return lastComparison;
471
    }
472
    if (isSetWalletId()) {
473
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.walletId, typedOther.walletId);
474
      if (lastComparison != 0) {
475
        return lastComparison;
476
      }
477
    }
478
    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(typedOther.isSetOrderId());
479
    if (lastComparison != 0) {
480
      return lastComparison;
481
    }
482
    if (isSetOrderId()) {
483
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orderId, typedOther.orderId);
484
      if (lastComparison != 0) {
485
        return lastComparison;
486
      }
487
    }
488
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
489
    if (lastComparison != 0) {
490
      return lastComparison;
491
    }
492
    if (isSetAmount()) {
493
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
494
      if (lastComparison != 0) {
495
        return lastComparison;
496
      }
497
    }
498
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
499
    if (lastComparison != 0) {
500
      return lastComparison;
501
    }
502
    if (isSetTimestamp()) {
503
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
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: // WALLET_ID
534
          if (field.type == org.apache.thrift.protocol.TType.I64) {
535
            this.walletId = iprot.readI64();
536
            setWalletIdIsSet(true);
537
          } else { 
538
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
539
          }
540
          break;
541
        case 3: // ORDER_ID
542
          if (field.type == org.apache.thrift.protocol.TType.I64) {
543
            this.orderId = iprot.readI64();
544
            setOrderIdIsSet(true);
545
          } else { 
546
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
547
          }
548
          break;
549
        case 4: // AMOUNT
550
          if (field.type == org.apache.thrift.protocol.TType.I64) {
551
            this.amount = iprot.readI64();
552
            setAmountIsSet(true);
553
          } else { 
554
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
555
          }
556
          break;
557
        case 5: // TIMESTAMP
558
          if (field.type == org.apache.thrift.protocol.TType.I64) {
559
            this.timestamp = iprot.readI64();
560
            setTimestampIsSet(true);
561
          } else { 
562
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
563
          }
564
          break;
565
        default:
566
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
567
      }
568
      iprot.readFieldEnd();
569
    }
570
    iprot.readStructEnd();
571
    validate();
572
  }
573
 
574
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
575
    validate();
576
 
577
    oprot.writeStructBegin(STRUCT_DESC);
578
    oprot.writeFieldBegin(ID_FIELD_DESC);
579
    oprot.writeI64(this.id);
580
    oprot.writeFieldEnd();
581
    oprot.writeFieldBegin(WALLET_ID_FIELD_DESC);
582
    oprot.writeI64(this.walletId);
583
    oprot.writeFieldEnd();
584
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
585
    oprot.writeI64(this.orderId);
586
    oprot.writeFieldEnd();
587
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
588
    oprot.writeI64(this.amount);
589
    oprot.writeFieldEnd();
590
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
591
    oprot.writeI64(this.timestamp);
592
    oprot.writeFieldEnd();
593
    oprot.writeFieldStop();
594
    oprot.writeStructEnd();
595
  }
596
 
597
  @Override
598
  public String toString() {
599
    StringBuilder sb = new StringBuilder("UserWalletHistory(");
600
    boolean first = true;
601
 
602
    sb.append("id:");
603
    sb.append(this.id);
604
    first = false;
605
    if (!first) sb.append(", ");
606
    sb.append("walletId:");
607
    sb.append(this.walletId);
608
    first = false;
609
    if (!first) sb.append(", ");
610
    sb.append("orderId:");
611
    sb.append(this.orderId);
612
    first = false;
613
    if (!first) sb.append(", ");
614
    sb.append("amount:");
615
    sb.append(this.amount);
616
    first = false;
617
    if (!first) sb.append(", ");
618
    sb.append("timestamp:");
619
    sb.append(this.timestamp);
620
    first = false;
621
    sb.append(")");
622
    return sb.toString();
623
  }
624
 
625
  public void validate() throws org.apache.thrift.TException {
626
    // check for required fields
627
  }
628
 
629
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
630
    try {
631
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
632
    } catch (org.apache.thrift.TException te) {
633
      throw new java.io.IOException(te);
634
    }
635
  }
636
 
637
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
638
    try {
639
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
640
      __isset_bit_vector = new BitSet(1);
641
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
642
    } catch (org.apache.thrift.TException te) {
643
      throw new java.io.IOException(te);
644
    }
645
  }
646
 
647
}
648