Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
2983 chandransh 1
/**
2
 * Autogenerated by Thrift
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;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class ItemShippingInfo implements TBase<ItemShippingInfo._Fields>, java.io.Serializable, Cloneable, Comparable<ItemShippingInfo> {
27
  private static final TStruct STRUCT_DESC = new TStruct("ItemShippingInfo");
28
 
29
  private static final TField IS_ACTIVE_FIELD_DESC = new TField("isActive", TType.BOOL, (short)1);
30
  private static final TField IS_RISKY_FIELD_DESC = new TField("isRisky", TType.BOOL, (short)2);
31
  private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.I64, (short)3);
32
 
33
  private boolean isActive;
34
  private boolean isRisky;
35
  private long quantity;
36
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
39
    IS_ACTIVE((short)1, "isActive"),
40
    IS_RISKY((short)2, "isRisky"),
41
    QUANTITY((short)3, "quantity");
42
 
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
45
 
46
    static {
47
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
48
        byId.put((int)field._thriftId, field);
49
        byName.put(field.getFieldName(), field);
50
      }
51
    }
52
 
53
    /**
54
     * Find the _Fields constant that matches fieldId, or null if its not found.
55
     */
56
    public static _Fields findByThriftId(int fieldId) {
57
      return byId.get(fieldId);
58
    }
59
 
60
    /**
61
     * Find the _Fields constant that matches fieldId, throwing an exception
62
     * if it is not found.
63
     */
64
    public static _Fields findByThriftIdOrThrow(int fieldId) {
65
      _Fields fields = findByThriftId(fieldId);
66
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
67
      return fields;
68
    }
69
 
70
    /**
71
     * Find the _Fields constant that matches name, or null if its not found.
72
     */
73
    public static _Fields findByName(String name) {
74
      return byName.get(name);
75
    }
76
 
77
    private final short _thriftId;
78
    private final String _fieldName;
79
 
80
    _Fields(short thriftId, String fieldName) {
81
      _thriftId = thriftId;
82
      _fieldName = fieldName;
83
    }
84
 
85
    public short getThriftFieldId() {
86
      return _thriftId;
87
    }
88
 
89
    public String getFieldName() {
90
      return _fieldName;
91
    }
92
  }
93
 
94
  // isset id assignments
95
  private static final int __ISACTIVE_ISSET_ID = 0;
96
  private static final int __ISRISKY_ISSET_ID = 1;
97
  private static final int __QUANTITY_ISSET_ID = 2;
98
  private BitSet __isset_bit_vector = new BitSet(3);
99
 
100
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
101
    put(_Fields.IS_ACTIVE, new FieldMetaData("isActive", TFieldRequirementType.DEFAULT, 
102
        new FieldValueMetaData(TType.BOOL)));
103
    put(_Fields.IS_RISKY, new FieldMetaData("isRisky", TFieldRequirementType.OPTIONAL, 
104
        new FieldValueMetaData(TType.BOOL)));
105
    put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.OPTIONAL, 
106
        new FieldValueMetaData(TType.I64)));
107
  }});
108
 
109
  static {
110
    FieldMetaData.addStructMetaDataMap(ItemShippingInfo.class, metaDataMap);
111
  }
112
 
113
  public ItemShippingInfo() {
114
  }
115
 
116
  public ItemShippingInfo(
117
    boolean isActive)
118
  {
119
    this();
120
    this.isActive = isActive;
121
    setIsActiveIsSet(true);
122
  }
123
 
124
  /**
125
   * Performs a deep copy on <i>other</i>.
126
   */
127
  public ItemShippingInfo(ItemShippingInfo other) {
128
    __isset_bit_vector.clear();
129
    __isset_bit_vector.or(other.__isset_bit_vector);
130
    this.isActive = other.isActive;
131
    this.isRisky = other.isRisky;
132
    this.quantity = other.quantity;
133
  }
134
 
135
  public ItemShippingInfo deepCopy() {
136
    return new ItemShippingInfo(this);
137
  }
138
 
139
  @Deprecated
140
  public ItemShippingInfo clone() {
141
    return new ItemShippingInfo(this);
142
  }
143
 
144
  public boolean isIsActive() {
145
    return this.isActive;
146
  }
147
 
148
  public ItemShippingInfo setIsActive(boolean isActive) {
149
    this.isActive = isActive;
150
    setIsActiveIsSet(true);
151
    return this;
152
  }
153
 
154
  public void unsetIsActive() {
155
    __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
156
  }
157
 
158
  /** Returns true if field isActive is set (has been asigned a value) and false otherwise */
