Subversion Repositories SmartDukaan

Rev

Rev 1013 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1013 Rev 3430
Line 1... Line 1...
1
/**
1
/**
2
 * Autogenerated by Thrift
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
5
 */
6
package in.shop2020.model.v1.catalog;
6
package in.shop2020.model.v1.catalog;
7
 
7
 
Line 13... Line 13...
13
import java.util.Set;
13
import java.util.Set;
14
import java.util.HashSet;
14
import java.util.HashSet;
15
import java.util.EnumSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
16
import java.util.Collections;
17
import java.util.BitSet;
17
import java.util.BitSet;
-
 
18
import java.nio.ByteBuffer;
18
import java.util.Arrays;
19
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
21
 
22
 
22
import org.apache.thrift.*;
-
 
23
import org.apache.thrift.meta_data.*;
23
public class ItemInventory implements org.apache.thrift.TBase<ItemInventory, ItemInventory._Fields>, java.io.Serializable, Cloneable {
24
import org.apache.thrift.protocol.*;
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemInventory");
25
 
25
 
26
public class ItemInventory implements TBase<ItemInventory._Fields>, java.io.Serializable, Cloneable {
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 TStruct STRUCT_DESC = new TStruct("ItemInventory");
27
  private static final org.apache.thrift.protocol.TField AVAILABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("availability", org.apache.thrift.protocol.TType.MAP, (short)2);
28
 
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
-
 
30
  private static final TField AVAILABILITY_FIELD_DESC = new TField("availability", TType.MAP, (short)2);
-
 
31
 
-
 
32
  private long id;
29
  private long id; // required
33
  private Map<Long,Long> availability;
30
  private Map<Long,Long> availability; // required
34
 
31
 
35
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
36
  public enum _Fields implements TFieldIdEnum {
33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
37
    ID((short)1, "id"),
34
    ID((short)1, "id"),
38
    AVAILABILITY((short)2, "availability");
35
    AVAILABILITY((short)2, "availability");
39
 
36
 
40
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
41
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
42
 
38
 
43
    static {
39
    static {
44
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
45
        byId.put((int)field._thriftId, field);
-
 
46
        byName.put(field.getFieldName(), field);
41
        byName.put(field.getFieldName(), field);
47
      }
42
      }
48
    }
43
    }
49
 
44
 
50
    /**
45
    /**
51
     * Find the _Fields constant that matches fieldId, or null if its not found.
46
     * Find the _Fields constant that matches fieldId, or null if its not found.
52
     */
47
     */
53
    public static _Fields findByThriftId(int fieldId) {
48
    public static _Fields findByThriftId(int fieldId) {
54
      return byId.get(fieldId);
49
      switch(fieldId) {
-
 
50
        case 1: // ID
-
 
51
          return ID;
-
 
52
        case 2: // AVAILABILITY
-
 
53
          return AVAILABILITY;
-
 
54
        default:
-
 
55
          return null;
-
 
56
      }
55
    }
57
    }
56
 
58
 
57
    /**
59
    /**
58
     * Find the _Fields constant that matches fieldId, throwing an exception
60
     * Find the _Fields constant that matches fieldId, throwing an exception
59
     * if it is not found.
61
     * if it is not found.
Line 90... Line 92...
90
 
92
 
91
  // isset id assignments
93
  // isset id assignments
92
  private static final int __ID_ISSET_ID = 0;
94
  private static final int __ID_ISSET_ID = 0;
93
  private BitSet __isset_bit_vector = new BitSet(1);
95
  private BitSet __isset_bit_vector = new BitSet(1);
94
 
96
 
95
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
97
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
96
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
-
 
97
        new FieldValueMetaData(TType.I64)));
-
 
98
    put(_Fields.AVAILABILITY, new FieldMetaData("availability", TFieldRequirementType.DEFAULT, 
-
 
99
        new MapMetaData(TType.MAP, 
-
 
100
            new FieldValueMetaData(TType.I64), 
-
 
101
            new FieldValueMetaData(TType.I64))));
-
 
102
  }});
-
 
103
 
-
 
104
  static {
98
  static {
-
 
99
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-
 
100
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
101
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-
 
102
    tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-
 
103
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
-
 
104
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
-
 
105
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
-
 
106
    metaDataMap = Collections.unmodifiableMap(tmpMap);
105
    FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
107
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);
106
  }
108
  }
107
 
109
 
108
  public ItemInventory() {
110
  public ItemInventory() {
109
  }
111
  }
110
 
112
 
Line 144... Line 146...
144
 
146
 
145
  public ItemInventory deepCopy() {
147
  public ItemInventory deepCopy() {
146
    return new ItemInventory(this);
148
    return new ItemInventory(this);
147
  }
149
  }
148
 
150
 
149
  @Deprecated
151
  @Override
150
  public ItemInventory clone() {
152
  public void clear() {
151
    return new ItemInventory(this);
153
    setIdIsSet(false);
-
 
154
    this.id = 0;
-
 
155
    this.availability = null;
152
  }
156
  }
153
 
157
 
154
  public long getId() {
158
  public long getId() {
155
    return this.id;
159
    return this.id;
156
  }
160
  }
157
 
161
 
158
  public ItemInventory setId(long id) {
162
  public void setId(long id) {
159
    this.id = id;
163
    this.id = id;
160
    setIdIsSet(true);
164
    setIdIsSet(true);
161
    return this;
-
 
162
  }
165
  }
163
 
166
 
164
  public void unsetId() {
167
  public void unsetId() {
165
    __isset_bit_vector.clear(__ID_ISSET_ID);
168
    __isset_bit_vector.clear(__ID_ISSET_ID);
166
  }
169
  }
167
 
170
 
168
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
171
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
169
  public boolean isSetId() {
172
  public boolean isSetId() {
170
    return __isset_bit_vector.get(__ID_ISSET_ID);
173
    return __isset_bit_vector.get(__ID_ISSET_ID);
171
  }
174
  }
172
 
175
 
173
  public void setIdIsSet(boolean value) {
176
  public void setIdIsSet(boolean value) {
Line 187... Line 190...
187
 
190
 
188
  public Map<Long,Long> getAvailability() {
191
  public Map<Long,Long> getAvailability() {
189
    return this.availability;
192
    return this.availability;
190
  }
193
  }
191
 
194
 
192
  public ItemInventory setAvailability(Map<Long,Long> availability) {
195
  public void setAvailability(Map<Long,Long> availability) {
193
    this.availability = availability;
196
    this.availability = availability;
194
    return this;
-
 
195
  }
197
  }
196
 
198
 
197
  public void unsetAvailability() {
199
  public void unsetAvailability() {
198
    this.availability = null;
200
    this.availability = null;
199
  }
201
  }
200
 
202
 
201
  /** Returns true if field availability is set (has been asigned a value) and false otherwise */
203
  /** Returns true if field availability is set (has been assigned a value) and false otherwise */
202
  public boolean isSetAvailability() {
204
  public boolean isSetAvailability() {
203
    return this.availability != null;
205
    return this.availability != null;
204
  }
206
  }
205
 
207
 
206
  public void setAvailabilityIsSet(boolean value) {
208
  public void setAvailabilityIsSet(boolean value) {
Line 228... Line 230...
228
      break;
230
      break;
229
 
231
 
230
    }
232
    }
231
  }
