Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
553 chandransh 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 WidgetItem implements TBase<WidgetItem._Fields>, java.io.Serializable, Cloneable, Comparable<WidgetItem> {
27
  private static final TStruct STRUCT_DESC = new TStruct("WidgetItem");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", TType.I64, (short)2);
31
  private static final TField SNIPPET_FIELD_DESC = new TField("snippet", TType.STRING, (short)3);
32
  private static final TField ENABLED_FIELD_DESC = new TField("enabled", TType.BOOL, (short)4);
33
  private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)5);
34
 
35
  private long id;
36
  private long item_id;
37
  private String snippet;
38
  private boolean enabled;
39
  private long timestamp;
40
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
43
    ID((short)1, "id"),
44
    ITEM_ID((short)2, "item_id"),
45
    SNIPPET((short)3, "snippet"),
46
    ENABLED((short)4, "enabled"),
47
    TIMESTAMP((short)5, "timestamp");
48
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
 
52
    static {
53
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
54
        byId.put((int)field._thriftId, field);
55
        byName.put(field.getFieldName(), field);
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, or null if its not found.
61
     */
62
    public static _Fields findByThriftId(int fieldId) {
63
      return byId.get(fieldId);
64
    }
65
 
66
    /**
67
     * Find the _Fields constant that matches fieldId, throwing an exception
68
     * if it is not found.
69
     */
70
    public static _Fields findByThriftIdOrThrow(int fieldId) {
71
      _Fields fields = findByThriftId(fieldId);
72
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
73
      return fields;
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches name, or null if its not found.
78
     */
79
    public static _Fields findByName(String name) {
80
      return byName.get(name);
81
    }
82
 
83
    private final short _thriftId;
84
    private final String _fieldName;
85
 
86
    _Fields(short thriftId, String fieldName) {
87
      _thriftId = thriftId;
88
      _fieldName = fieldName;
89
    }
90
 
91
    public short getThriftFieldId() {
92
      return _thriftId;
93
    }
94
 
95
    public String getFieldName() {
96
      return _fieldName;
97
    }
98
  }
99
 
100
  // isset id assignments
101
  private static final int __ID_ISSET_ID = 0;
102
  private static final int __ITEM_ID_ISSET_ID = 1;
103
  private static final int __ENABLED_ISSET_ID = 2;
104
  private static final int __TIMESTAMP_ISSET_ID = 3;
105
  private BitSet __isset_bit_vector = new BitSet(4);
106
 
107
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
108
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.I64)));
110
    put(_Fields.ITEM_ID, new FieldMetaData("item_id", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.I64)));
112
    put(_Fields.SNIPPET, new FieldMetaData("snippet", TFieldRequirementType.DEFAULT, 
113
        new FieldValueMetaData(TType.STRING)));
114
    put(_Fields.ENABLED, new FieldMetaData("enabled", TFieldRequirementType.DEFAULT, 
115
        new FieldValueMetaData(TType.BOOL)));
116
    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
117
        new FieldValueMetaData(TType.I64)));
118
  }});
119
 
120
  static {
121
    FieldMetaData.addStructMetaDataMap(WidgetItem.class, metaDataMap);
122
  }
123
 
124
  public WidgetItem() {
125
  }
126
 
127
  public WidgetItem(
128
    long id,
129
    long item_id,
130
    String snippet,
131
    boolean enabled,
132
    long timestamp)
133
  {
134
    this();
135
    this.id = id;
136
    setIdIsSet(true);
137
    this.item_id = item_id;
138
    setItem_idIsSet(true);
139
    this.snippet = snippet;
140
    this.enabled = enabled;
141
    setEnabledIsSet(true);
142
    this.timestamp = timestamp;
143
    setTimestampIsSet(true);
144
  }
145
 
146
  /**
147
   * Performs a deep copy on <i>other</i>.
148
   */
149
  public WidgetItem(WidgetItem other) {
150
    __isset_bit_vector.clear();
151
    __isset_bit_vector.or(other.__isset_bit_vector);
152
    this.id = other.id;
153
    this.item_id = other.item_id;
154
    if (other.isSetSnippet()) {
155
      this.snippet = other.snippet;
156
    }
157
    this.enabled = other.enabled;
158
    this.timestamp = other.timestamp;
159
  }
160
 
161
  public WidgetItem deepCopy() {
162
    return new WidgetItem(this);
163
  }
164
 