159
  public boolean isSetIsActive() {
160
    return __isset_bit_vector.get(__ISACTIVE_ISSET_ID);
161
  }
162
 
163
  public void setIsActiveIsSet(boolean value) {
164
    __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
165
  }
166
 
167
  public boolean isIsRisky() {
168
    return this.isRisky;
169
  }
170
 
171
  public ItemShippingInfo setIsRisky(boolean isRisky) {
172
    this.isRisky = isRisky;
173
    setIsRiskyIsSet(true);
174
    return this;
175
  }
176
 
177
  public void unsetIsRisky() {
178
    __isset_bit_vector.clear(__ISRISKY_ISSET_ID);
179
  }
180
 
181
  /** Returns true if field isRisky is set (has been asigned a value) and false otherwise */
182
  public boolean isSetIsRisky() {
183
    return __isset_bit_vector.get(__ISRISKY_ISSET_ID);
184
  }
185
 
186
  public void setIsRiskyIsSet(boolean value) {
187
    __isset_bit_vector.set(__ISRISKY_ISSET_ID, value);
188
  }
189
 
190
  public long getQuantity() {
191
    return this.quantity;
192
  }
193
 
194
  public ItemShippingInfo setQuantity(long quantity) {
195
    this.quantity = quantity;
196
    setQuantityIsSet(true);
197
    return this;
198
  }
199
 
200
  public void unsetQuantity() {
201
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
202
  }
203
 
204
  /** Returns true if field quantity is set (has been asigned a value) and false otherwise */
205
  public boolean isSetQuantity() {
206
    return __isset_bit_vector.get(__QUANTITY_ISSET_ID);
207
  }
208
 
209
  public void setQuantityIsSet(boolean value) {
210
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
211
  }
212
 
213
  public void setFieldValue(_Fields field, Object value) {
214
    switch (field) {
215
    case IS_ACTIVE:
216
      if (value == null) {
217
        unsetIsActive();
218
      } else {
219
        setIsActive((Boolean)value);
220
      }
221
      break;
222
 
223
    case IS_RISKY:
224
      if (value == null) {
225
        unsetIsRisky();
226
      } else {
227
        setIsRisky((Boolean)value);
228
      }
229
      break;
230
 
231
    case QUANTITY:
232
      if (value == null) {
233
        unsetQuantity();
234
      } else {
235
        setQuantity((Long)value);
236
      }
237
      break;
238
 
239
    }
240
  }
241
 
242
  public void setFieldValue(int fieldID, Object value) {
243
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
244
  }
245
 
246
  public Object getFieldValue(_Fields field) {
247
    switch (field) {
248
    case IS_ACTIVE:
249
      return new Boolean(isIsActive());
250
 
251
    case IS_RISKY:
252
      return new Boolean(isIsRisky());
253
 
254
    case QUANTITY:
255
      return new Long(getQuantity());
256
 
257
    }
258
    throw new IllegalStateException();
259
  }
260
 
261
  public Object getFieldValue(int fieldId) {
262
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
263
  }
264
 
265
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
266
  public boolean isSet(_Fields field) {
267
    switch (field) {
268
    case IS_ACTIVE:
269
      return isSetIsActive();
270
    case IS_RISKY:
271
      return isSetIsRisky();
272
    case QUANTITY:
273
      return isSetQuantity();
274
    }
275
    throw new IllegalStateException();
276
  }
277
 
278
  public boolean isSet(int fieldID) {
279
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
280
  }
281
 
282
  @Override
283
  public boolean equals(Object that) {
284
    if (that == null)
285
      return false;
286
    if (that instanceof ItemShippingInfo)
287
      return this.equals((ItemShippingInfo)that);
288
    return false;
289
  }
290
 
291
  public boolean equals(ItemShippingInfo that) {
292
    if (that == null)
293
      return false;
294
 
295
    boolean this_present_isActive = true;
296
    boolean that_present_isActive = true;
297
    if (this_present_isActive || that_present_isActive) {
298
      if (!(this_present_isActive && that_present_isActive))
299
        return false;
300
      if (this.isActive != that.isActive)
301
        return false;
302
    }
303
 
304
    boolean this_present_isRisky = true && this.isSetIsRisky();
305
    boolean that_present_isRisky = true && that.isSetIsRisky();
306
    if (this_present_isRisky || that_present_isRisky) {
307
      if (!(this_present_isRisky && that_present_isRisky))
308
        return false;
309
      if (this.isRisky != that.isRisky)
310
        return false;
311
    }
312
 
313
    boolean this_present_quantity = true && this.isSetQuantity();
314
    boolean that_present_quantity = true && that.isSetQuantity();
315
    if (this_present_quantity || that_present_quantity) {
316
      if (!(this_present_quantity && that_present_quantity))
317
        return false;
318
      if (this.quantity != that.quantity)
319
        return false;
320
    }
321
 
322
    return true;
323
  }
