Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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