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 Widget implements TBase<Widget._Fields>, java.io.Serializable, Cloneable, Comparable<Widget> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Widget");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField TYPE_FIELD_DESC = new TField("type", TType.I32, (short)2);
31
  private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)3);
32
  private static final TField ITEMS_FIELD_DESC = new TField("items", TType.LIST, (short)4);
33
  private static final TField ENABLED_FIELD_DESC = new TField("enabled", TType.BOOL, (short)5);
34
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)6);
35
  private static final TField SESSION_ID_FIELD_DESC = new TField("session_id", TType.BOOL, (short)7);
36
 
37
  private long id;
38
  private WidgetType type;
39
  private long customer_id;
40
  private List<WidgetItem> items;
41
  private boolean enabled;
42
  private String name;
43
  private boolean session_id;
44
 
45
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
46
  public enum _Fields implements TFieldIdEnum {
47
    ID((short)1, "id"),
48
    /**
49
     * 
50
     * @see WidgetType
51
     */
52
    TYPE((short)2, "type"),
53
    CUSTOMER_ID((short)3, "customer_id"),
54
    ITEMS((short)4, "items"),
55
    ENABLED((short)5, "enabled"),
56
    NAME((short)6, "name"),
57
    SESSION_ID((short)7, "session_id");
58
 
59
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
60
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
61
 
62
    static {
63
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
64
        byId.put((int)field._thriftId, field);
65
        byName.put(field.getFieldName(), field);
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, or null if its not found.
71
     */
72
    public static _Fields findByThriftId(int fieldId) {
73
      return byId.get(fieldId);
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches fieldId, throwing an exception
78
     * if it is not found.
79
     */
80
    public static _Fields findByThriftIdOrThrow(int fieldId) {
81
      _Fields fields = findByThriftId(fieldId);
82
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
83
      return fields;
84
    }
85
 
86
    /**
87
     * Find the _Fields constant that matches name, or null if its not found.
88
     */
89
    public static _Fields findByName(String name) {
90
      return byName.get(name);
91
    }
92
 
93
    private final short _thriftId;
94
    private final String _fieldName;
95
 
96
    _Fields(short thriftId, String fieldName) {
97
      _thriftId = thriftId;
98
      _fieldName = fieldName;
99
    }
100
 
101
    public short getThriftFieldId() {
102
      return _thriftId;
103
    }
104
 
105
    public String getFieldName() {
106
      return _fieldName;
107
    }
108
  }
109
 
110
  // isset id assignments
111
  private static final int __ID_ISSET_ID = 0;
112
  private static final int __CUSTOMER_ID_ISSET_ID = 1;
113
  private static final int __ENABLED_ISSET_ID = 2;
114
  private static final int __SESSION_ID_ISSET_ID = 3;
115
  private BitSet __isset_bit_vector = new BitSet(4);
116
 
117
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
118
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
119
        new FieldValueMetaData(TType.I64)));
120
    put(_Fields.TYPE, new FieldMetaData("type", TFieldRequirementType.DEFAULT, 
121
        new EnumMetaData(TType.ENUM, WidgetType.class)));
122
    put(_Fields.CUSTOMER_ID, new FieldMetaData("customer_id", TFieldRequirementType.DEFAULT, 
123
        new FieldValueMetaData(TType.I64)));
124
    put(_Fields.ITEMS, new FieldMetaData("items", TFieldRequirementType.DEFAULT, 
125
        new ListMetaData(TType.LIST, 
126
            new StructMetaData(TType.STRUCT, WidgetItem.class))));
127
    put(_Fields.ENABLED, new FieldMetaData("enabled", TFieldRequirementType.DEFAULT, 
128
        new FieldValueMetaData(TType.BOOL)));
129
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
130
        new FieldValueMetaData(TType.STRING)));
131
    put(_Fields.SESSION_ID, new FieldMetaData("session_id", TFieldRequirementType.DEFAULT, 
132
        new FieldValueMetaData(TType.BOOL)));
133
  }});
134
 
135
  static {
136
    FieldMetaData.addStructMetaDataMap(Widget.class, metaDataMap);
137
  }
138
 
139
  public Widget() {
140
  }
141
 
