Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
18794 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.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 PaginatedCreditHistory implements org.apache.thrift.TBase<PaginatedCreditHistory, PaginatedCreditHistory._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PaginatedCreditHistory");
25
 
26
  private static final org.apache.thrift.protocol.TField HAS_MORE_FIELD_DESC = new org.apache.thrift.protocol.TField("hasMore", org.apache.thrift.protocol.TType.BOOL, (short)1);
27
  private static final org.apache.thrift.protocol.TField TOTAL_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalCount", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField CREDIT_HISTORY_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("creditHistoryList", org.apache.thrift.protocol.TType.LIST, (short)3);
29
 
30
  private boolean hasMore; // required
31
  private long totalCount; // required
32
  private List<CreditHistory> creditHistoryList; // required
33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
36
    HAS_MORE((short)1, "hasMore"),
37
    TOTAL_COUNT((short)2, "totalCount"),
38
    CREDIT_HISTORY_LIST((short)3, "creditHistoryList");
39
 
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
 
42
    static {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
44
        byName.put(field.getFieldName(), field);
45
      }
46
    }
47
 
48
    /**
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
50
     */
51
    public static _Fields findByThriftId(int fieldId) {
52
      switch(fieldId) {
53
        case 1: // HAS_MORE
54
          return HAS_MORE;
55
        case 2: // TOTAL_COUNT
56
          return TOTAL_COUNT;
57
        case 3: // CREDIT_HISTORY_LIST
58
          return CREDIT_HISTORY_LIST;
59
        default:
60
          return null;
61
      }
62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches fieldId, throwing an exception
66
     * if it is not found.
67
     */
68
    public static _Fields findByThriftIdOrThrow(int fieldId) {
69
      _Fields fields = findByThriftId(fieldId);
70
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
71
      return fields;
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches name, or null if its not found.
76
     */
77
    public static _Fields findByName(String name) {
78
      return byName.get(name);
79
    }
80
 
81
    private final short _thriftId;
82
    private final String _fieldName;
83
 
84
    _Fields(short thriftId, String fieldName) {
85
      _thriftId = thriftId;
86
      _fieldName = fieldName;
87
    }
88
 
89
    public short getThriftFieldId() {
90
      return _thriftId;
91
    }
92
 
93
    public String getFieldName() {
94
      return _fieldName;
95
    }
96
  }
97
 
98
  // isset id assignments
99
  private static final int __HASMORE_ISSET_ID = 0;
100
  private static final int __TOTALCOUNT_ISSET_ID = 1;
101
  private BitSet __isset_bit_vector = new BitSet(2);
102
 
103
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
104
  static {
105
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
106
    tmpMap.put(_Fields.HAS_MORE, new org.apache.thrift.meta_data.FieldMetaData("hasMore", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
108
    tmpMap.put(_Fields.TOTAL_COUNT, new org.apache.thrift.meta_data.FieldMetaData("totalCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
109
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
110
    tmpMap.put(_Fields.CREDIT_HISTORY_LIST, new org.apache.thrift.meta_data.FieldMetaData("creditHistoryList", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
112
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CreditHistory.class))));
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PaginatedCreditHistory.class, metaDataMap);
115
  }
116
 
117
  public PaginatedCreditHistory() {
118
  }
119
 
120
  public PaginatedCreditHistory(
121
    boolean hasMore,
122
    long totalCount,
123
    List<CreditHistory> creditHistoryList)
124
  {
125
    this();
126
    this.hasMore = hasMore;
127
    setHasMoreIsSet(true);
128
    this.totalCount = totalCount;
129
    setTotalCountIsSet(true);
130
    this.creditHistoryList = creditHistoryList;
131
  }
132
 
133
  /**
134
   * Performs a deep copy on <i>other</i>.
135
   */
136
  public PaginatedCreditHistory(PaginatedCreditHistory other) {
137
    __isset_bit_vector.clear();
138
    __isset_bit_vector.or(other.__isset_bit_vector);
139
    this.hasMore = other.hasMore;
140
    this.totalCount = other.totalCount;
141
    if (other.isSetCreditHistoryList()) {
142
      List<CreditHistory> __this__creditHistoryList = new ArrayList<CreditHistory>();
143
      for (CreditHistory other_element : other.creditHistoryList) {
144
        __this__creditHistoryList.add(new CreditHistory(other_element));
145
      }
146
      this.creditHistoryList = __this__creditHistoryList;
147
    }
148
  }
149
 
150
  public PaginatedCreditHistory deepCopy() {
151
    return new PaginatedCreditHistory(this);
152
  }
153
 
154
  @Override
155
  public void clear() {
156
    setHasMoreIsSet(false);
157
    this.hasMore = false;
158
    setTotalCountIsSet(false);
159
    this.totalCount = 0;
160
    this.creditHistoryList = null;
161
  }
162
 
163
  public boolean isHasMore() {
164
    return this.hasMore;
165
  }
166
 
167
  public void setHasMore(boolean hasMore) {
168
    this.hasMore = hasMore;
169
    setHasMoreIsSet(true);
170
  }
171
 
172
  public void unsetHasMore() {
173
    __isset_bit_vector.clear(__HASMORE_ISSET_ID);
174
  }
175
 
176
  /** Returns true if field hasMore is set (has been assigned a value) and false otherwise */
177
  public boolean isSetHasMore() {
178
    return __isset_bit_vector.get(__HASMORE_ISSET_ID);
179
  }
180
 
181
  public void setHasMoreIsSet(boolean value) {
182
    __isset_bit_vector.set(__HASMORE_ISSET_ID, value);
183
  }
184
 
185
  public long getTotalCount() {
186
    return this.totalCount;
187
  }
188
 
189
  public void setTotalCount(long totalCount) {
190
    this.totalCount = totalCount;
191
    setTotalCountIsSet(true);
192
  }
193
 
194
  public void unsetTotalCount() {
195
    __isset_bit_vector.clear(__TOTALCOUNT_ISSET_ID);
196
  }
197
 
198
  /** Returns true if field totalCount is set (has been assigned a value) and false otherwise */
199
  public boolean isSetTotalCount() {
200
    return __isset_bit_vector.get(__TOTALCOUNT_ISSET_ID);
201
  }
202
 
203
  public void setTotalCountIsSet(boolean value) {
204
    __isset_bit_vector.set(__TOTALCOUNT_ISSET_ID, value);
205
  }
206
 
207
  public int getCreditHistoryListSize() {
208
    return (this.creditHistoryList == null) ? 0 : this.creditHistoryList.size();
209
  }
210
 
211
  public java.util.Iterator<CreditHistory> getCreditHistoryListIterator() {
212
    return (this.creditHistoryList == null) ? null : this.creditHistoryList.iterator();
213
  }
214
 
215
  public void addToCreditHistoryList(CreditHistory elem) {
216
    if (this.creditHistoryList == null) {
217
      this.creditHistoryList = new ArrayList<CreditHistory>();
218
    }
219
    this.creditHistoryList.add(elem);
220
  }
221
 
222
  public List<CreditHistory> getCreditHistoryList() {
223
    return this.creditHistoryList;
224
  }
225
 
226
  public void setCreditHistoryList(List<CreditHistory> creditHistoryList) {
227
    this.creditHistoryList = creditHistoryList;
228
  }
229
 
230
  public void unsetCreditHistoryList() {
231
    this.creditHistoryList = null;
232
  }
233
 
234
  /** Returns true if field creditHistoryList is set (has been assigned a value) and false otherwise */
235
  public boolean isSetCreditHistoryList() {
236
    return this.creditHistoryList != null;
237
  }
238
 
239
  public void setCreditHistoryListIsSet(boolean value) {
240
    if (!value) {
241
      this.creditHistoryList = null;
242
    }
243
  }
244
 
245
  public void setFieldValue(_Fields field, Object value) {
246
    switch (field) {
247
    case HAS_MORE:
248
      if (value == null) {
249
        unsetHasMore();
250
      } else {
251
        setHasMore((Boolean)value);
252
      }
253
      break;
254
 
255
    case TOTAL_COUNT:
256
      if (value == null) {
257
        unsetTotalCount();
258
      } else {
259
        setTotalCount((Long)value);
260
      }
261
      break;
262
 
263
    case CREDIT_HISTORY_LIST:
264
      if (value == null) {
265
        unsetCreditHistoryList();
266
      } else {
267
        setCreditHistoryList((List<CreditHistory>)value);
268
      }
269
      break;
270
 
271
    }
272
  }
273
 
274
  public Object getFieldValue(_Fields field) {
275
    switch (field) {
276
    case HAS_MORE:
277
      return Boolean.valueOf(isHasMore());
278
 
279
    case TOTAL_COUNT:
280
      return Long.valueOf(getTotalCount());
281
 
282
    case CREDIT_HISTORY_LIST:
283
      return getCreditHistoryList();
284
 
285
    }
286
    throw new IllegalStateException();
287
  }
288
 
289
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
290
  public boolean isSet(_Fields field) {
291
    if (field == null) {
292
      throw new IllegalArgumentException();
293
    }
294
 
295
    switch (field) {
296
    case HAS_MORE:
297
      return isSetHasMore();
298
    case TOTAL_COUNT:
299
      return isSetTotalCount();
300
    case CREDIT_HISTORY_LIST:
301
      return isSetCreditHistoryList();
302
    }
303
    throw new IllegalStateException();
304
  }
305
 
306
  @Override
307
  public boolean equals(Object that) {
308
    if (that == null)
309
      return false;
310
    if (that instanceof PaginatedCreditHistory)
311
      return this.equals((PaginatedCreditHistory)that);
312
    return false;
313
  }
314
 
315
  public boolean equals(PaginatedCreditHistory that) {
316
    if (that == null)
317
      return false;
318
 
319
    boolean this_present_hasMore = true;
320
    boolean that_present_hasMore = true;
321
    if (this_present_hasMore || that_present_hasMore) {
322
      if (!(this_present_hasMore && that_present_hasMore))
323
        return false;
324
      if (this.hasMore != that.hasMore)
325
        return false;
326
    }
327
 
328
    boolean this_present_totalCount = true;
329
    boolean that_present_totalCount = true;
330
    if (this_present_totalCount || that_present_totalCount) {
331
      if (!(this_present_totalCount && that_present_totalCount))
332
        return false;
333
      if (this.totalCount != that.totalCount)
334
        return false;
335
    }
336
 
337
    boolean this_present_creditHistoryList = true && this.isSetCreditHistoryList();
338
    boolean that_present_creditHistoryList = true && that.isSetCreditHistoryList();
339
    if (this_present_creditHistoryList || that_present_creditHistoryList) {
340
      if (!(this_present_creditHistoryList && that_present_creditHistoryList))
341
        return false;
342
      if (!this.creditHistoryList.equals(that.creditHistoryList))
343
        return false;
344
    }
345
 
346
    return true;
347
  }
348
 
349
  @Override
350
  public int hashCode() {
351
    return 0;
352
  }
353
 
354
  public int compareTo(PaginatedCreditHistory other) {
355
    if (!getClass().equals(other.getClass())) {
356
      return getClass().getName().compareTo(other.getClass().getName());
357
    }
358
 
359
    int lastComparison = 0;
360
    PaginatedCreditHistory typedOther = (PaginatedCreditHistory)other;
361
 
362
    lastComparison = Boolean.valueOf(isSetHasMore()).compareTo(typedOther.isSetHasMore());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetHasMore()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasMore, typedOther.hasMore);
368
      if (lastComparison != 0) {
369
        return lastComparison;
370
      }
371
    }
372
    lastComparison = Boolean.valueOf(isSetTotalCount()).compareTo(typedOther.isSetTotalCount());
373
    if (lastComparison != 0) {
374
      return lastComparison;
375
    }
376
    if (isSetTotalCount()) {
377
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalCount, typedOther.totalCount);
378
      if (lastComparison != 0) {
379
        return lastComparison;
380
      }
381
    }
