Subversion Repositories SmartDukaan

Rev

Rev 2981 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2981 rajveer 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
2981 rajveer 3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.user;
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;
3430 rajveer 18
import java.nio.ByteBuffer;
2981 rajveer 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class UserWidgetItem implements org.apache.thrift.TBase<UserWidgetItem, UserWidgetItem._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserWidgetItem");
2981 rajveer 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField WIDGET_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("widgetId", org.apache.thrift.protocol.TType.I64, (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
  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)4);
2981 rajveer 30
 
3430 rajveer 31
  private long userId; // required
32
  private long widgetId; // required
33
  private long itemId; // required
34
  private long addedOn; // required
2981 rajveer 35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
2981 rajveer 38
    USER_ID((short)1, "userId"),
39
    WIDGET_ID((short)2, "widgetId"),
40
    ITEM_ID((short)3, "itemId"),
41
    ADDED_ON((short)4, "addedOn");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 55
      switch(fieldId) {
56
        case 1: // USER_ID
57
          return USER_ID;
58
        case 2: // WIDGET_ID
59
          return WIDGET_ID;
60
        case 3: // ITEM_ID
61
          return ITEM_ID;
62
        case 4: // ADDED_ON
63
          return ADDED_ON;
64
        default:
65
          return null;
66
      }
2981 rajveer 67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __USERID_ISSET_ID = 0;
105
  private static final int __WIDGETID_ISSET_ID = 1;
106
  private static final int __ITEMID_ISSET_ID = 2;
107
  private static final int __ADDEDON_ISSET_ID = 3;
108
  private BitSet __isset_bit_vector = new BitSet(4);
109
 