142
  public Widget(
143
    long id,
144
    WidgetType type,
145
    long customer_id,
146
    List<WidgetItem> items,
147
    boolean enabled,
148
    String name,
149
    boolean session_id)
150
  {
151
    this();
152
    this.id = id;
153
    setIdIsSet(true);
154
    this.type = type;
155
    this.customer_id = customer_id;
156
    setCustomer_idIsSet(true);
157
    this.items = items;
158
    this.enabled = enabled;
159
    setEnabledIsSet(true);
160
    this.name = name;
161
    this.session_id = session_id;
162
    setSession_idIsSet(true);
163
  }
164
 
165
  /**
166
   * Performs a deep copy on <i>other</i>.
167
   */
168
  public Widget(Widget other) {
169
    __isset_bit_vector.clear();
170
    __isset_bit_vector.or(other.__isset_bit_vector);
171
    this.id = other.id;
172
    if (other.isSetType()) {
173
      this.type = other.type;
174
    }
175
    this.customer_id = other.customer_id;
176
    if (other.isSetItems()) {
177
      List<WidgetItem> __this__items = new ArrayList<WidgetItem>();
178
      for (WidgetItem other_element : other.items) {
179
        __this__items.add(new WidgetItem(other_element));
180
      }
181
      this.items = __this__items;
182
    }
183
    this.enabled = other.enabled;
184
    if (other.isSetName()) {
185
      this.name = other.name;
186
    }
187
    this.session_id = other.session_id;
188
  }
189
 
190
  public Widget deepCopy() {
191
    return new Widget(this);
192
  }
193
 
194
  @Deprecated
195
  public Widget clone() {
196
    return new Widget(this);
197
  }
198
 
199
  public long getId() {
200
    return this.id;
201
  }
202
 
203
  public Widget setId(long id) {
204
    this.id = id;
205
    setIdIsSet(true);
206
    return this;
207
  }
208
 
209
  public void unsetId() {
210
    __isset_bit_vector.clear(__ID_ISSET_ID);
211
  }
212
 
213
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
214
  public boolean isSetId() {
215
    return __isset_bit_vector.get(__ID_ISSET_ID);
216
  }
217
 
218
  public void setIdIsSet(boolean value) {
219
    __isset_bit_vector.set(__ID_ISSET_ID, value);
220
  }
221
 
222
  /**
223
   * 
224
   * @see WidgetType
225
   */
226
  public WidgetType getType() {
227
    return this.type;
228
  }
229
 
230
  /**
231
   * 
232
   * @see WidgetType
233
   */
234
  public Widget setType(WidgetType type) {
235
    this.type = type;
236
    return this;
237
  }
238
 
239
  public void unsetType() {
240
    this.type = null;
241
  }
242
 
243
  /** Returns true if field type is set (has been asigned a value) and false otherwise */
244
  public boolean isSetType() {
245
    return this.type != null;
246
  }
247
 
248
  public void setTypeIsSet(boolean value) {
249
    if (!value) {
250
      this.type = null;
251
    }
252
  }
253
 
254
  public long getCustomer_id() {
255
    return this.customer_id;
256
  }
257
 
258
  public Widget setCustomer_id(long customer_id) {
259
    this.customer_id = customer_id;
260
    setCustomer_idIsSet(true);
261
    return this;
262
  }
263
 
264
  public void unsetCustomer_id() {
265
    __isset_bit_vector.clear(__CUSTOMER_ID_ISSET_ID);
266
  }
267
 
268
  /** Returns true if field customer_id is set (has been asigned a value) and false otherwise */
269
  public boolean isSetCustomer_id() {
270
    return __isset_bit_vector.get(__CUSTOMER_ID_ISSET_ID);
271
  }
272
 
273
  public void setCustomer_idIsSet(boolean value) {
274
    __isset_bit_vector.set(__CUSTOMER_ID_ISSET_ID, value);
275
  }
276
 
277
  public int getItemsSize() {
278
    return (this.items == null) ? 0 : this.items.size();
279
  }
280
 
281
  public java.util.Iterator<WidgetItem> getItemsIterator() {
282
    return (this.items == null) ? null : this.items.iterator();
283
  }
284
 
285
  public void addToItems(WidgetItem elem) {
286
    if (this.items == null) {
287
      this.items = new ArrayList<WidgetItem>();
288
    }
289
    this.items.add(elem);
290
  }