382
    lastComparison = Boolean.valueOf(isSetCreditHistoryList()).compareTo(typedOther.isSetCreditHistoryList());
383
    if (lastComparison != 0) {
384
      return lastComparison;
385
    }
386
    if (isSetCreditHistoryList()) {
387
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creditHistoryList, typedOther.creditHistoryList);
388
      if (lastComparison != 0) {
389
        return lastComparison;
390
      }
391
    }
392
    return 0;
393
  }
394
 
395
  public _Fields fieldForId(int fieldId) {
396
    return _Fields.findByThriftId(fieldId);
397
  }
398
 
399
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
400
    org.apache.thrift.protocol.TField field;
401
    iprot.readStructBegin();
402
    while (true)
403
    {
404
      field = iprot.readFieldBegin();
405
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
406
        break;
407
      }
408
      switch (field.id) {
409
        case 1: // HAS_MORE
410
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
411
            this.hasMore = iprot.readBool();
412
            setHasMoreIsSet(true);
413
          } else { 
414
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
415
          }
416
          break;
417
        case 2: // TOTAL_COUNT
418
          if (field.type == org.apache.thrift.protocol.TType.I64) {
419
            this.totalCount = iprot.readI64();
420
            setTotalCountIsSet(true);
421
          } else { 
422
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
423
          }
