Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5945 mandeep.dh 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.inventory;
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 VendorItemMapping implements org.apache.thrift.TBase<VendorItemMapping, VendorItemMapping._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("VendorItemMapping");
25
 
26
  private static final org.apache.thrift.protocol.TField VENDOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("vendorId", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField ITEM_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("itemKey", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)3);
29
 
30
  private long vendorId; // required
31
  private String itemKey; // required
32
  private long itemId; // 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
    VENDOR_ID((short)1, "vendorId"),
37
    ITEM_KEY((short)2, "itemKey"),
38
    ITEM_ID((short)3, "itemId");
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: // VENDOR_ID
54
          return VENDOR_ID;
55
        case 2: // ITEM_KEY
56
          return ITEM_KEY;
57
        case 3: // ITEM_ID
58
          return ITEM_ID;
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 __VENDORID_ISSET_ID = 0;
100
  private static final int __ITEMID_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.VENDOR_ID, new org.apache.thrift.meta_data.FieldMetaData("vendorId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
108
    tmpMap.put(_Fields.ITEM_KEY, new org.apache.thrift.meta_data.FieldMetaData("itemKey", org.apache.thrift.TFieldRequirementType.DEFAULT, 
109
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
110
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
112
    metaDataMap = Collections.unmodifiableMap(tmpMap);
113
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(VendorItemMapping.class, metaDataMap);
114
  }
115
 
116
  public VendorItemMapping() {
117
  }
118
 
119
  public VendorItemMapping(
120
    long vendorId,
121
    String itemKey,
122
    long itemId)
123
  {
124
    this();
125
    this.vendorId = vendorId;
126
    setVendorIdIsSet(true);
127
    this.itemKey = itemKey;
128
    this.itemId = itemId;
129
    setItemIdIsSet(true);
130
  }
131
 
132
  /**
133
   * Performs a deep copy on <i>other</i>.
134
   */
135
  public VendorItemMapping(VendorItemMapping other) {
136
    __isset_bit_vector.clear();
137
    __isset_bit_vector.or(other.__isset_bit_vector);
138
    this.vendorId = other.vendorId;
139
    if (other.isSetItemKey()) {
140
      this.itemKey = other.itemKey;
141
    }
142
    this.itemId = other.itemId;
143
  }
144
 
145
  public VendorItemMapping deepCopy() {
146
    return new VendorItemMapping(this);
147
  }
148
 
149
  @Override
150
  public void clear() {
151
    setVendorIdIsSet(false);
152
    this.vendorId = 0;
153
    this.itemKey = null;
154
    setItemIdIsSet(false);
155
    this.itemId = 0;
156
  }
157
 
158
  public long getVendorId() {
159
    return this.vendorId;
160
  }
161
 
162
  public void setVendorId(long vendorId) {
163
    this.vendorId = vendorId;
164
    setVendorIdIsSet(true);
165
  }
166
 
167
  public void unsetVendorId() {
168
    __isset_bit_vector.clear(__VENDORID_ISSET_ID);
169
  }
170
 
171
  /** Returns true if field vendorId is set (has been assigned a value) and false otherwise */
172
  public boolean isSetVendorId() {
173
    return __isset_bit_vector.get(__VENDORID_ISSET_ID);
174
  }
175
 
176
  public void setVendorIdIsSet(boolean value) {
177
    __isset_bit_vector.set(__VENDORID_ISSET_ID, value);
178
  }
179
 
180
  public String getItemKey() {
181
    return this.itemKey;
182
  }
183
 
184
  public void setItemKey(String itemKey) {
185
    this.itemKey = itemKey;
186
  }
187
 
188
  public void unsetItemKey() {
189
    this.itemKey = null;
190
  }
191
 
192
  /** Returns true if field itemKey is set (has been assigned a value) and false otherwise */
193
  public boolean isSetItemKey() {
194
    return this.itemKey != null;
195
  }
196
 
197
  public void setItemKeyIsSet(boolean value) {
198
    if (!value) {
199
      this.itemKey = null;
200
    }
201
  }
202
 
203
  public long getItemId() {
204
    return this.itemId;
205
  }
206
 
207
  public void setItemId(long itemId) {
208
    this.itemId = itemId;
209
    setItemIdIsSet(true);
210
  }
211
 
212
  public void unsetItemId() {
213
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
214
  }
215
 
216
  /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
217
  public boolean isSetItemId() {
218
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
219
  }
220
 
221
  public void setItemIdIsSet(boolean value) {
222
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
223
  }
224
 
225
  public void setFieldValue(_Fields field, Object value) {
226
    switch (field) {
227
    case VENDOR_ID:
228
      if (value == null) {
229
        unsetVendorId();
230
      } else {
231
        setVendorId((Long)value);
232
      }
233
      break;
234
 
235
    case ITEM_KEY:
236
      if (value == null) {
237
        unsetItemKey();
238
      } else {
239
        setItemKey((String)value);
240
      }
241
      break;
242
 
243
    case ITEM_ID:
244
      if (value == null) {
245
        unsetItemId();
246
      } else {
247
        setItemId((Long)value);
248
      }
249
      break;
250
 
251
    }
252
  }
253
 
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
256
    case VENDOR_ID:
257
      return Long.valueOf(getVendorId());
258
 
259
    case ITEM_KEY:
260
      return getItemKey();
261
 
262
    case ITEM_ID:
263
      return Long.valueOf(getItemId());
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 VENDOR_ID:
277
      return isSetVendorId();
278
    case ITEM_KEY:
279
      return isSetItemKey();
280
    case ITEM_ID:
281
      return isSetItemId();
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 VendorItemMapping)
291
      return this.equals((VendorItemMapping)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(VendorItemMapping that) {
296
    if (that == null)
297
      return false;
298
 
299
    boolean this_present_vendorId = true;
300
    boolean that_present_vendorId = true;
301
    if (this_present_vendorId || that_present_vendorId) {
302
      if (!(this_present_vendorId && that_present_vendorId))
303
        return false;
304
      if (this.vendorId != that.vendorId)
305
        return false;
306
    }
307
 
308
    boolean this_present_itemKey = true && this.isSetItemKey();
309
    boolean that_present_itemKey = true && that.isSetItemKey();
310
    if (this_present_itemKey || that_present_itemKey) {
311
      if (!(this_present_itemKey && that_present_itemKey))
312
        return false;
313
      if (!this.itemKey.equals(that.itemKey))
314
        return false;
315
    }
316
 
317
    boolean this_present_itemId = true;
318
    boolean that_present_itemId = true;
319
    if (this_present_itemId || that_present_itemId) {
320
      if (!(this_present_itemId && that_present_itemId))
321
        return false;
322
      if (this.itemId != that.itemId)
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(VendorItemMapping other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    VendorItemMapping typedOther = (VendorItemMapping)other;
341
 
342
    lastComparison = Boolean.valueOf(isSetVendorId()).compareTo(typedOther.isSetVendorId());
343
    if (lastComparison != 0) {
344
      return lastComparison;
345
    }
346
    if (isSetVendorId()) {
347
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.vendorId, typedOther.vendorId);
348
      if (lastComparison != 0) {
349
        return lastComparison;
350
      }
351
    }
352
    lastComparison = Boolean.valueOf(isSetItemKey()).compareTo(typedOther.isSetItemKey());
353
    if (lastComparison != 0) {
354
      return lastComparison;
355
    }
356
    if (isSetItemKey()) {
357
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemKey, typedOther.itemKey);
358
      if (lastComparison != 0) {
359
        return lastComparison;
360
      }
361
    }
362
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetItemId()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
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: // VENDOR_ID
390
          if (field.type == org.apache.thrift.protocol.TType.I64) {
391
            this.vendorId = iprot.readI64();
392
            setVendorIdIsSet(true);
393
          } else { 
394
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
395
          }
396
          break;
397
        case 2: // ITEM_KEY
398
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
399
            this.itemKey = iprot.readString();
400
          } else { 
401
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
402
          }
403
          break;
404
        case 3: // ITEM_ID
405
          if (field.type == org.apache.thrift.protocol.TType.I64) {
406
            this.itemId = iprot.readI64();
407
            setItemIdIsSet(true);
408
          } else { 
409
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
410
          }
411
          break;
412
        default:
413
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
414
      }
415
      iprot.readFieldEnd();
416
    }