291
 
292
  public List<WidgetItem> getItems() {
293
    return this.items;
294
  }
295
 
296
  public Widget setItems(List<WidgetItem> items) {
297
    this.items = items;
298
    return this;
299
  }
300
 
301
  public void unsetItems() {
302
    this.items = null;
303
  }
304
 
305
  /** Returns true if field items is set (has been asigned a value) and false otherwise */
306
  public boolean isSetItems() {
307
    return this.items != null;
308
  }
309
 
310
  public void setItemsIsSet(boolean value) {
311
    if (!value) {
312
      this.items = null;
313
    }
314
  }
315
 
316
  public boolean isEnabled() {
317
    return this.enabled;
318
  }
319
 
320
  public Widget setEnabled(boolean enabled) {
321
    this.enabled = enabled;
322
    setEnabledIsSet(true);
323
    return this;
324
  }
325
 
326
  public void unsetEnabled() {
327
    __isset_bit_vector.clear(__ENABLED_ISSET_ID);
328
  }
329
 
330
  /** Returns true if field enabled is set (has been asigned a value) and false otherwise */
331
  public boolean isSetEnabled() {
332
    return __isset_bit_vector.get(__ENABLED_ISSET_ID);
333
  }
334
 
335
  public void setEnabledIsSet(boolean value) {
336
    __isset_bit_vector.set(__ENABLED_ISSET_ID, value);
337
  }
338
 
339
  public String getName() {
340
    return this.name;
341
  }
342
 
343
  public Widget setName(String name) {
344
    this.name = name;
345
    return this;
346
  }
347
 
348
  public void unsetName() {
349
    this.name = null;
350
  }
351
 
352
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
353
  public boolean isSetName() {
354
    return this.name != null;
355
  }
356
 
357
  public void setNameIsSet(boolean value) {
358
    if (!value) {
359
      this.name = null;
360
    }
361
  }
362
 
363
  public boolean isSession_id() {
364
    return this.session_id;
365
  }
366
 
367
  public Widget setSession_id(boolean session_id) {
368
    this.session_id = session_id;
369
    setSession_idIsSet(true);
370
    return this;
371
  }
372
 
373
  public void unsetSession_id() {
374
    __isset_bit_vector.clear(__SESSION_ID_ISSET_ID);
375
  }
376
 
377
  /** Returns true if field session_id is set (has been asigned a value) and false otherwise */
378
  public boolean isSetSession_id() {
379
    return __isset_bit_vector.get(__SESSION_ID_ISSET_ID);
380
  }
381
 
382
  public void setSession_idIsSet(boolean value) {
383
    __isset_bit_vector.set(__SESSION_ID_ISSET_ID, value);
384
  }
385
 
386
  public void setFieldValue(_Fields field, Object value) {
387
    switch (field) {
388
    case ID:
389
      if (value == null) {
390
        unsetId();
391
      } else {
392
        setId((Long)value);
393
      }
394
      break;
395
 
396
    case TYPE:
397
      if (value == null) {
398
        unsetType();
399
      } else {
400
        setType((WidgetType)value);
401
      }
402
      break;
403
 
404
    case CUSTOMER_ID:
405
      if (value == null) {
406
        unsetCustomer_id();
407
      } else {
408
        setCustomer_id((Long)value);
409
      }
410
      break;
411
 
412
    case ITEMS:
413
      if (value == null) {
414
        unsetItems();
415
      } else {
416
        setItems((List<WidgetItem>)value);
417
      }
418
      break;
419
 
420
    case ENABLED:
421
      if (value == null) {
422
        unsetEnabled();
423
      } else {
424
        setEnabled((Boolean)value);
425
      }
426
      break;
427
 
428
    case NAME:
429
      if (value == null) {
430
        unsetName();
431
      } else {
432
        setName((String)value);
433
      }
434
      break;
435
 
436
    case SESSION_ID:
437
      if (value == null) {
438
        unsetSession_id();
439
      } else {
440
        setSession_id((Boolean)value);
441
      }
442
      break;
443
 
444
    }
445
  }
446
 
447
  public void setFieldValue(int fieldID, Object value) {
448
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
449
  }
450
 