165
  @Deprecated
166
  public WidgetItem clone() {
167
    return new WidgetItem(this);
168
  }
169
 
170
  public long getId() {
171
    return this.id;
172
  }
173
 
174
  public WidgetItem setId(long id) {
175
    this.id = id;
176
    setIdIsSet(true);
177
    return this;
178
  }
179
 
180
  public void unsetId() {
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
182
  }
183
 
184
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
185
  public boolean isSetId() {
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
187
  }
188
 
189
  public void setIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__ID_ISSET_ID, value);
191
  }
192
 
193
  public long getItem_id() {
194
    return this.item_id;
195
  }
196
 
197
  public WidgetItem setItem_id(long item_id) {
198
    this.item_id = item_id;
199
    setItem_idIsSet(true);
200
    return this;
201
  }
202
 
203
  public void unsetItem_id() {
204
    __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
205
  }
206
 
207
  /** Returns true if field item_id is set (has been asigned a value) and false otherwise */
208
  public boolean isSetItem_id() {
209
    return __isset_bit_vector.get(__ITEM_ID_ISSET_ID);
210
  }
211
 
212
  public void setItem_idIsSet(boolean value) {
213
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
214
  }
215
 
216
  public String getSnippet() {
217
    return this.snippet;
218
  }
219
 
220
  public WidgetItem setSnippet(String snippet) {
221
    this.snippet = snippet;
222
    return this;
223
  }
224
 
225
  public void unsetSnippet() {
226
    this.snippet = null;
227
  }
228
 
229
  /** Returns true if field snippet is set (has been asigned a value) and false otherwise */
230
  public boolean isSetSnippet() {
231
    return this.snippet != null;
232
  }
233
 
234
  public void setSnippetIsSet(boolean value) {
235
    if (!value) {
236
      this.snippet = null;
237
    }
238
  }
239
 
240
  public boolean isEnabled() {
241
    return this.enabled;
242
  }
243
 
244
  public WidgetItem setEnabled(boolean enabled) {
245
    this.enabled = enabled;
246
    setEnabledIsSet(true);
247
    return this;
248
  }
249
 
250
  public void unsetEnabled() {
251
    __isset_bit_vector.clear(__ENABLED_ISSET_ID);
252
  }
253
 
254
  /** Returns true if field enabled is set (has been asigned a value) and false otherwise */
255
  public boolean isSetEnabled() {
256
    return __isset_bit_vector.get(__ENABLED_ISSET_ID);
257
  }
258
 
259
  public void setEnabledIsSet(boolean value) {
260
    __isset_bit_vector.set(__ENABLED_ISSET_ID, value);
261
  }
262
 
263
  public long getTimestamp() {
264
    return this.timestamp;
265
  }
266
 
267
  public WidgetItem setTimestamp(long timestamp) {
268
    this.timestamp = timestamp;
269
    setTimestampIsSet(true);
270
    return this;
271
  }
272
 
273
  public void unsetTimestamp() {
274
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
275
  }
276
 
277
  /** Returns true if field timestamp is set (has been asigned a value) and false otherwise */
278
  public boolean isSetTimestamp() {
279
    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
280
  }
281
 
282
  public void setTimestampIsSet(boolean value) {
283
    __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
284
  }
285
 
286
  public void setFieldValue(_Fields field, Object value) {
287
    switch (field) {
288
    case ID:
289
      if (value == null) {
290
        unsetId();
291
      } else {
292
        setId((Long)value);
293
      }
294
      break;
295
 
296
    case ITEM_ID:
297
      if (value == null) {
298
        unsetItem_id();
299
      } else {
300
        setItem_id((Long)value);
301
      }
302
      break;
303
 
304
    case SNIPPET:
305
      if (value == null) {
306
        unsetSnippet();
307
      } else {
308
        setSnippet((String)value);
309
      }
310
      break;
311
 
312
    case ENABLED:
313
      if (value == null) {
314
        unsetEnabled();
315
      } else {
316
        setEnabled((Boolean)value);
317
      }
318
      break;
319
 
320
    case TIMESTAMP:
321
      if (value == null) {
322
        unsetTimestamp();
323
      } else {
324
        setTimestamp((Long)value);
325
      }
326
      break;
327
 
328
    }
329
  }
330
 
331
  public void setFieldValue(int fieldID, Object value) {
332
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
333
  }
334
 