417
    iprot.readStructEnd();
418
    validate();
419
  }
420
 
421
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
422
    validate();
423
 
424
    oprot.writeStructBegin(STRUCT_DESC);
425
    oprot.writeFieldBegin(VENDOR_ID_FIELD_DESC);
426
    oprot.writeI64(this.vendorId);
427
    oprot.writeFieldEnd();
428
    if (this.itemKey != null) {
429
      oprot.writeFieldBegin(ITEM_KEY_FIELD_DESC);
430
      oprot.writeString(this.itemKey);
431
      oprot.writeFieldEnd();
432
    }
433
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
434
    oprot.writeI64(this.itemId);
435
    oprot.writeFieldEnd();
436
    oprot.writeFieldStop();
437
    oprot.writeStructEnd();
438
  }
439
 
440
  @Override
441
  public String toString() {
442
    StringBuilder sb = new StringBuilder("VendorItemMapping(");
443
    boolean first = true;
444
 
445
    sb.append("vendorId:");
446
    sb.append(this.vendorId);
447
    first = false;
448
    if (!first) sb.append(", ");
449
    sb.append("itemKey:");
450
    if (this.itemKey == null) {
451
      sb.append("null");
452
    } else {
453
      sb.append(this.itemKey);
454
    }
455
    first = false;
456
    if (!first) sb.append(", ");
457
    sb.append("itemId:");
458
    sb.append(this.itemId);
459
    first = false;
460
    sb.append(")");
461
    return sb.toString();
462
  }
463
 
464
  public void validate() throws org.apache.thrift.TException {
465
    // check for required fields
466
  }
467
 
468
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
469
    try {
470
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
471
    } catch (org.apache.thrift.TException te) {
472
      throw new java.io.IOException(te);
473
    }
474
  }
475
 
476
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
477
    try {
478
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
479
      __isset_bit_vector = new BitSet(1);
480
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
481
    } catch (org.apache.thrift.TException te) {
482
      throw new java.io.IOException(te);
483
    }
484
  }
485
 
486
}
487