Subversion Repositories SmartDukaan

Rev

Rev 2983 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2983 chandransh 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
2983 chandransh 3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.catalog;
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;
3430 rajveer 18
import java.nio.ByteBuffer;
2983 chandransh 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class ItemShippingInfo implements org.apache.thrift.TBase<ItemShippingInfo, ItemShippingInfo._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemShippingInfo");
2983 chandransh 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField IS_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("isActive", org.apache.thrift.protocol.TType.BOOL, (short)1);
27
  private static final org.apache.thrift.protocol.TField IS_RISKY_FIELD_DESC = new org.apache.thrift.protocol.TField("isRisky", org.apache.thrift.protocol.TType.BOOL, (short)2);
28
  private static final org.apache.thrift.protocol.TField QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("quantity", org.apache.thrift.protocol.TType.I64, (short)3);
2983 chandransh 29
 
3430 rajveer 30
  private boolean isActive; // required
31
  private boolean isRisky; // required
32
  private long quantity; // required
2983 chandransh 33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
2983 chandransh 36
    IS_ACTIVE((short)1, "isActive"),
37
    IS_RISKY((short)2, "isRisky"),
38
    QUANTITY((short)3, "quantity");
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) {
3430 rajveer 52
      switch(fieldId) {
53
        case 1: // IS_ACTIVE
54
          return IS_ACTIVE;
55
        case 2: // IS_RISKY
56
          return IS_RISKY;
57
        case 3: // QUANTITY
58
          return QUANTITY;
59
        default:
60
          return null;
61
      }
2983 chandransh 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 __ISACTIVE_ISSET_ID = 0;
100
  private static final int __ISRISKY_ISSET_ID = 1;
101
  private static final int __QUANTITY_ISSET_ID = 2;
102
  private BitSet __isset_bit_vector = new BitSet(3);
103
 
3430 rajveer 104
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
2983 chandransh 105
  static {
3430 rajveer 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.IS_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("isActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
109
    tmpMap.put(_Fields.IS_RISKY, new org.apache.thrift.meta_data.FieldMetaData("isRisky", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
111
    tmpMap.put(_Fields.QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("quantity", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemShippingInfo.class, metaDataMap);
2983 chandransh 115
  }
116
 
117
  public ItemShippingInfo() {
118
  }
119
 
120
  public ItemShippingInfo(
121
    boolean isActive)
122
  {
123
    this();
124
    this.isActive = isActive;
125
    setIsActiveIsSet(true);
126
  }
127
 
128
  /**
129
   * Performs a deep copy on <i>other</i>.
130
   */
131
  public ItemShippingInfo(ItemShippingInfo other) {
132
    __isset_bit_vector.clear();
133
    __isset_bit_vector.or(other.__isset_bit_vector);
134
    this.isActive = other.isActive;
135
    this.isRisky = other.isRisky;
136
    this.quantity = other.quantity;
137
  }
138
 
139
  public ItemShippingInfo deepCopy() {
140
    return new ItemShippingInfo(this);
141
  }
142
 
3430 rajveer 143
  @Override
144
  public void clear() {
145
    setIsActiveIsSet(false);
146
    this.isActive = false;
147
    setIsRiskyIsSet(false);
148
    this.isRisky = false;
149
    setQuantityIsSet(false);
150
    this.quantity = 0;
2983 chandransh 151
  }
152
 
153
  public boolean isIsActive() {
154
    return this.isActive;
155
  }
156
 
3430 rajveer 157
  public void setIsActive(boolean isActive) {
2983 chandransh 158
    this.isActive = isActive;
159
    setIsActiveIsSet(true);
160
  }
161
 
162
  public void unsetIsActive() {
163
    __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
164
  }
165
 
3430 rajveer 166
  /** Returns true if field isActive is set (has been assigned a value) and false otherwise */
2983 chandransh 167
  public boolean isSetIsActive() {
168
    return __isset_bit_vector.get(__ISACTIVE_ISSET_ID);
169
  }
170
 
171
  public void setIsActiveIsSet(boolean value) {
172
    __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
173
  }
174
 
175
  public boolean isIsRisky() {
176
    return this.isRisky;
177
  }
178
 
3430 rajveer 179
  public void setIsRisky(boolean isRisky) {
2983 chandransh 180
    this.isRisky = isRisky;
181
    setIsRiskyIsSet(true);
182
  }
183
 
184
  public void unsetIsRisky() {
185
    __isset_bit_vector.clear(__ISRISKY_ISSET_ID);
186
  }
187
 
3430 rajveer 188
  /** Returns true if field isRisky is set (has been assigned a value) and false otherwise */
2983 chandransh 189
  public boolean isSetIsRisky() {
190
    return __isset_bit_vector.get(__ISRISKY_ISSET_ID);
191
  }
192
 
193
  public void setIsRiskyIsSet(boolean value) {
194
    __isset_bit_vector.set(__ISRISKY_ISSET_ID, value);
195
  }
196
 
197
  public long getQuantity() {
198
    return this.quantity;
199
  }
200
 
3430 rajveer 201
  public void setQuantity(long quantity) {
2983 chandransh 202
    this.quantity = quantity;
203
    setQuantityIsSet(true);
204
  }
205
 
206
  public void unsetQuantity() {
207
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
208
  }
209
 
3430 rajveer 210
  /** Returns true if field quantity is set (has been assigned a value) and false otherwise */
2983 chandransh 211
  public boolean isSetQuantity() {
212
    return __isset_bit_vector.get(__QUANTITY_ISSET_ID);
213
  }
214
 
215
  public void setQuantityIsSet(boolean value) {
216
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
217
  }
218
 
219
  public void setFieldValue(_Fields field, Object value) {
220
    switch (field) {
221
    case IS_ACTIVE:
222
      if (value == null) {
223
        unsetIsActive();
224
      } else {
225
        setIsActive((Boolean)value);
226
      }
227
      break;
228
 
229
    case IS_RISKY:
230
      if (value == null) {
231
        unsetIsRisky();
232
      } else {
233
        setIsRisky((Boolean)value);
234
      }
235
      break;
236
 
237
    case QUANTITY:
238
      if (value == null) {
239
        unsetQuantity();
240
      } else {
241
        setQuantity((Long)value);
242
      }
243
      break;
244
 
245
    }
246
  }
247
 
248
  public Object getFieldValue(_Fields field) {
249
    switch (field) {
250
    case IS_ACTIVE:
3430 rajveer 251
      return Boolean.valueOf(isIsActive());
2983 chandransh 252
 
253
    case IS_RISKY:
3430 rajveer 254
      return Boolean.valueOf(isIsRisky());
2983 chandransh 255
 
256
    case QUANTITY:
3430 rajveer 257
      return Long.valueOf(getQuantity());
2983 chandransh 258
 
259
    }
260
    throw new IllegalStateException();
261
  }
262
 
3430 rajveer 263
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
264
  public boolean isSet(_Fields field) {
265
    if (field == null) {
266
      throw new IllegalArgumentException();
267
    }
2983 chandransh 268
 
269
    switch (field) {
270
    case IS_ACTIVE:
271
      return isSetIsActive();
272
    case IS_RISKY:
273
      return isSetIsRisky();
274
    case QUANTITY:
275
      return isSetQuantity();
276
    }
277
    throw new IllegalStateException();
278
  }
279
 
280
  @Override
281
  public boolean equals(Object that) {
282
    if (that == null)
283
      return false;
284
    if (that instanceof ItemShippingInfo)
285
      return this.equals((ItemShippingInfo)that);
286
    return false;
287
  }
288
 
289
  public boolean equals(ItemShippingInfo that) {
290
    if (that == null)
291
      return false;
292
 
293
    boolean this_present_isActive = true;
294
    boolean that_present_isActive = true;
295
    if (this_present_isActive || that_present_isActive) {
296
      if (!(this_present_isActive && that_present_isActive))
297
        return false;
298
      if (this.isActive != that.isActive)
299
        return false;
300
    }
301
 
302
    boolean this_present_isRisky = true && this.isSetIsRisky();
303
    boolean that_present_isRisky = true && that.isSetIsRisky();
304
    if (this_present_isRisky || that_present_isRisky) {
305
      if (!(this_present_isRisky && that_present_isRisky))
306
        return false;
307
      if (this.isRisky != that.isRisky)
308
        return false;
309
    }
310
 
311
    boolean this_present_quantity = true && this.isSetQuantity();
312
    boolean that_present_quantity = true && that.isSetQuantity();
313
    if (this_present_quantity || that_present_quantity) {
314
      if (!(this_present_quantity && that_present_quantity))
315
        return false;
316
      if (this.quantity != that.quantity)
317
        return false;
318
    }
319
 
320
    return true;
321
  }
322
 
323
  @Override
324
  public int hashCode() {
325
    return 0;
326
  }
327
 
328
  public int compareTo(ItemShippingInfo other) {
329
    if (!getClass().equals(other.getClass())) {
330
      return getClass().getName().compareTo(other.getClass().getName());
331
    }
332
 
333
    int lastComparison = 0;
334
    ItemShippingInfo typedOther = (ItemShippingInfo)other;
335
 
3430 rajveer 336
    lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(typedOther.isSetIsActive());
2983 chandransh 337
    if (lastComparison != 0) {
338
      return lastComparison;
339
    }
3430 rajveer 340
    if (isSetIsActive()) {
341
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isActive, typedOther.isActive);
342
      if (lastComparison != 0) {
343
        return lastComparison;
344
      }
2983 chandransh 345
    }
3430 rajveer 346
    lastComparison = Boolean.valueOf(isSetIsRisky()).compareTo(typedOther.isSetIsRisky());
2983 chandransh 347
    if (lastComparison != 0) {
348
      return lastComparison;
349
    }
3430 rajveer 350
    if (isSetIsRisky()) {
351
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRisky, typedOther.isRisky);
352
      if (lastComparison != 0) {
353
        return lastComparison;
354
      }
2983 chandransh 355
    }
3430 rajveer 356
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(typedOther.isSetQuantity());
2983 chandransh 357
    if (lastComparison != 0) {
358
      return lastComparison;
359
    }
3430 rajveer 360
    if (isSetQuantity()) {
361
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.quantity, typedOther.quantity);
362
      if (lastComparison != 0) {
363
        return lastComparison;
364
      }
2983 chandransh 365
    }
366
    return 0;
367
  }
368
 
3430 rajveer 369
  public _Fields fieldForId(int fieldId) {
370
    return _Fields.findByThriftId(fieldId);
371
  }
372
 
373
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
374
    org.apache.thrift.protocol.TField field;
2983 chandransh 375
    iprot.readStructBegin();
376
    while (true)
377
    {
378
      field = iprot.readFieldBegin();
3430 rajveer 379
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
2983 chandransh 380
        break;
381
      }
3430 rajveer 382
      switch (field.id) {
383
        case 1: // IS_ACTIVE
384
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
385
            this.isActive = iprot.readBool();
386
            setIsActiveIsSet(true);
387
          } else { 
388
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
389
          }
390
          break;
391
        case 2: // IS_RISKY
392
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
393
            this.isRisky = iprot.readBool();
394
            setIsRiskyIsSet(true);
395
          } else { 
396
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
397
          }
398
          break;
399
        case 3: // QUANTITY
400
          if (field.type == org.apache.thrift.protocol.TType.I64) {
401
            this.quantity = iprot.readI64();
402
            setQuantityIsSet(true);
403
          } else { 
404
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
405
          }
406
          break;
407
        default:
408
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
2983 chandransh 409
      }
