Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4295 varun.gupt 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.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.nio.ByteBuffer;
19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
public class ProductNotificationRequestCount implements org.apache.thrift.TBase<ProductNotificationRequestCount, ProductNotificationRequestCount._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ProductNotificationRequestCount");
25
 
26
  private static final org.apache.thrift.protocol.TField ITEM_FIELD_DESC = new org.apache.thrift.protocol.TField("item", org.apache.thrift.protocol.TType.STRUCT, (short)1);
27
  private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I64, (short)2);
28
 
29
  private Item item; // required
30
  private long count; // required
31
 
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
34
    ITEM((short)1, "item"),
35
    COUNT((short)2, "count");
36
 
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
38
 
39
    static {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
41
        byName.put(field.getFieldName(), field);
42
      }
43
    }
44
 
45
    /**
46
     * Find the _Fields constant that matches fieldId, or null if its not found.
47
     */
48
    public static _Fields findByThriftId(int fieldId) {
49
      switch(fieldId) {
50
        case 1: // ITEM
51
          return ITEM;
52
        case 2: // COUNT
53
          return COUNT;
54
        default:
55
          return null;
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, throwing an exception
61
     * if it is not found.
62
     */
63
    public static _Fields findByThriftIdOrThrow(int fieldId) {
64
      _Fields fields = findByThriftId(fieldId);
65
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
66
      return fields;
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches name, or null if its not found.
71
     */
72
    public static _Fields findByName(String name) {
73
      return byName.get(name);
74
    }
75
 
76
    private final short _thriftId;
77
    private final String _fieldName;
78
 
79
    _Fields(short thriftId, String fieldName) {
80
      _thriftId = thriftId;
81
      _fieldName = fieldName;
82
    }
83
 
84
    public short getThriftFieldId() {
85
      return _thriftId;
86
    }
87
 
88
    public String getFieldName() {
89
      return _fieldName;
90
    }
91
  }
92
 
93
  // isset id assignments
94
  private static final int __COUNT_ISSET_ID = 0;
95
  private BitSet __isset_bit_vector = new BitSet(1);
96
 
97
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
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.ITEM, new org.apache.thrift.meta_data.FieldMetaData("item", org.apache.thrift.TFieldRequirementType.DEFAULT, 
101
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Item.class)));
102
    tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.DEFAULT, 
103
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
104
    metaDataMap = Collections.unmodifiableMap(tmpMap);
105
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ProductNotificationRequestCount.class, metaDataMap);
106
  }
107
 
108
  public ProductNotificationRequestCount() {
109
  }
110
 
111
  public ProductNotificationRequestCount(
112
    Item item,
113
    long count)
114
  {
115
    this();
116
    this.item = item;
117
    this.count = count;
118
    setCountIsSet(true);
119
  }
120
 
121
  /**
122
   * Performs a deep copy on <i>other</i>.
123
   */
124
  public ProductNotificationRequestCount(ProductNotificationRequestCount other) {
125
    __isset_bit_vector.clear();
126
    __isset_bit_vector.or(other.__isset_bit_vector);
127
    if (other.isSetItem()) {
128
      this.item = new Item(other.item);
129
    }
130
    this.count = other.count;
131
  }
132
 
133
  public ProductNotificationRequestCount deepCopy() {
134
    return new ProductNotificationRequestCount(this);
135
  }
136
 
137
  @Override
138
  public void clear() {
139
    this.item = null;
140
    setCountIsSet(false);
141
    this.count = 0;
142
  }
143
 
144
  public Item getItem() {
145
    return this.item;
146
  }
147
 
148
  public void setItem(Item item) {
149
    this.item = item;
150
  }
151
 
152
  public void unsetItem() {
153
    this.item = null;
154
  }
155
 
156
  /** Returns true if field item is set (has been assigned a value) and false otherwise */
157
  public boolean isSetItem() {
158
    return this.item != null;
159
  }
160
 
161
  public void setItemIsSet(boolean value) {
162
    if (!value) {
163
      this.item = null;
164
    }
165
  }
166
 
167
  public long getCount() {
168
    return this.count;
169
  }
170
 
171
  public void setCount(long count) {
172
    this.count = count;
173
    setCountIsSet(true);
174
  }
175
 
176
  public void unsetCount() {
177
    __isset_bit_vector.clear(__COUNT_ISSET_ID);
178
  }
179
 
180
  /** Returns true if field count is set (has been assigned a value) and false otherwise */
181
  public boolean isSetCount() {
182
    return __isset_bit_vector.get(__COUNT_ISSET_ID);
183
  }
184
 
185
  public void setCountIsSet(boolean value) {
186
    __isset_bit_vector.set(__COUNT_ISSET_ID, value);
187
  }
188
 
189
  public void setFieldValue(_Fields field, Object value) {
190
    switch (field) {
191
    case ITEM:
192
      if (value == null) {
193
        unsetItem();
194
      } else {
195
        setItem((Item)value);
196
      }
197
      break;
198
 
199
    case COUNT:
200
      if (value == null) {
201
        unsetCount();
202
      } else {
203
        setCount((Long)value);
204
      }
205
      break;
206
 
207
    }
208
  }
209
 