451
  public Object getFieldValue(_Fields field) {
452
    switch (field) {
453
    case ID:
454
      return new Long(getId());
455
 
456
    case TYPE:
457
      return getType();
458
 
459
    case CUSTOMER_ID:
460
      return new Long(getCustomer_id());
461
 
462
    case ITEMS:
463
      return getItems();
464
 
465
    case ENABLED:
466
      return new Boolean(isEnabled());
467
 
468
    case NAME:
469
      return getName();
470
 
471
    case SESSION_ID:
472
      return new Boolean(isSession_id());
473
 
474
    }
475
    throw new IllegalStateException();
476
  }
477
 
478
  public Object getFieldValue(int fieldId) {
479
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
480
  }
481
 
482
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
483
  public boolean isSet(_Fields field) {
484
    switch (field) {
485
    case ID:
486
      return isSetId();
487
    case TYPE:
488
      return isSetType();
489
    case CUSTOMER_ID:
490
      return isSetCustomer_id();
491
    case ITEMS:
492
      return isSetItems();
493
    case ENABLED:
494
      return isSetEnabled();
495
    case NAME:
496
      return isSetName();
497
    case SESSION_ID:
498
      return isSetSession_id();
499
    }
500
    throw new IllegalStateException();
501
  }
502
 
503
  public boolean isSet(int fieldID) {
504
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
505
  }
506
 
507
  @Override
508
  public boolean equals(Object that) {
509
    if (that == null)
510
      return false;
511
    if (that instanceof Widget)
512
      return this.equals((Widget)that);
513
    return false;
514
  }
515
 
516
  public boolean equals(Widget that) {
517
    if (that == null)
518
      return false;
519
 
520
    boolean this_present_id = true;
521
    boolean that_present_id = true;
522
    if (this_present_id || that_present_id) {
523
      if (!(this_present_id && that_present_id))
524
        return false;
525
      if (this.id != that.id)
526
        return false;
527
    }
528
 
529
    boolean this_present_type = true && this.isSetType();
530
    boolean that_present_type = true && that.isSetType();
531
    if (this_present_type || that_present_type) {
532
      if (!(this_present_type && that_present_type))
533
        return false;
534
      if (!this.type.equals(that.type))
535
        return false;
536
    }
537
 
538
    boolean this_present_customer_id = true;
539
    boolean that_present_customer_id = true;
540
    if (this_present_customer_id || that_present_customer_id) {
541
      if (!(this_present_customer_id && that_present_customer_id))
542
        return false;
543
      if (this.customer_id != that.customer_id)
544
        return false;
545
    }
546
 
547
    boolean this_present_items = true && this.isSetItems();
548
    boolean that_present_items = true && that.isSetItems();
549
    if (this_present_items || that_present_items) {
550
      if (!(this_present_items && that_present_items))
551
        return false;
552
      if (!this.items.equals(that.items))
553
        return false;
554
    }
555
 
556
    boolean this_present_enabled = true;
557
    boolean that_present_enabled = true;
558
    if (this_present_enabled || that_present_enabled) {
559
      if (!(this_present_enabled && that_present_enabled))
560
        return false;
561
      if (this.enabled != that.enabled)
562
        return false;
563
    }
564
 
565
    boolean this_present_name = true && this.isSetName();
566
    boolean that_present_name = true && that.isSetName();
567
    if (this_present_name || that_present_name) {
568
      if (!(this_present_name && that_present_name))
569
        return false;
570
      if (!this.name.equals(that.name))
571
        return false;
572
    }
573
 
574
    boolean this_present_session_id = true;
575
    boolean that_present_session_id = true;
576
    if (this_present_session_id || that_present_session_id) {
577
      if (!(this_present_session_id && that_present_session_id))
578
        return false;
579
      if (this.session_id != that.session_id)
580
        return false;
581
    }
582
 
583
    return true;
584
  }
585
 
586
  @Override
587
  public int hashCode() {
588
    return 0;
589
  }
590
 