3430 rajveer 110
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
2981 rajveer 111
  static {
3430 rajveer 112
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
113
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
114
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
115
    tmpMap.put(_Fields.WIDGET_ID, new org.apache.thrift.meta_data.FieldMetaData("widgetId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
116
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
117
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
118
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
119
    tmpMap.put(_Fields.ADDED_ON, new org.apache.thrift.meta_data.FieldMetaData("addedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
120
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
121
    metaDataMap = Collections.unmodifiableMap(tmpMap);
122
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserWidgetItem.class, metaDataMap);
2981 rajveer 123
  }
124
 
125
  public UserWidgetItem() {
126
  }
127
 
128
  public UserWidgetItem(
129
    long userId,
130
    long widgetId,
131
    long itemId,
132
    long addedOn)
133
  {
134
    this();
135
    this.userId = userId;
136
    setUserIdIsSet(true);
137
    this.widgetId = widgetId;
138
    setWidgetIdIsSet(true);
139
    this.itemId = itemId;
140
    setItemIdIsSet(true);
141
    this.addedOn = addedOn;
142
    setAddedOnIsSet(true);
143
  }
144
 
145
  /**
146
   * Performs a deep copy on <i>other</i>.
147
   */
148
  public UserWidgetItem(UserWidgetItem other) {
149
    __isset_bit_vector.clear();
150
    __isset_bit_vector.or(other.__isset_bit_vector);
151
    this.userId = other.userId;
152
    this.widgetId = other.widgetId;
153
    this.itemId = other.itemId;
154
    this.addedOn = other.addedOn;
155
  }
156
 
157
  public UserWidgetItem deepCopy() {
158
    return new UserWidgetItem(this);
159
  }
160
 
3430 rajveer 161
  @Override
162
  public void clear() {
163
    setUserIdIsSet(false);
164
    this.userId = 0;
165
    setWidgetIdIsSet(false);
166
    this.widgetId = 0;
167
    setItemIdIsSet(false);
168
    this.itemId = 0;
169
    setAddedOnIsSet(false);
170
    this.addedOn = 0;
2981 rajveer 171
  }
172
 
173
  public long getUserId() {
174
    return this.userId;
175
  }
176
 
3430 rajveer 177
  public void setUserId(long userId) {
2981 rajveer 178
    this.userId = userId;
179
    setUserIdIsSet(true);
180
  }
181
 
182
  public void unsetUserId() {
183
    __isset_bit_vector.clear(__USERID_ISSET_ID);
184
  }
185
 
3430 rajveer 186
  /** Returns true if field userId is set (has been assigned a value) and false otherwise */
2981 rajveer 187
  public boolean isSetUserId() {
188
    return __isset_bit_vector.get(__USERID_ISSET_ID);
189
  }
190
 
191
  public void setUserIdIsSet(boolean value) {
192
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
193
  }
194
 
195
  public long getWidgetId() {
196
    return this.widgetId;
197
  }
198
 
3430 rajveer 199
  public void setWidgetId(long widgetId) {
2981 rajveer 200
    this.widgetId = widgetId;
201
    setWidgetIdIsSet(true);
202
  }
203
 
204
  public void unsetWidgetId() {
205
    __isset_bit_vector.clear(__WIDGETID_ISSET_ID);
206
  }
207
 
3430 rajveer 208
  /** Returns true if field widgetId is set (has been assigned a value) and false otherwise */
2981 rajveer 209
  public boolean isSetWidgetId() {
210
    return __isset_bit_vector.get(__WIDGETID_ISSET_ID);
211
  }
212
 
213
  public void setWidgetIdIsSet(boolean value) {
214
    __isset_bit_vector.set(__WIDGETID_ISSET_ID, value);
215
  }
216
 
217
  public long getItemId() {
218
    return this.itemId;
219
  }
220
 
3430 rajveer 221
  public void setItemId(long itemId) {
2981 rajveer 222
    this.itemId = itemId;
223
    setItemIdIsSet(true);
224
  }
225
 
226
  public void unsetItemId() {
227
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
228
  }
229
 
3430 rajveer 230
  /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
2981 rajveer 231
  public boolean isSetItemId() {
232
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
233
  }
234
 
235
  public void setItemIdIsSet(boolean value) {
236
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
237
  }
238
 
239
  public long getAddedOn() {
240
    return this.addedOn;
241
  }
242
 
3430 rajveer 243
  public void setAddedOn(long addedOn) {
2981 rajveer 244
    this.addedOn = addedOn;
245
    setAddedOnIsSet(true);
246
  }
247
 
248
  public void unsetAddedOn() {
249
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
250
  }
251
 
3430 rajveer 252
  /** Returns true if field addedOn is set (has been assigned a value) and false otherwise */
2981 rajveer 253
  public boolean isSetAddedOn() {
254
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
255
  }
256
 
257
  public void setAddedOnIsSet(boolean value) {
258
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case USER_ID:
264
      if (value == null) {
265
        unsetUserId();
266
      } else {
267
        setUserId((Long)value);
268
      }
269
      break;
270
 
271
    case WIDGET_ID:
272
      if (value == null) {
273
        unsetWidgetId();
274
      } else {
275
        setWidgetId((Long)value);
276
      }
277
      break;
278
 
279
    case ITEM_ID:
280
      if (value == null) {
281
        unsetItemId();
282
      } else {
283
        setItemId((Long)value);
284
      }
285
      break;
286
 
287
    case ADDED_ON:
288
      if (value == null) {
289
        unsetAddedOn();
290
      } else {
291
        setAddedOn((Long)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case USER_ID:
3430 rajveer 301
      return Long.valueOf(getUserId());
2981 rajveer 302
 
303
    case WIDGET_ID:
3430 rajveer 304
      return Long.valueOf(getWidgetId());
2981 rajveer 305
 
306
    case ITEM_ID:
3430 rajveer 307
      return Long.valueOf(getItemId());
2981 rajveer 308
 
309
    case ADDED_ON:
3430 rajveer 310
      return Long.valueOf(getAddedOn());
2981 rajveer 311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
3430 rajveer 316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
2981 rajveer 321
 
322
    switch (field) {
323
    case USER_ID:
324
      return isSetUserId();
325
    case WIDGET_ID:
326
      return isSetWidgetId();
327
    case ITEM_ID:
328
      return isSetItemId();
329
    case ADDED_ON:
330
      return isSetAddedOn();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof UserWidgetItem)
340
      return this.equals((UserWidgetItem)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(UserWidgetItem that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_userId = true;
349
    boolean that_present_userId = true;
350
    if (this_present_userId || that_present_userId) {
351
      if (!(this_present_userId && that_present_userId))
352
        return false;
353
      if (this.userId != that.userId)
354
        return false;
355
    }
356
 
357
    boolean this_present_widgetId = true;
358
    boolean that_present_widgetId = true;
359
    if (this_present_widgetId || that_present_widgetId) {
360
      if (!(this_present_widgetId && that_present_widgetId))
361
        return false;
362
      if (this.widgetId != that.widgetId)
363
        return false;
364
    }
365
 
366
    boolean this_present_itemId = true;
367
    boolean that_present_itemId = true;
368
    if (this_present_itemId || that_present_itemId) {
369
      if (!(this_present_itemId && that_present_itemId))
370
        return false;
371
      if (this.itemId != that.itemId)
372
        return false;
373
    }
374
 
375
    boolean this_present_addedOn = true;
376
    boolean that_present_addedOn = true;
377
    if (this_present_addedOn || that_present_addedOn) {
378
      if (!(this_present_addedOn && that_present_addedOn))
379
        return false;
380
      if (this.addedOn != that.addedOn)
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(UserWidgetItem other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    UserWidgetItem typedOther = (UserWidgetItem)other;
399
 
3430 rajveer 400
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId());
2981 rajveer 401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
3430 rajveer 404
    if (isSetUserId()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
2981 rajveer 409
    }
3430 rajveer 410
    lastComparison = Boolean.valueOf(isSetWidgetId()).compareTo(typedOther.isSetWidgetId());
2981 rajveer 411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
3430 rajveer 414
    if (isSetWidgetId()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.widgetId, typedOther.widgetId);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
2981 rajveer 419
    }
3430 rajveer 420
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
2981 rajveer 421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
3430 rajveer 424
    if (isSetItemId()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
2981 rajveer 429
    }
3430 rajveer 430
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(typedOther.isSetAddedOn());
2981 rajveer 431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
3430 rajveer 434
    if (isSetAddedOn()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addedOn, typedOther.addedOn);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
2981 rajveer 439
    }
440
    return 0;
441
  }
442
 
3430 rajveer 443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
2981 rajveer 449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
3430 rajveer 453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
2981 rajveer 454
        break;
455
      }
3430 rajveer 456
      switch (field.id) {
457
        case 1: // USER_ID
458
          if (field.type == org.apache.thrift.protocol.TType.I64) {
459
            this.userId = iprot.readI64();
460
            setUserIdIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // WIDGET_ID
466
          if (field.type == org.apache.thrift.protocol.TType.I64) {
467
            this.widgetId = iprot.readI64();
468
            setWidgetIdIsSet(true);
469
          } else { 
470
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
471
          }
472
          break;
473
        case 3: // ITEM_ID
474
          if (field.type == org.apache.thrift.protocol.TType.I64) {
475
            this.itemId = iprot.readI64();
476
            setItemIdIsSet(true);
477
          } else { 
478
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
479
          }
480
          break;
481
        case 4: // ADDED_ON
482
          if (field.type == org.apache.thrift.protocol.TType.I64) {
483
            this.addedOn = iprot.readI64();
484
            setAddedOnIsSet(true);
485
          } else { 
486
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
487
          }
488
          break;
489
        default:
490
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
2981 rajveer 491
      }
3430 rajveer 492
      iprot.readFieldEnd();
2981 rajveer 493
    }
494
    iprot.readStructEnd();
495
    validate();
496
  }
497
 
3430 rajveer 498
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
2981 rajveer 499
    validate();
500
 
501
    oprot.writeStructBegin(STRUCT_DESC);
502
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
503
    oprot.writeI64(this.userId);
504
    oprot.writeFieldEnd();
505
    oprot.writeFieldBegin(WIDGET_ID_FIELD_DESC);
506
    oprot.writeI64(this.widgetId);
507
    oprot.writeFieldEnd();
508
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
509
    oprot.writeI64(this.itemId);
510
    oprot.writeFieldEnd();
511
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
512
    oprot.writeI64(this.addedOn);
513
    oprot.writeFieldEnd();
514
    oprot.writeFieldStop();
515
    oprot.writeStructEnd();
516
  }
517
 
518
  @Override
519
  public String toString() {
520
    StringBuilder sb = new StringBuilder("UserWidgetItem(");
521
    boolean first = true;
522
 
523
    sb.append("userId:");
524
    sb.append(this.userId);
525
    first = false;
526
    if (!first) sb.append(", ");
527
    sb.append("widgetId:");
528
    sb.append(this.widgetId);
529
    first = false;
530
    if (!first) sb.append(", ");
531
    sb.append("itemId:");
532
    sb.append(this.itemId);
533
    first = false;
534
    if (!first) sb.append(", ");
535
    sb.append("addedOn:");
536
    sb.append(this.addedOn);
537
    first = false;
538
    sb.append(")");
539
    return sb.toString();
540
  }
541
 
3430 rajveer 542
  public void validate() throws org.apache.thrift.TException {
2981 rajveer 543
    // check for required fields
544
  }
545
 
3430 rajveer 546
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
547
    try {
548
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
549
    } catch (org.apache.thrift.TException te) {
550
      throw new java.io.IOException(te);
551
    }
552
  }
553
 
554
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
555
    try {
556
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
557
      __isset_bit_vector = new BitSet(1);
558
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
559
    } catch (org.apache.thrift.TException te) {
560
      throw new java.io.IOException(te);
561
    }
562
  }
563
 
2981 rajveer 564
}
565