210
  public Object getFieldValue(_Fields field) {
211
    switch (field) {
212
    case ITEM:
213
      return getItem();
214
 
215
    case COUNT:
216
      return Long.valueOf(getCount());
217
 
218
    }
219
    throw new IllegalStateException();
220
  }
221
 
222
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
223
  public boolean isSet(_Fields field) {
224
    if (field == null) {
225
      throw new IllegalArgumentException();
226
    }
227
 
228
    switch (field) {
229
    case ITEM:
230
      return isSetItem();
231
    case COUNT:
232
      return isSetCount();
233
    }
234
    throw new IllegalStateException();
235
  }
236
 
237
  @Override
238
  public boolean equals(Object that) {
239
    if (that == null)
240
      return false;
241
    if (that instanceof ProductNotificationRequestCount)
242
      return this.equals((ProductNotificationRequestCount)that);
243
    return false;
244
  }
245
 
246
  public boolean equals(ProductNotificationRequestCount that) {
247
    if (that == null)
248
      return false;
249
 
250
    boolean this_present_item = true && this.isSetItem();
251
    boolean that_present_item = true && that.isSetItem();
252
    if (this_present_item || that_present_item) {
253
      if (!(this_present_item && that_present_item))
254
        return false;
255
      if (!this.item.equals(that.item))
256
        return false;
257
    }
258
 
259
    boolean this_present_count = true;
260
    boolean that_present_count = true;
261
    if (this_present_count || that_present_count) {
262
      if (!(this_present_count && that_present_count))
263
        return false;
264
      if (this.count != that.count)
265
        return false;
266
    }
267
 
268
    return true;
269
  }
270
 
271
  @Override
272
  public int hashCode() {
273
    return 0;
274
  }
275
 
276
  public int compareTo(ProductNotificationRequestCount other) {
277
    if (!getClass().equals(other.getClass())) {
278
      return getClass().getName().compareTo(other.getClass().getName());
279
    }
280
 
281
    int lastComparison = 0;
282
    ProductNotificationRequestCount typedOther = (ProductNotificationRequestCount)other;
283
 
284
    lastComparison = Boolean.valueOf(isSetItem()).compareTo(typedOther.isSetItem());
285
    if (lastComparison != 0) {
286
      return lastComparison;
287
    }
288
    if (isSetItem()) {
289
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.item, typedOther.item);
290
      if (lastComparison != 0) {
291
        return lastComparison;
292
      }
293
    }
294
    lastComparison = Boolean.valueOf(isSetCount()).compareTo(typedOther.isSetCount());
295
    if (lastComparison != 0) {
296
      return lastComparison;
297
    }
298
    if (isSetCount()) {
299
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, typedOther.count);
300
      if (lastComparison != 0) {
301
        return lastComparison;
302
      }
303
    }
304
    return 0;
305
  }
306
 
307
  public _Fields fieldForId(int fieldId) {
308
    return _Fields.findByThriftId(fieldId);
309
  }
310
 
311
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
312
    org.apache.thrift.protocol.TField field;
313
    iprot.readStructBegin();
314
    while (true)
315
    {
316
      field = iprot.readFieldBegin();
317
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
318
        break;
319
      }
320
      switch (field.id) {
321
        case 1: // ITEM
322
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
323
            this.item = new Item();
324
            this.item.read(iprot);
325
          } else { 
326
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
327
          }
328
          break;
329
        case 2: // COUNT
330
          if (field.type == org.apache.thrift.protocol.TType.I64) {
331
            this.count = iprot.readI64();
332
            setCountIsSet(true);
333
          } else { 
334
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
335
          }
336
          break;
337
        default:
338
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
339
      }
340
      iprot.readFieldEnd();
341
    }
342
    iprot.readStructEnd();
343
    validate();
344
  }
345
 
346
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
347
    validate();
348
 
349
    oprot.writeStructBegin(STRUCT_DESC);
350
    if (this.item != null) {
351
      oprot.writeFieldBegin(ITEM_FIELD_DESC);
352
      this.item.write(oprot);
353
      oprot.writeFieldEnd();
354
    }
355
    oprot.writeFieldBegin(COUNT_FIELD_DESC);
356
    oprot.writeI64(this.count);
357
    oprot.writeFieldEnd();
358
    oprot.writeFieldStop();
359
    oprot.writeStructEnd();
360
  }
361
 
362
  @Override
363
  public String toString() {
364
    StringBuilder sb = new StringBuilder("ProductNotificationRequestCount(");
365
    boolean first = true;
366
 
367
    sb.append("item:");
368
    if (this.item == null) {
369
      sb.append("null");
370
    } else {
371
      sb.append(this.item);
372
    }
373
    first = false;
374
    if (!first) sb.append(", ");
375
    sb.append("count:");
376
    sb.append(this.count);
377
    first = false;
378
    sb.append(")");
379
    return sb.toString();
380
  }
381
 
382
  public void validate() throws org.apache.thrift.TException {
383
    // check for required fields
384
  }
385
 
386
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
387
    try {
388
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
389
    } catch (org.apache.thrift.TException te) {
390
      throw new java.io.IOException(te);
391
    }
392
  }
393
 
394
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
395
    try {
396
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
397
      __isset_bit_vector = new BitSet(1);
398
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
399
    } catch (org.apache.thrift.TException te) {
400
      throw new java.io.IOException(te);
401
    }
402
  }
403
 
404
}
405