591
  public int compareTo(Widget other) {
592
    if (!getClass().equals(other.getClass())) {
593
      return getClass().getName().compareTo(other.getClass().getName());
594
    }
595
 
596
    int lastComparison = 0;
597
    Widget typedOther = (Widget)other;
598
 
599
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
600
    if (lastComparison != 0) {
601
      return lastComparison;
602
    }
603
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
604
    if (lastComparison != 0) {
605
      return lastComparison;
606
    }
607
    lastComparison = Boolean.valueOf(isSetType()).compareTo(isSetType());
608
    if (lastComparison != 0) {
609
      return lastComparison;
610
    }
611
    lastComparison = TBaseHelper.compareTo(type, typedOther.type);
612
    if (lastComparison != 0) {
613
      return lastComparison;
614
    }
615
    lastComparison = Boolean.valueOf(isSetCustomer_id()).compareTo(isSetCustomer_id());
616
    if (lastComparison != 0) {
617
      return lastComparison;
618
    }
619
    lastComparison = TBaseHelper.compareTo(customer_id, typedOther.customer_id);
620
    if (lastComparison != 0) {
621
      return lastComparison;
622
    }
623
    lastComparison = Boolean.valueOf(isSetItems()).compareTo(isSetItems());
624
    if (lastComparison != 0) {
625
      return lastComparison;
626
    }
627
    lastComparison = TBaseHelper.compareTo(items, typedOther.items);
628
    if (lastComparison != 0) {
629
      return lastComparison;
630
    }
631
    lastComparison = Boolean.valueOf(isSetEnabled()).compareTo(isSetEnabled());
632
    if (lastComparison != 0) {
633
      return lastComparison;
634
    }
635
    lastComparison = TBaseHelper.compareTo(enabled, typedOther.enabled);
636
    if (lastComparison != 0) {
637
      return lastComparison;
638
    }
639
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
640
    if (lastComparison != 0) {
641
      return lastComparison;
642
    }
643
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
644
    if (lastComparison != 0) {
645
      return lastComparison;
646
    }
647
    lastComparison = Boolean.valueOf(isSetSession_id()).compareTo(isSetSession_id());
648
    if (lastComparison != 0) {
649
      return lastComparison;
650
    }
651
    lastComparison = TBaseHelper.compareTo(session_id, typedOther.session_id);
652
    if (lastComparison != 0) {
653
      return lastComparison;
654
    }
655
    return 0;
656
  }
657
 
658
  public void read(TProtocol iprot) throws TException {
659
    TField field;
660
    iprot.readStructBegin();
661
    while (true)
662
    {
663
      field = iprot.readFieldBegin();
664
      if (field.type == TType.STOP) { 
665
        break;
666
      }
667
      _Fields fieldId = _Fields.findByThriftId(field.id);
668
      if (fieldId == null) {
669
        TProtocolUtil.skip(iprot, field.type);
670
      } else {
671
        switch (fieldId) {
672
          case ID:
673
            if (field.type == TType.I64) {
674
              this.id = iprot.readI64();
675
              setIdIsSet(true);
676
            } else { 
677
              TProtocolUtil.skip(iprot, field.type);
678
            }
679
            break;
680
          case TYPE:
681
            if (field.type == TType.I32) {
682
              this.type = WidgetType.findByValue(iprot.readI32());
683
            } else { 
684
              TProtocolUtil.skip(iprot, field.type);
685
            }
686
            break;
687
          case CUSTOMER_ID:
688
            if (field.type == TType.I64) {
689
              this.customer_id = iprot.readI64();
690
              setCustomer_idIsSet(true);
691
            } else { 
692
              TProtocolUtil.skip(iprot, field.type);
693
            }
694
            break;
695
          case ITEMS:
696
            if (field.type == TType.LIST) {
697
              {
571 rajveer 698
                TList _list17 = iprot.readListBegin();
699
                this.items = new ArrayList<WidgetItem>(_list17.size);
700
                for (int _i18 = 0; _i18 < _list17.size; ++_i18)
553 chandransh 701
                {
571 rajveer 702
                  WidgetItem _elem19;
703
                  _elem19 = new WidgetItem();
704
                  _elem19.read(iprot);
705
                  this.items.add(_elem19);
553 chandransh 706
                }
707
                iprot.readListEnd();
708
              }
709
            } else { 
710
              TProtocolUtil.skip(iprot, field.type);
711
            }
712
            break;
713
          case ENABLED:
714
            if (field.type == TType.BOOL) {
715
              this.enabled = iprot.readBool();
716
              setEnabledIsSet(true);
717
            } else { 
718
              TProtocolUtil.skip(iprot, field.type);
719
            }
720
            break;
721
          case NAME:
722
            if (field.type == TType.STRING) {
723
              this.name = iprot.readString();
724
            } else { 
725
              TProtocolUtil.skip(iprot, field.type);
726
            }
727
            break;
728
          case SESSION_ID:
729
            if (field.type == TType.BOOL) {
730
              this.session_id = iprot.readBool();
731
              setSession_idIsSet(true);
732
            } else { 
733
              TProtocolUtil.skip(iprot, field.type);
734
            }
735
            break;
736
        }
737
        iprot.readFieldEnd();
738
      }
739
    }
740
    iprot.readStructEnd();
741
    validate();
742
  }
