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