3430 rajveer 410
      iprot.readFieldEnd();
2983 chandransh 411
    }
412
    iprot.readStructEnd();
413
    validate();
414
  }
415
 
3430 rajveer 416
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
2983 chandransh 417
    validate();
418
 
419
    oprot.writeStructBegin(STRUCT_DESC);
420
    oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
421
    oprot.writeBool(this.isActive);
422
    oprot.writeFieldEnd();
423
    if (isSetIsRisky()) {
424
      oprot.writeFieldBegin(IS_RISKY_FIELD_DESC);
425
      oprot.writeBool(this.isRisky);
426
      oprot.writeFieldEnd();
427
    }
428
    if (isSetQuantity()) {
429
      oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
430
      oprot.writeI64(this.quantity);
431
      oprot.writeFieldEnd();
432
    }
433
    oprot.writeFieldStop();
434
    oprot.writeStructEnd();
435
  }
436
 
437
  @Override
438
  public String toString() {
439
    StringBuilder sb = new StringBuilder("ItemShippingInfo(");
440
    boolean first = true;
441
 
442
    sb.append("isActive:");
443
    sb.append(this.isActive);
444
    first = false;
445
    if (isSetIsRisky()) {
446
      if (!first) sb.append(", ");
447
      sb.append("isRisky:");
448
      sb.append(this.isRisky);
449
      first = false;
450
    }
451
    if (isSetQuantity()) {
452
      if (!first) sb.append(", ");
453
      sb.append("quantity:");
454
      sb.append(this.quantity);
455
      first = false;
456
    }
457
    sb.append(")");
458
    return sb.toString();
459
  }
460
 
3430 rajveer 461
  public void validate() throws org.apache.thrift.TException {
2983 chandransh 462
    // check for required fields
463
  }
464
 
3430 rajveer 465
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
466
    try {
467
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
468
    } catch (org.apache.thrift.TException te) {
469
      throw new java.io.IOException(te);
470
    }
471
  }
472
 
473
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
474
    try {
475
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
476
      __isset_bit_vector = new BitSet(1);
477
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
478
    } catch (org.apache.thrift.TException te) {
479
      throw new java.io.IOException(te);
480
    }
481
  }
482
 
2983 chandransh 483
}
484