Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7073 anupam.sin 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 WalletForCompany implements org.apache.thrift.TBase<WalletForCompany, WalletForCompany._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("WalletForCompany");
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 COMPANY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("companyId", org.apache.thrift.protocol.TType.I64, (short)2);
28
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
29
 
30
  private long id; // required
31
  private long companyId; // required
32
  private double amount; // 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
    ID((short)1, "id"),
37
    COMPANY_ID((short)2, "companyId"),
38
    AMOUNT((short)3, "amount");
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: // ID
54
          return ID;
55
        case 2: // COMPANY_ID
56
          return COMPANY_ID;
57
        case 3: // AMOUNT
58
          return AMOUNT;
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 __ID_ISSET_ID = 0;
100
  private static final int __COMPANYID_ISSET_ID = 1;
101
  private static final int __AMOUNT_ISSET_ID = 2;
102
  private BitSet __isset_bit_vector = new BitSet(3);
103
 
104
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
105
  static {
106
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
107
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
109
    tmpMap.put(_Fields.COMPANY_ID, new org.apache.thrift.meta_data.FieldMetaData("companyId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
111
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(WalletForCompany.class, metaDataMap);
115
  }
116
 
117
  public WalletForCompany() {
118
  }
119
 
120
  public WalletForCompany(
121
    long id,
122
    long companyId,
123
    double amount)
124
  {
125
    this();
126
    this.id = id;
127
    setIdIsSet(true);
128
    this.companyId = companyId;
129
    setCompanyIdIsSet(true);
130
    this.amount = amount;
131
    setAmountIsSet(true);
132
  }
133
 
134
  /**
135
   * Performs a deep copy on <i>other</i>.
136
   */
137
  public WalletForCompany(WalletForCompany other) {
138
    __isset_bit_vector.clear();
139
    __isset_bit_vector.or(other.__isset_bit_vector);
140
    this.id = other.id;
141
    this.companyId = other.companyId;
142
    this.amount = other.amount;
143
  }
144
 
145
  public WalletForCompany deepCopy() {
146
    return new WalletForCompany(this);
147
  }
148
 
149
  @Override
150
  public void clear() {
151
    setIdIsSet(false);
152
    this.id = 0;
153
    setCompanyIdIsSet(false);
154
    this.companyId = 0;
155
    setAmountIsSet(false);
156
    this.amount = 0.0;
157
  }
158
 
159
  public long getId() {
160
    return this.id;
161
  }
162
 
163
  public void setId(long id) {
164
    this.id = id;
165
    setIdIsSet(true);
166
  }
167
 
168
  public void unsetId() {
169
    __isset_bit_vector.clear(__ID_ISSET_ID);
170
  }
171
 
172
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
173
  public boolean isSetId() {
174
    return __isset_bit_vector.get(__ID_ISSET_ID);
175
  }
176
 
177
  public void setIdIsSet(boolean value) {
178
    __isset_bit_vector.set(__ID_ISSET_ID, value);
179
  }
180
 
181
  public long getCompanyId() {
182
    return this.companyId;
183
  }
184
 
185
  public void setCompanyId(long companyId) {
186
    this.companyId = companyId;
187
    setCompanyIdIsSet(true);
188
  }
189
 
190
  public void unsetCompanyId() {
191
    __isset_bit_vector.clear(__COMPANYID_ISSET_ID);
192
  }
193
 
194
  /** Returns true if field companyId is set (has been assigned a value) and false otherwise */
195
  public boolean isSetCompanyId() {
196
    return __isset_bit_vector.get(__COMPANYID_ISSET_ID);
197
  }
198
 
199
  public void setCompanyIdIsSet(boolean value) {
200
    __isset_bit_vector.set(__COMPANYID_ISSET_ID, value);
201
  }
202
 
203
  public double getAmount() {
204
    return this.amount;
205
  }
206
 
207
  public void setAmount(double amount) {
208
    this.amount = amount;
209
    setAmountIsSet(true);
210
  }
211
 
212
  public void unsetAmount() {
213
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
214
  }
215
 
216
  /** Returns true if field amount is set (has been assigned a value) and false otherwise */
217
  public boolean isSetAmount() {
218
    return __isset_bit_vector.get(__AMOUNT_ISSET_ID);
219
  }
220
 
221
  public void setAmountIsSet(boolean value) {
222
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
223
  }
224
 
225
  public void setFieldValue(_Fields field, Object value) {
226
    switch (field) {
227
    case ID:
228
      if (value == null) {
229
        unsetId();
230
      } else {
231
        setId((Long)value);
232
      }
233
      break;
234
 
235
    case COMPANY_ID:
236
      if (value == null) {
237
        unsetCompanyId();
238
      } else {
239
        setCompanyId((Long)value);
240
      }
241
      break;
242
 
243
    case AMOUNT:
244
      if (value == null) {
245
        unsetAmount();
246
      } else {
247
        setAmount((Double)value);
248
      }
249
      break;
250
 
251
    }
252
  }
253
 
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
256
    case ID:
257
      return Long.valueOf(getId());
258
 
259
    case COMPANY_ID:
260
      return Long.valueOf(getCompanyId());
261
 
262
    case AMOUNT:
263
      return Double.valueOf(getAmount());
264
 
265
    }
266
    throw new IllegalStateException();
267
  }
268
 