424
          break;
425
        case 3: // CREDIT_HISTORY_LIST
426
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
427
            {
428
              org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
429
              this.creditHistoryList = new ArrayList<CreditHistory>(_list64.size);
430
              for (int _i65 = 0; _i65 < _list64.size; ++_i65)
431
              {
432
                CreditHistory _elem66; // required
433
                _elem66 = new CreditHistory();
434
                _elem66.read(iprot);
435
                this.creditHistoryList.add(_elem66);
436
              }
437
              iprot.readListEnd();
438
            }
439
          } else { 
440
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
441
          }
442
          break;
443
        default:
444
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
445
      }
446
      iprot.readFieldEnd();
447
    }
448
    iprot.readStructEnd();
449
    validate();
450
  }
451
 
452
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
453
    validate();
454
 
455
    oprot.writeStructBegin(STRUCT_DESC);
456
    oprot.writeFieldBegin(HAS_MORE_FIELD_DESC);
457
    oprot.writeBool(this.hasMore);
458
    oprot.writeFieldEnd();
459
    oprot.writeFieldBegin(TOTAL_COUNT_FIELD_DESC);
460
    oprot.writeI64(this.totalCount);
461
    oprot.writeFieldEnd();
462
    if (this.creditHistoryList != null) {
463
      oprot.writeFieldBegin(CREDIT_HISTORY_LIST_FIELD_DESC);
464
      {
465
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.creditHistoryList.size()));
466
        for (CreditHistory _iter67 : this.creditHistoryList)