233
  }
232
 
234
 
233
  public void setFieldValue(int fieldID, Object value) {
-
 
234
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
235
  }
-
 
236
 
-
 
237
  public Object getFieldValue(_Fields field) {
235
  public Object getFieldValue(_Fields field) {
238
    switch (field) {
236
    switch (field) {
239
    case ID:
237
    case ID:
240
      return new Long(getId());
238
      return Long.valueOf(getId());
241
 
239
 
242
    case AVAILABILITY:
240
    case AVAILABILITY:
243
      return getAvailability();
241
      return getAvailability();
244
 
242
 
245
    }
243
    }
246
    throw new IllegalStateException();
244
    throw new IllegalStateException();
247
  }
245
  }
248
 
246
 
249
  public Object getFieldValue(int fieldId) {
-
 
250
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
251
  }
-
 
252
 
-
 
253
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
247
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
254
  public boolean isSet(_Fields field) {
248
  public boolean isSet(_Fields field) {
-
 
249
    if (field == null) {
-
 
250
      throw new IllegalArgumentException();
-
 
251
    }
-
 
252
 
255
    switch (field) {
253
    switch (field) {
256
    case ID:
254
    case ID:
257
      return isSetId();
255
      return isSetId();
258
    case AVAILABILITY:
256
    case AVAILABILITY:
259
      return isSetAvailability();
257
      return isSetAvailability();
260
    }
258
    }
261
    throw new IllegalStateException();
259
    throw new IllegalStateException();
262
  }
260
  }
