Subversion Repositories SmartDukaan

Rev

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