335
  public Object getFieldValue(_Fields field) {
336
    switch (field) {
337
    case ID:
338
      return new Long(getId());
339
 
340
    case ITEM_ID:
341
      return new Long(getItem_id());
342
 
343
    case SNIPPET:
344
      return getSnippet();
345
 
346
    case ENABLED:
347
      return new Boolean(isEnabled());
348
 
349
    case TIMESTAMP:
350
      return new Long(getTimestamp());
351
 
352
    }
353
    throw new IllegalStateException();
354
  }
355
 
356
  public Object getFieldValue(int fieldId) {
357
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
358
  }
359
 
360
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
361
  public boolean isSet(_Fields field) {
362
    switch (field) {
363
    case ID:
364
      return isSetId();
365
    case ITEM_ID:
366
      return isSetItem_id();
367
    case SNIPPET:
368
      return isSetSnippet();
369
    case ENABLED:
370
      return isSetEnabled();
371
    case TIMESTAMP:
372
      return isSetTimestamp();
373
    }
374
    throw new IllegalStateException();
375
  }
376
 
377
  public boolean isSet(int fieldID) {
378
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
379
  }
380
 
381
  @Override
382
  public boolean equals(Object that) {
383
    if (that == null)
384
      return false;
385
    if (that instanceof WidgetItem)
386
      return this.equals((WidgetItem)that);
387
    return false;
388
  }
389
 
390
  public boolean equals(WidgetItem that) {
391
    if (that == null)
392
      return false;
393
 
394
    boolean this_present_id = true;
395
    boolean that_present_id = true;
396
    if (this_present_id || that_present_id) {
397
      if (!(this_present_id && that_present_id))
398
        return false;
399
      if (this.id != that.id)
400
        return false;
401
    }
402
 
403
    boolean this_present_item_id = true;
404
    boolean that_present_item_id = true;
405
    if (this_present_item_id || that_present_item_id) {
406
      if (!(this_present_item_id && that_present_item_id))
407
        return false;
408
      if (this.item_id != that.item_id)
409
        return false;
410
    }
411
 
412
    boolean this_present_snippet = true && this.isSetSnippet();
413
    boolean that_present_snippet = true && that.isSetSnippet();
414
    if (this_present_snippet || that_present_snippet) {
415
      if (!(this_present_snippet && that_present_snippet))
416
        return false;
417
      if (!this.snippet.equals(that.snippet))
418
        return false;
419
    }
420
 
421
    boolean this_present_enabled = true;
422
    boolean that_present_enabled = true;
423
    if (this_present_enabled || that_present_enabled) {
424
      if (!(this_present_enabled && that_present_enabled))
425
        return false;
426
      if (this.enabled != that.enabled)
427
        return false;
428
    }
429
 
430
    boolean this_present_timestamp = true;
431
    boolean that_present_timestamp = true;
432
    if (this_present_timestamp || that_present_timestamp) {
433
      if (!(this_present_timestamp && that_present_timestamp))
434
        return false;
435
      if (this.timestamp != that.timestamp)
436
        return false;
437
    }
438
 
439
    return true;
440
  }
441
 
442
  @Override
443
  public int hashCode() {
444
    return 0;
445
  }
446
 
447
  public int compareTo(WidgetItem other) {
448
    if (!getClass().equals(other.getClass())) {
449
      return getClass().getName().compareTo(other.getClass().getName());
450
    }
451
 
452
    int lastComparison = 0;
453
    WidgetItem typedOther = (WidgetItem)other;
454
 
455
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
456
    if (lastComparison != 0) {
457
      return lastComparison;
458
    }
459
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
460
    if (lastComparison != 0) {
461
      return lastComparison;
462
    }
463
    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
464
    if (lastComparison != 0) {
465
      return lastComparison;
466
    }
467
    lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
468
    if (lastComparison != 0) {
469
      return lastComparison;
470
    }
471
    lastComparison = Boolean.valueOf(isSetSnippet()).compareTo(isSetSnippet());
472
    if (lastComparison != 0) {
473
      return lastComparison;
474
    }
475
    lastComparison = TBaseHelper.compareTo(snippet, typedOther.snippet);
476
    if (lastComparison != 0) {
477
      return lastComparison;
478
    }
479
    lastComparison = Boolean.valueOf(isSetEnabled()).compareTo(isSetEnabled());
480
    if (lastComparison != 0) {
481
      return lastComparison;
482
    }
483
    lastComparison = TBaseHelper.compareTo(enabled, typedOther.enabled);
484
    if (lastComparison != 0) {
485
      return lastComparison;
486
    }
487
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
488
    if (lastComparison != 0) {
489
      return lastComparison;
490
    }
491
    lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
492
    if (lastComparison != 0) {
493
      return lastComparison;
494
    }
495
    return 0;
496
  }