263
 
261
 
264
  public boolean isSet(int fieldID) {
-
 
265
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
266
  }
-
 
267
 
-
 
268
  @Override
262
  @Override
269
  public boolean equals(Object that) {
263
  public boolean equals(Object that) {
270
    if (that == null)
264
    if (that == null)
271
      return false;
265
      return false;
272
    if (that instanceof ItemInventory)
266
    if (that instanceof ItemInventory)
Line 302... Line 296...
302
  @Override
296
  @Override
303
  public int hashCode() {
297
  public int hashCode() {
304
    return 0;
298
    return 0;
305
  }
299
  }
306
 
300
 
307
  public void read(TProtocol iprot) throws TException {
301
  public int compareTo(ItemInventory other) {
-
 
302
    if (!getClass().equals(other.getClass())) {
-
 
303
      return getClass().getName().compareTo(other.getClass().getName());
-
 
304
    }
-
 
305
 
-
 
306
    int lastComparison = 0;
-
 
307
    ItemInventory typedOther = (ItemInventory)other;
-
 
308
 
-
 
309
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
-
 
310
    if (lastComparison != 0) {
-
 
311
      return lastComparison;
-
 
312
    }
-
 
313
    if (isSetId()) {
-
 
314
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
-
 
315
      if (lastComparison != 0) {
-
 
316
        return lastComparison;
-
 
317
      }
-
 
318
    }
-
 
319
    lastComparison = Boolean.valueOf(isSetAvailability()).compareTo(typedOther.isSetAvailability());
-
 
320
    if (lastComparison != 0) {
-
 
321
      return lastComparison;
-
 
322
    }
-
 
323
    if (isSetAvailability()) {
-
 
324
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);
-
 
325
      if (lastComparison != 0) {
-
 
326
        return lastComparison;
-
 
327
      }
-
 
328
    }
308
    TField field;
329
    return 0;
-
 
330
  }
-
 
331
 
-
 
332
  public _Fields fieldForId(int fieldId) {
-
 
333
    return _Fields.findByThriftId(fieldId);
-
 
334
  }
-
 
335
 
-
 
336
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-
 
337
    org.apache.thrift.protocol.TField field;
309
    iprot.readStructBegin();
338
    iprot.readStructBegin();
310
    while (true)
339
    while (true)
311
    {
340
    {
312
      field = iprot.readFieldBegin();
341
      field = iprot.readFieldBegin();
313
      if (field.type == TType.STOP) { 
342
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
314
        break;
343
        break;
315
      }
344
      }
316
      _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
317
      if (fieldId == null) {
-
 
318
        TProtocolUtil.skip(iprot, field.type);
-
 
319
      } else {
-
 
320
        switch (fieldId) {
345
      switch (field.id) {
321
          case ID:
346
        case 1: // ID
322
            if (field.type == TType.I64) {
347
          if (field.type == org.apache.thrift.protocol.TType.I64) {
323
              this.id = iprot.readI64();
348
            this.id = iprot.readI64();
324
              setIdIsSet(true);
349
            setIdIsSet(true);
325
            } else { 
350
          } else { 
326
              TProtocolUtil.skip(iprot, field.type);
351
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
327
            }
352
          }
328
            break;
353
          break;
329
          case AVAILABILITY:
354
        case 2: // AVAILABILITY
330
            if (field.type == TType.MAP) {
355
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
-
 
356
            {
-
 
357
              org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
-
 
358
              this.availability = new HashMap<Long,Long>(2*_map0.size);
-
 
359
              for (int _i1 = 0; _i1 < _map0.size; ++_i1)
331
              {
360
              {
332
                TMap _map0 = iprot.readMapBegin();
-
 
333
                this.availability = new HashMap<Long,Long>(2*_map0.size);
-
 
334
                for (int _i1 = 0; _i1 < _map0.size; ++_i1)
-
 
335
                {
-
 
336
                  long _key2;
361
                long _key2; // required
337
                  long _val3;
362
                long _val3; // required
338
                  _key2 = iprot.readI64();
363
                _key2 = iprot.readI64();
339
                  _val3 = iprot.readI64();
364
                _val3 = iprot.readI64();
340
                  this.availability.put(_key2, _val3);
365
                this.availability.put(_key2, _val3);
341
                }
-
 
342
                iprot.readMapEnd();
-
 
343
              }
366
              }
344
            } else { 
367
              iprot.readMapEnd();
345
              TProtocolUtil.skip(iprot, field.type);
-
 
346
            }
368
            }
347
            break;
369
          } else { 
-
 
370
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
348
        }
371
          }
349
        iprot.readFieldEnd();
372
          break;
-
 
373
        default:
-
 
374
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
350
      }
375
      }
-
 
376
      iprot.readFieldEnd();
351
    }
377
    }