324
 
325
  @Override
326
  public int hashCode() {
327
    return 0;
328
  }
329
 
330
  public int compareTo(ItemShippingInfo other) {
331
    if (!getClass().equals(other.getClass())) {
332
      return getClass().getName().compareTo(other.getClass().getName());
333
    }
334
 
335
    int lastComparison = 0;
336
    ItemShippingInfo typedOther = (ItemShippingInfo)other;
337
 
338
    lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(isSetIsActive());
339
    if (lastComparison != 0) {
340
      return lastComparison;
341
    }
342
    lastComparison = TBaseHelper.compareTo(isActive, typedOther.isActive);
343
    if (lastComparison != 0) {
344
      return lastComparison;
345
    }
346
    lastComparison = Boolean.valueOf(isSetIsRisky()).compareTo(isSetIsRisky());
347
    if (lastComparison != 0) {
348
      return lastComparison;
349
    }
350
    lastComparison = TBaseHelper.compareTo(isRisky, typedOther.isRisky);
351
    if (lastComparison != 0) {
352
      return lastComparison;
353
    }
354
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(isSetQuantity());
355
    if (lastComparison != 0) {
356
      return lastComparison;
357
    }
358
    lastComparison = TBaseHelper.compareTo(quantity, typedOther.quantity);
359
    if (lastComparison != 0) {
360
      return lastComparison;
361
    }
362
    return 0;
363
  }
364
 
365
  public void read(TProtocol iprot) throws TException {
366
    TField field;
367
    iprot.readStructBegin();
368
    while (true)
369
    {
370
      field = iprot.readFieldBegin();
371
      if (field.type == TType.STOP) { 
372
        break;
373
      }
374
      _Fields fieldId = _Fields.findByThriftId(field.id);
375
      if (fieldId == null) {
376
        TProtocolUtil.skip(iprot, field.type);
377
      } else {
378
        switch (fieldId) {
379
          case IS_ACTIVE:
380
            if (field.type == TType.BOOL) {
381
              this.isActive = iprot.readBool();
382
              setIsActiveIsSet(true);
383
            } else { 
384
              TProtocolUtil.skip(iprot, field.type);
385
            }
386
            break;
387
          case IS_RISKY:
388
            if (field.type == TType.BOOL) {
389
              this.isRisky = iprot.readBool();
390
              setIsRiskyIsSet(true);
391
            } else { 
392
              TProtocolUtil.skip(iprot, field.type);
393
            }
394
            break;
395
          case QUANTITY:
396
            if (field.type == TType.I64) {
397
              this.quantity = iprot.readI64();
398
              setQuantityIsSet(true);
399
            } else { 
400
              TProtocolUtil.skip(iprot, field.type);
401
            }
402
            break;
403
        }
404
        iprot.readFieldEnd();
405
      }
406
    }
407
    iprot.readStructEnd();
408
    validate();
409
  }
410
 
411
  public void write(TProtocol oprot) throws TException {
412
    validate();
413
 
414
    oprot.writeStructBegin(STRUCT_DESC);
415
    oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
416
    oprot.writeBool(this.isActive);
417
    oprot.writeFieldEnd();
418
    if (isSetIsRisky()) {
419
      oprot.writeFieldBegin(IS_RISKY_FIELD_DESC);
420
      oprot.writeBool(this.isRisky);
421
      oprot.writeFieldEnd();
422
    }
423
    if (isSetQuantity()) {
424
      oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
425
      oprot.writeI64(this.quantity);
426
      oprot.writeFieldEnd();
427
    }
428
    oprot.writeFieldStop();
429
    oprot.writeStructEnd();
430
  }
431
 
432
  @Override
433
  public String toString() {
434
    StringBuilder sb = new StringBuilder("ItemShippingInfo(");
435
    boolean first = true;
436
 
437
    sb.append("isActive:");
438
    sb.append(this.isActive);
439
    first = false;
440
    if (isSetIsRisky()) {
441
      if (!first) sb.append(", ");
442
      sb.append("isRisky:");
443
      sb.append(this.isRisky);
444
      first = false;
445
    }
446
    if (isSetQuantity()) {
447
      if (!first) sb.append(", ");
448
      sb.append("quantity:");
449
      sb.append(this.quantity);
450
      first = false;
451
    }
452
    sb.append(")");
453
    return sb.toString();
454
  }
455
 
456
  public void validate() throws TException {
457
    // check for required fields
458
  }
459
 
460
}
461