467
        {
468
          _iter67.write(oprot);
469
        }
470
        oprot.writeListEnd();
471
      }
472
      oprot.writeFieldEnd();
473
    }
474
    oprot.writeFieldStop();
475
    oprot.writeStructEnd();
476
  }
477
 
478
  @Override
479
  public String toString() {
480
    StringBuilder sb = new StringBuilder("PaginatedCreditHistory(");
481
    boolean first = true;
482
 
483
    sb.append("hasMore:");
484
    sb.append(this.hasMore);
485
    first = false;
486
    if (!first) sb.append(", ");
487
    sb.append("totalCount:");
488
    sb.append(this.totalCount);
489
    first = false;
490
    if (!first) sb.append(", ");
491
    sb.append("creditHistoryList:");
492
    if (this.creditHistoryList == null) {
493
      sb.append("null");
494
    } else {
495
      sb.append(this.creditHistoryList);
496
    }
497
    first = false;
498
    sb.append(")");
499
    return sb.toString();
500
  }
501
 
502
  public void validate() throws org.apache.thrift.TException {
503
    // check for required fields
504
  }
505
 
506
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
507
    try {
508
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
509
    } catch (org.apache.thrift.TException te) {
510
      throw new java.io.IOException(te);
511
    }
512
  }
513
 
514
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
515
    try {
516
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
517
      __isset_bit_vector = new BitSet(1);
518
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
519
    } catch (org.apache.thrift.TException te) {
520
      throw new java.io.IOException(te);
521
    }
522
  }
523
 
524
}
525