352
    iprot.readStructEnd();
378
    iprot.readStructEnd();
353
    validate();
379
    validate();
354
  }
380
  }
355
 
381
 
356
  public void write(TProtocol oprot) throws TException {
382
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
357
    validate();
383
    validate();
358
 
384
 
359
    oprot.writeStructBegin(STRUCT_DESC);
385
    oprot.writeStructBegin(STRUCT_DESC);
360
    oprot.writeFieldBegin(ID_FIELD_DESC);
386
    oprot.writeFieldBegin(ID_FIELD_DESC);
361
    oprot.writeI64(this.id);
387
    oprot.writeI64(this.id);
362
    oprot.writeFieldEnd();
388
    oprot.writeFieldEnd();
363
    if (this.availability != null) {
389
    if (this.availability != null) {
364
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
390
      oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
365
      {
391
      {
366
        oprot.writeMapBegin(new TMap(TType.I64, TType.I64, this.availability.size()));
392
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));
367
        for (Map.Entry<Long, Long> _iter4 : this.availability.entrySet())
393
        for (Map.Entry<Long, Long> _iter4 : this.availability.entrySet())
368
        {
394
        {
369
          oprot.writeI64(_iter4.getKey());
395
          oprot.writeI64(_iter4.getKey());
370
          oprot.writeI64(_iter4.getValue());
396
          oprot.writeI64(_iter4.getValue());
371
        }
397
        }
Line 395... Line 421...
395
    first = false;
421
    first = false;
396
    sb.append(")");
422
    sb.append(")");
397
    return sb.toString();
423
    return sb.toString();
398
  }
424
  }
399
 
425
 
400
  public void validate() throws TException {
426
  public void validate() throws org.apache.thrift.TException {
401
    // check for required fields
427
    // check for required fields
402
  }
428
  }
403
 
429
 
-
 
430
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-
 
431
    try {
-
 
432
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-
 
433
    } catch (org.apache.thrift.TException te) {
-
 
434
      throw new java.io.IOException(te);
-
 
435
    }
-
 
436
  }
-
 
437
 
-
 
438
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-
 
439
    try {
-
 
440
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-
 
441
      __isset_bit_vector = new BitSet(1);
-
 
442
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-
 
443
    } catch (org.apache.thrift.TException te) {
-
 
444
      throw new java.io.IOException(te);
-
 
445
    }
-
 
446
  }
-
 
447
 
404
}
448
}
405
 
449