497
 
498
  public void read(TProtocol iprot) throws TException {
499
    TField field;
500
    iprot.readStructBegin();
501
    while (true)
502
    {
503
      field = iprot.readFieldBegin();
504
      if (field.type == TType.STOP) { 
505
        break;
506
      }
507
      _Fields fieldId = _Fields.findByThriftId(field.id);
508
      if (fieldId == null) {
509
        TProtocolUtil.skip(iprot, field.type);
510
      } else {
511
        switch (fieldId) {
512
          case ID:
513
            if (field.type == TType.I64) {
514
              this.id = iprot.readI64();
515
              setIdIsSet(true);
516
            } else { 
517
              TProtocolUtil.skip(iprot, field.type);
518
            }
519
            break;
520
          case ITEM_ID:
521
            if (field.type == TType.I64) {
522
              this.item_id = iprot.readI64();
523
              setItem_idIsSet(true);
524
            } else { 
525
              TProtocolUtil.skip(iprot, field.type);
526
            }
527
            break;
528
          case SNIPPET:
529
            if (field.type == TType.STRING) {
530
              this.snippet = iprot.readString();
531
            } else { 
532
              TProtocolUtil.skip(iprot, field.type);
533
            }
534
            break;
535
          case ENABLED:
536
            if (field.type == TType.BOOL) {
537
              this.enabled = iprot.readBool();
538
              setEnabledIsSet(true);
539
            } else { 
540
              TProtocolUtil.skip(iprot, field.type);
541
            }
542
            break;
543
          case TIMESTAMP:
544
            if (field.type == TType.I64) {
545
              this.timestamp = iprot.readI64();
546
              setTimestampIsSet(true);
547
            } else { 
548
              TProtocolUtil.skip(iprot, field.type);
549
            }
550
            break;
551
        }
552
        iprot.readFieldEnd();
553
      }
554
    }
555
    iprot.readStructEnd();
556
    validate();
557
  }
558
 
559
  public void write(TProtocol oprot) throws TException {
560
    validate();
561
 
562
    oprot.writeStructBegin(STRUCT_DESC);
563
    oprot.writeFieldBegin(ID_FIELD_DESC);
564
    oprot.writeI64(this.id);
565
    oprot.writeFieldEnd();
566
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
567
    oprot.writeI64(this.item_id);
568
    oprot.writeFieldEnd();
569
    if (this.snippet != null) {
570
      oprot.writeFieldBegin(SNIPPET_FIELD_DESC);
571
      oprot.writeString(this.snippet);
572
      oprot.writeFieldEnd();
573
    }
574
    oprot.writeFieldBegin(ENABLED_FIELD_DESC);
575
    oprot.writeBool(this.enabled);
576
    oprot.writeFieldEnd();
577
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
578
    oprot.writeI64(this.timestamp);
579
    oprot.writeFieldEnd();
580
    oprot.writeFieldStop();
581
    oprot.writeStructEnd();
582
  }
583
 
584
  @Override
585
  public String toString() {
586
    StringBuilder sb = new StringBuilder("WidgetItem(");
587
    boolean first = true;
588
 
589
    sb.append("id:");
590
    sb.append(this.id);
591
    first = false;
592
    if (!first) sb.append(", ");
593
    sb.append("item_id:");
594
    sb.append(this.item_id);
595
    first = false;
596
    if (!first) sb.append(", ");
597
    sb.append("snippet:");
598
    if (this.snippet == null) {
599
      sb.append("null");
600
    } else {
601
      sb.append(this.snippet);
602
    }
603
    first = false;
604
    if (!first) sb.append(", ");
605
    sb.append("enabled:");
606
    sb.append(this.enabled);
607
    first = false;
608
    if (!first) sb.append(", ");
609
    sb.append("timestamp:");
610
    sb.append(this.timestamp);
611
    first = false;
612
    sb.append(")");
613
    return sb.toString();
614
  }
615
 
616
  public void validate() throws TException {
617
    // check for required fields
618
  }
619
 
620
}
621