269
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
270
  public boolean isSet(_Fields field) {
271
    if (field == null) {
272
      throw new IllegalArgumentException();
273
    }
274
 
275
    switch (field) {
276
    case ID:
277
      return isSetId();
278
    case COMPANY_ID:
279
      return isSetCompanyId();
280
    case AMOUNT:
281
      return isSetAmount();
282
    }
283
    throw new IllegalStateException();
284
  }
285
 
286
  @Override
287
  public boolean equals(Object that) {
288
    if (that == null)
289
      return false;
290
    if (that instanceof WalletForCompany)
291
      return this.equals((WalletForCompany)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(WalletForCompany that) {
296
    if (that == null)
297
      return false;
298
 
299
    boolean this_present_id = true;
300
    boolean that_present_id = true;
301
    if (this_present_id || that_present_id) {
302
      if (!(this_present_id && that_present_id))
303
        return false;
304
      if (this.id != that.id)
305
        return false;
306
    }
307
 
308
    boolean this_present_companyId = true;
309
    boolean that_present_companyId = true;
310
    if (this_present_companyId || that_present_companyId) {
311
      if (!(this_present_companyId && that_present_companyId))
312
        return false;
313
      if (this.companyId != that.companyId)
314
        return false;
315
    }
316
 
317
    boolean this_present_amount = true;
318
    boolean that_present_amount = true;
319
    if (this_present_amount || that_present_amount) {
320
      if (!(this_present_amount && that_present_amount))
321
        return false;
322
      if (this.amount != that.amount)
323
        return false;
324
    }
325
 
326
    return true;
327
  }
328
 
329
  @Override
330
  public int hashCode() {
331
    return 0;
332
  }
333
 
334
  public int compareTo(WalletForCompany other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    WalletForCompany typedOther = (WalletForCompany)other;
341
 
342
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
343
    if (lastComparison != 0) {
344
      return lastComparison;
345
    }
346
    if (isSetId()) {
347
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
348
      if (lastComparison != 0) {
349
        return lastComparison;
350
      }
351
    }
352
    lastComparison = Boolean.valueOf(isSetCompanyId()).compareTo(typedOther.isSetCompanyId());
353
    if (lastComparison != 0) {
354
      return lastComparison;
355
    }
356
    if (isSetCompanyId()) {
357
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.companyId, typedOther.companyId);
358
      if (lastComparison != 0) {
359
        return lastComparison;
360
      }
361
    }
362
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetAmount()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
368
      if (lastComparison != 0) {
369
        return lastComparison;
370
      }
371
    }
372
    return 0;
373
  }
374
 
375
  public _Fields fieldForId(int fieldId) {
376
    return _Fields.findByThriftId(fieldId);
377
  }
378
 
379
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
380
    org.apache.thrift.protocol.TField field;
381
    iprot.readStructBegin();
382
    while (true)
383
    {
384
      field = iprot.readFieldBegin();
385
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
386
        break;
387
      }
388
      switch (field.id) {
389
        case 1: // ID
390
          if (field.type == org.apache.thrift.protocol.TType.I64) {
391
            this.id = iprot.readI64();
392
            setIdIsSet(true);
393
          } else { 
394
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
395
          }
396
          break;
397
        case 2: // COMPANY_ID
398
          if (field.type == org.apache.thrift.protocol.TType.I64) {
399
            this.companyId = iprot.readI64();
400
            setCompanyIdIsSet(true);
401
          } else { 
402
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
403
          }
404
          break;
405
        case 3: // AMOUNT
406
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
407
            this.amount = iprot.readDouble();
408
            setAmountIsSet(true);
409
          } else { 
410
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
411
          }
412
          break;
413
        default:
414
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
415
      }
416
      iprot.readFieldEnd();
417
    }
418
    iprot.readStructEnd();
419
    validate();
420
  }
421
 
422
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
423
    validate();
424
 
425
    oprot.writeStructBegin(STRUCT_DESC);
426
    oprot.writeFieldBegin(ID_FIELD_DESC);
427
    oprot.writeI64(this.id);
428
    oprot.writeFieldEnd();
429
    oprot.writeFieldBegin(COMPANY_ID_FIELD_DESC);
430
    oprot.writeI64(this.companyId);
431
    oprot.writeFieldEnd();
432
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
433
    oprot.writeDouble(this.amount);
434
    oprot.writeFieldEnd();
435
    oprot.writeFieldStop();
436
    oprot.writeStructEnd();
437
  }
438
 
439
  @Override
440
  public String toString() {
441
    StringBuilder sb = new StringBuilder("WalletForCompany(");
442
    boolean first = true;
443
 
444
    sb.append("id:");
445
    sb.append(this.id);
446
    first = false;
447
    if (!first) sb.append(", ");
448
    sb.append("companyId:");
449
    sb.append(this.companyId);
450
    first = false;
451
    if (!first) sb.append(", ");
452
    sb.append("amount:");
453
    sb.append(this.amount);
454
    first = false;
455
    sb.append(")");
456
    return sb.toString();
457
  }
458
 
459
  public void validate() throws org.apache.thrift.TException {
460
    // check for required fields
461
  }
462
 
463
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
464
    try {
465
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
466
    } catch (org.apache.thrift.TException te) {
467
      throw new java.io.IOException(te);
468
    }
469
  }
470
 
471
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
472
    try {
473
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
474
      __isset_bit_vector = new BitSet(1);
475
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
476
    } catch (org.apache.thrift.TException te) {
477
      throw new java.io.IOException(te);
478
    }
479
  }
480
 
481
}
482