743
 
744
  public void write(TProtocol oprot) throws TException {
745
    validate();
746
 
747
    oprot.writeStructBegin(STRUCT_DESC);
748
    oprot.writeFieldBegin(ID_FIELD_DESC);
749
    oprot.writeI64(this.id);
750
    oprot.writeFieldEnd();
751
    if (this.type != null) {
752
      oprot.writeFieldBegin(TYPE_FIELD_DESC);
753
      oprot.writeI32(this.type.getValue());
754
      oprot.writeFieldEnd();
755
    }
756
    oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);
757
    oprot.writeI64(this.customer_id);
758
    oprot.writeFieldEnd();
759
    if (this.items != null) {
760
      oprot.writeFieldBegin(ITEMS_FIELD_DESC);
761
      {
762
        oprot.writeListBegin(new TList(TType.STRUCT, this.items.size()));
571 rajveer 763
        for (WidgetItem _iter20 : this.items)
553 chandransh 764
        {
571 rajveer 765
          _iter20.write(oprot);
553 chandransh 766
        }
767
        oprot.writeListEnd();
768
      }
769
      oprot.writeFieldEnd();
770
    }
771
    oprot.writeFieldBegin(ENABLED_FIELD_DESC);
772
    oprot.writeBool(this.enabled);
773
    oprot.writeFieldEnd();
774
    if (this.name != null) {
775
      oprot.writeFieldBegin(NAME_FIELD_DESC);
776
      oprot.writeString(this.name);
777
      oprot.writeFieldEnd();
778
    }
779
    oprot.writeFieldBegin(SESSION_ID_FIELD_DESC);
780
    oprot.writeBool(this.session_id);
781
    oprot.writeFieldEnd();
782
    oprot.writeFieldStop();
783
    oprot.writeStructEnd();
784
  }
785
 
786
  @Override
787
  public String toString() {
788
    StringBuilder sb = new StringBuilder("Widget(");
789
    boolean first = true;
790
 
791
    sb.append("id:");
792
    sb.append(this.id);
793
    first = false;
794
    if (!first) sb.append(", ");
795
    sb.append("type:");
796
    if (this.type == null) {
797
      sb.append("null");
798
    } else {
799
      String type_name = type.name();
800
      if (type_name != null) {
801
        sb.append(type_name);
802
        sb.append(" (");
803
      }
804
      sb.append(this.type);
805
      if (type_name != null) {
806
        sb.append(")");
807
      }
808
    }
809
    first = false;
810
    if (!first) sb.append(", ");
811
    sb.append("customer_id:");
812
    sb.append(this.customer_id);
813
    first = false;
814
    if (!first) sb.append(", ");
815
    sb.append("items:");
816
    if (this.items == null) {
817
      sb.append("null");
818
    } else {
819
      sb.append(this.items);
820
    }
821
    first = false;
822
    if (!first) sb.append(", ");
823
    sb.append("enabled:");
824
    sb.append(this.enabled);
825
    first = false;
826
    if (!first) sb.append(", ");
827
    sb.append("name:");
828
    if (this.name == null) {
829
      sb.append("null");
830
    } else {
831
      sb.append(this.name);
832
    }
833
    first = false;
834
    if (!first) sb.append(", ");
835
    sb.append("session_id:");
836
    sb.append(this.session_id);
837
    first = false;
838
    sb.append(")");
839
    return sb.toString();
840
  }
841
 
842
  public void validate() throws TException {
843
    // check for required fields
844
  }
845
 
846
}
847