Subversion Repositories SmartDukaan

Rev

Go to most recent revision | 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
/**
27
 * The user structure holding the basic information that identifies the user.
28
 * *
29
 */
30
public class User implements TBase<User._Fields>, java.io.Serializable, Cloneable {
31
  private static final TStruct STRUCT_DESC = new TStruct("User");
32
 
33
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
34
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)2);
35
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)3);
36
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)4);
37
  private static final TField DATE_OF_BIRTH_FIELD_DESC = new TField("dateOfBirth", TType.I64, (short)5);
38
  private static final TField SEX_FIELD_DESC = new TField("sex", TType.I32, (short)6);
39
  private static final TField PHONES_FIELD_DESC = new TField("phones", TType.SET, (short)7);
40
  private static final TField SOCIAL_HANDLES_FIELD_DESC = new TField("socialHandles", TType.STRUCT, (short)8);
41
  private static final TField ADDRESSES_FIELD_DESC = new TField("addresses", TType.LIST, (short)9);
42
  private static final TField DEFAULT_ADDRESS_ID_FIELD_DESC = new TField("defaultAddressId", TType.I64, (short)10);
43
  private static final TField COMMUNICATION_EMAIL_FIELD_DESC = new TField("communicationEmail", TType.STRING, (short)11);
44
  private static final TField ACTIVE_CART_ID_FIELD_DESC = new TField("activeCartId", TType.I64, (short)12);
45
  private static final TField JSESSION_ID_FIELD_DESC = new TField("jsessionId", TType.STRING, (short)13);
46
  private static final TField IS_ANONYMOUS_FIELD_DESC = new TField("isAnonymous", TType.BOOL, (short)14);
47
 
48
  private long userId;
49
  private String email;
50
  private String password;
51
  private String name;
52
  private long dateOfBirth;
53
  private Sex sex;
54
  private Set<Phone> phones;
55
  private SocialHandles socialHandles;
56
  private List<Address> addresses;
57
  private long defaultAddressId;
58
  private String communicationEmail;
59
  private long activeCartId;
60
  private String jsessionId;
61
  private boolean isAnonymous;
62
 
63
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
64
  public enum _Fields implements TFieldIdEnum {
65
    USER_ID((short)1, "userId"),
66
    EMAIL((short)2, "email"),
67
    PASSWORD((short)3, "password"),
68
    NAME((short)4, "name"),
69
    DATE_OF_BIRTH((short)5, "dateOfBirth"),
70
    /**
71
     * 
72
     * @see Sex
73
     */
74
    SEX((short)6, "sex"),
75
    PHONES((short)7, "phones"),
76
    SOCIAL_HANDLES((short)8, "socialHandles"),
77
    ADDRESSES((short)9, "addresses"),
78
    DEFAULT_ADDRESS_ID((short)10, "defaultAddressId"),
79
    COMMUNICATION_EMAIL((short)11, "communicationEmail"),
80
    ACTIVE_CART_ID((short)12, "activeCartId"),
81
    JSESSION_ID((short)13, "jsessionId"),
82
    IS_ANONYMOUS((short)14, "isAnonymous");
83
 
84
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
85
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
86
 
87
    static {
88
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
89
        byId.put((int)field._thriftId, field);
90
        byName.put(field.getFieldName(), field);
91
      }
92
    }
93
 
94
    /**
95
     * Find the _Fields constant that matches fieldId, or null if its not found.
96
     */
97
    public static _Fields findByThriftId(int fieldId) {
98
      return byId.get(fieldId);
99
    }
100
 
101
    /**
102
     * Find the _Fields constant that matches fieldId, throwing an exception
103
     * if it is not found.
104
     */
105
    public static _Fields findByThriftIdOrThrow(int fieldId) {
106
      _Fields fields = findByThriftId(fieldId);
107
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
108
      return fields;
109
    }
110
 
111
    /**
112
     * Find the _Fields constant that matches name, or null if its not found.
113
     */
114
    public static _Fields findByName(String name) {
115
      return byName.get(name);
116
    }
117
 
118
    private final short _thriftId;
119
    private final String _fieldName;
120
 
121
    _Fields(short thriftId, String fieldName) {
122
      _thriftId = thriftId;
123
      _fieldName = fieldName;
124
    }
125
 
126
    public short getThriftFieldId() {
127
      return _thriftId;
128
    }
129
 
130
    public String getFieldName() {
131
      return _fieldName;
132
    }
133
  }
134
 
135
  // isset id assignments
136
  private static final int __USERID_ISSET_ID = 0;
137
  private static final int __DATEOFBIRTH_ISSET_ID = 1;
138
  private static final int __DEFAULTADDRESSID_ISSET_ID = 2;
139
  private static final int __ACTIVECARTID_ISSET_ID = 3;
140
  private static final int __ISANONYMOUS_ISSET_ID = 4;
141
  private BitSet __isset_bit_vector = new BitSet(5);
142
 
143
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
144
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
145
        new FieldValueMetaData(TType.I64)));
146
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
147
        new FieldValueMetaData(TType.STRING)));
148
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
149
        new FieldValueMetaData(TType.STRING)));
150
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
151
        new FieldValueMetaData(TType.STRING)));
152
    put(_Fields.DATE_OF_BIRTH, new FieldMetaData("dateOfBirth", TFieldRequirementType.DEFAULT, 
153
        new FieldValueMetaData(TType.I64)));
154
    put(_Fields.SEX, new FieldMetaData("sex", TFieldRequirementType.DEFAULT, 
155
        new EnumMetaData(TType.ENUM, Sex.class)));
156
    put(_Fields.PHONES, new FieldMetaData("phones", TFieldRequirementType.DEFAULT, 
157
        new SetMetaData(TType.SET, 
158
            new StructMetaData(TType.STRUCT, Phone.class))));
159
    put(_Fields.SOCIAL_HANDLES, new FieldMetaData("socialHandles", TFieldRequirementType.DEFAULT, 
160
        new StructMetaData(TType.STRUCT, SocialHandles.class)));
161
    put(_Fields.ADDRESSES, new FieldMetaData("addresses", TFieldRequirementType.DEFAULT, 
162
        new ListMetaData(TType.LIST, 
163
            new StructMetaData(TType.STRUCT, Address.class))));
164
    put(_Fields.DEFAULT_ADDRESS_ID, new FieldMetaData("defaultAddressId", TFieldRequirementType.DEFAULT, 
165
        new FieldValueMetaData(TType.I64)));
166
    put(_Fields.COMMUNICATION_EMAIL, new FieldMetaData("communicationEmail", TFieldRequirementType.DEFAULT, 
167
        new FieldValueMetaData(TType.STRING)));
168
    put(_Fields.ACTIVE_CART_ID, new FieldMetaData("activeCartId", TFieldRequirementType.DEFAULT, 
169
        new FieldValueMetaData(TType.I64)));
170
    put(_Fields.JSESSION_ID, new FieldMetaData("jsessionId", TFieldRequirementType.DEFAULT, 
171
        new FieldValueMetaData(TType.STRING)));
172
    put(_Fields.IS_ANONYMOUS, new FieldMetaData("isAnonymous", TFieldRequirementType.DEFAULT, 
173
        new FieldValueMetaData(TType.BOOL)));
174
  }});
175
 
176
  static {
177
    FieldMetaData.addStructMetaDataMap(User.class, metaDataMap);
178
  }
179
 
180
  public User() {
181
  }
182
 
183
  public User(
184
    long userId,
185
    String email,
186
    String password,
187
    String name,
188
    long dateOfBirth,
189
    Sex sex,
190
    Set<Phone> phones,
191
    SocialHandles socialHandles,
192
    List<Address> addresses,
193
    long defaultAddressId,
194
    String communicationEmail,
195
    long activeCartId,
196
    String jsessionId,
197
    boolean isAnonymous)
198
  {
199
    this();
200
    this.userId = userId;
201
    setUserIdIsSet(true);
202
    this.email = email;
203
    this.password = password;
204
    this.name = name;
205
    this.dateOfBirth = dateOfBirth;
206
    setDateOfBirthIsSet(true);
207
    this.sex = sex;
208
    this.phones = phones;
209
    this.socialHandles = socialHandles;
210
    this.addresses = addresses;
211
    this.defaultAddressId = defaultAddressId;
212
    setDefaultAddressIdIsSet(true);
213
    this.communicationEmail = communicationEmail;
214
    this.activeCartId = activeCartId;
215
    setActiveCartIdIsSet(true);
216
    this.jsessionId = jsessionId;
217
    this.isAnonymous = isAnonymous;
218
    setIsAnonymousIsSet(true);
219
  }
220
 
221
  /**
222
   * Performs a deep copy on <i>other</i>.
223
   */
224
  public User(User other) {
225
    __isset_bit_vector.clear();
226
    __isset_bit_vector.or(other.__isset_bit_vector);
227
    this.userId = other.userId;
228
    if (other.isSetEmail()) {
229
      this.email = other.email;
230
    }
231
    if (other.isSetPassword()) {
232
      this.password = other.password;
233
    }
234
    if (other.isSetName()) {
235
      this.name = other.name;
236
    }
237
    this.dateOfBirth = other.dateOfBirth;
238
    if (other.isSetSex()) {
239
      this.sex = other.sex;
240
    }
241
    if (other.isSetPhones()) {
242
      Set<Phone> __this__phones = new HashSet<Phone>();
243
      for (Phone other_element : other.phones) {
244
        __this__phones.add(new Phone(other_element));
245
      }
246
      this.phones = __this__phones;
247
    }
248
    if (other.isSetSocialHandles()) {
249
      this.socialHandles = new SocialHandles(other.socialHandles);
250
    }
251
    if (other.isSetAddresses()) {
252
      List<Address> __this__addresses = new ArrayList<Address>();
253
      for (Address other_element : other.addresses) {
254
        __this__addresses.add(new Address(other_element));
255
      }
256
      this.addresses = __this__addresses;
257
    }
258
    this.defaultAddressId = other.defaultAddressId;
259
    if (other.isSetCommunicationEmail()) {
260
      this.communicationEmail = other.communicationEmail;
261
    }
262
    this.activeCartId = other.activeCartId;
263
    if (other.isSetJsessionId()) {
264
      this.jsessionId = other.jsessionId;
265
    }
266
    this.isAnonymous = other.isAnonymous;
267
  }
268
 
269
  public User deepCopy() {
270
    return new User(this);
271
  }
272
 
273
  @Deprecated
274
  public User clone() {
275
    return new User(this);
276
  }
277
 
278
  public long getUserId() {
279
    return this.userId;
280
  }
281
 
282
  public User setUserId(long userId) {
283
    this.userId = userId;
284
    setUserIdIsSet(true);
285
    return this;
286
  }
287
 
288
  public void unsetUserId() {
289
    __isset_bit_vector.clear(__USERID_ISSET_ID);
290
  }
291
 
292
  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
293
  public boolean isSetUserId() {
294
    return __isset_bit_vector.get(__USERID_ISSET_ID);
295
  }
296
 
297
  public void setUserIdIsSet(boolean value) {
298
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
299
  }
300
 
301
  public String getEmail() {
302
    return this.email;
303
  }
304
 
305
  public User setEmail(String email) {
306
    this.email = email;
307
    return this;
308
  }
309
 
310
  public void unsetEmail() {
311
    this.email = null;
312
  }
313
 
314
  /** Returns true if field email is set (has been asigned a value) and false otherwise */
315
  public boolean isSetEmail() {
316
    return this.email != null;
317
  }
318
 
319
  public void setEmailIsSet(boolean value) {
320
    if (!value) {
321
      this.email = null;
322
    }
323
  }
324
 
325
  public String getPassword() {
326
    return this.password;
327
  }
328
 
329
  public User setPassword(String password) {
330
    this.password = password;
331
    return this;
332
  }
333
 
334
  public void unsetPassword() {
335
    this.password = null;
336
  }
337
 
338
  /** Returns true if field password is set (has been asigned a value) and false otherwise */
339
  public boolean isSetPassword() {
340
    return this.password != null;
341
  }
342
 
343
  public void setPasswordIsSet(boolean value) {
344
    if (!value) {
345
      this.password = null;
346
    }
347
  }
348
 
349
  public String getName() {
350
    return this.name;
351
  }
352
 
353
  public User setName(String name) {
354
    this.name = name;
355
    return this;
356
  }
357
 
358
  public void unsetName() {
359
    this.name = null;
360
  }
361
 
362
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
363
  public boolean isSetName() {
364
    return this.name != null;
365
  }
366
 
367
  public void setNameIsSet(boolean value) {
368
    if (!value) {
369
      this.name = null;
370
    }
371
  }
372
 
373
  public long getDateOfBirth() {
374
    return this.dateOfBirth;
375
  }
376
 
377
  public User setDateOfBirth(long dateOfBirth) {
378
    this.dateOfBirth = dateOfBirth;
379
    setDateOfBirthIsSet(true);
380
    return this;
381
  }
382
 
383
  public void unsetDateOfBirth() {
384
    __isset_bit_vector.clear(__DATEOFBIRTH_ISSET_ID);
385
  }
386
 
387
  /** Returns true if field dateOfBirth is set (has been asigned a value) and false otherwise */
388
  public boolean isSetDateOfBirth() {
389
    return __isset_bit_vector.get(__DATEOFBIRTH_ISSET_ID);
390
  }
391
 
392
  public void setDateOfBirthIsSet(boolean value) {
393
    __isset_bit_vector.set(__DATEOFBIRTH_ISSET_ID, value);
394
  }
395
 
396
  /**
397
   * 
398
   * @see Sex
399
   */
400
  public Sex getSex() {
401
    return this.sex;
402
  }
403
 
404
  /**
405
   * 
406
   * @see Sex
407
   */
408
  public User setSex(Sex sex) {
409
    this.sex = sex;
410
    return this;
411
  }
412
 
413
  public void unsetSex() {
414
    this.sex = null;
415
  }
416
 
417
  /** Returns true if field sex is set (has been asigned a value) and false otherwise */
418
  public boolean isSetSex() {
419
    return this.sex != null;
420
  }
421
 
422
  public void setSexIsSet(boolean value) {
423
    if (!value) {
424
      this.sex = null;
425
    }
426
  }
427
 
428
  public int getPhonesSize() {
429
    return (this.phones == null) ? 0 : this.phones.size();
430
  }
431
 
432
  public java.util.Iterator<Phone> getPhonesIterator() {
433
    return (this.phones == null) ? null : this.phones.iterator();
434
  }
435
 
436
  public void addToPhones(Phone elem) {
437
    if (this.phones == null) {
438
      this.phones = new HashSet<Phone>();
439
    }
440
    this.phones.add(elem);
441
  }
442
 
443
  public Set<Phone> getPhones() {
444
    return this.phones;
445
  }
446
 
447
  public User setPhones(Set<Phone> phones) {
448
    this.phones = phones;
449
    return this;
450
  }
451
 
452
  public void unsetPhones() {
453
    this.phones = null;
454
  }
455
 
456
  /** Returns true if field phones is set (has been asigned a value) and false otherwise */
457
  public boolean isSetPhones() {
458
    return this.phones != null;
459
  }
460
 
461
  public void setPhonesIsSet(boolean value) {
462
    if (!value) {
463
      this.phones = null;
464
    }
465
  }
466
 
467
  public SocialHandles getSocialHandles() {
468
    return this.socialHandles;
469
  }
470
 
471
  public User setSocialHandles(SocialHandles socialHandles) {
472
    this.socialHandles = socialHandles;
473
    return this;
474
  }
475
 
476
  public void unsetSocialHandles() {
477
    this.socialHandles = null;
478
  }
479
 
480
  /** Returns true if field socialHandles is set (has been asigned a value) and false otherwise */
481
  public boolean isSetSocialHandles() {
482
    return this.socialHandles != null;
483
  }
484
 
485
  public void setSocialHandlesIsSet(boolean value) {
486
    if (!value) {
487
      this.socialHandles = null;
488
    }
489
  }
490
 
491
  public int getAddressesSize() {
492
    return (this.addresses == null) ? 0 : this.addresses.size();
493
  }
494
 
495
  public java.util.Iterator<Address> getAddressesIterator() {
496
    return (this.addresses == null) ? null : this.addresses.iterator();
497
  }
498
 
499
  public void addToAddresses(Address elem) {
500
    if (this.addresses == null) {
501
      this.addresses = new ArrayList<Address>();
502
    }
503
    this.addresses.add(elem);
504
  }
505
 
506
  public List<Address> getAddresses() {
507
    return this.addresses;
508
  }
509
 
510
  public User setAddresses(List<Address> addresses) {
511
    this.addresses = addresses;
512
    return this;
513
  }
514
 
515
  public void unsetAddresses() {
516
    this.addresses = null;
517
  }
518
 
519
  /** Returns true if field addresses is set (has been asigned a value) and false otherwise */
520
  public boolean isSetAddresses() {
521
    return this.addresses != null;
522
  }
523
 
524
  public void setAddressesIsSet(boolean value) {
525
    if (!value) {
526
      this.addresses = null;
527
    }
528
  }
529
 
530
  public long getDefaultAddressId() {
531
    return this.defaultAddressId;
532
  }
533
 
534
  public User setDefaultAddressId(long defaultAddressId) {
535
    this.defaultAddressId = defaultAddressId;
536
    setDefaultAddressIdIsSet(true);
537
    return this;
538
  }
539
 
540
  public void unsetDefaultAddressId() {
541
    __isset_bit_vector.clear(__DEFAULTADDRESSID_ISSET_ID);
542
  }
543
 
544
  /** Returns true if field defaultAddressId is set (has been asigned a value) and false otherwise */
545
  public boolean isSetDefaultAddressId() {
546
    return __isset_bit_vector.get(__DEFAULTADDRESSID_ISSET_ID);
547
  }
548
 
549
  public void setDefaultAddressIdIsSet(boolean value) {
550
    __isset_bit_vector.set(__DEFAULTADDRESSID_ISSET_ID, value);
551
  }
552
 
553
  public String getCommunicationEmail() {
554
    return this.communicationEmail;
555
  }
556
 
557
  public User setCommunicationEmail(String communicationEmail) {
558
    this.communicationEmail = communicationEmail;
559
    return this;
560
  }
561
 
562
  public void unsetCommunicationEmail() {
563
    this.communicationEmail = null;
564
  }
565
 
566
  /** Returns true if field communicationEmail is set (has been asigned a value) and false otherwise */
567
  public boolean isSetCommunicationEmail() {
568
    return this.communicationEmail != null;
569
  }
570
 
571
  public void setCommunicationEmailIsSet(boolean value) {
572
    if (!value) {
573
      this.communicationEmail = null;
574
    }
575
  }
576
 
577
  public long getActiveCartId() {
578
    return this.activeCartId;
579
  }
580
 
581
  public User setActiveCartId(long activeCartId) {
582
    this.activeCartId = activeCartId;
583
    setActiveCartIdIsSet(true);
584
    return this;
585
  }
586
 
587
  public void unsetActiveCartId() {
588
    __isset_bit_vector.clear(__ACTIVECARTID_ISSET_ID);
589
  }
590
 
591
  /** Returns true if field activeCartId is set (has been asigned a value) and false otherwise */
592
  public boolean isSetActiveCartId() {
593
    return __isset_bit_vector.get(__ACTIVECARTID_ISSET_ID);
594
  }
595
 
596
  public void setActiveCartIdIsSet(boolean value) {
597
    __isset_bit_vector.set(__ACTIVECARTID_ISSET_ID, value);
598
  }
599
 
600
  public String getJsessionId() {
601
    return this.jsessionId;
602
  }
603
 
604
  public User setJsessionId(String jsessionId) {
605
    this.jsessionId = jsessionId;
606
    return this;
607
  }
608
 
609
  public void unsetJsessionId() {
610
    this.jsessionId = null;
611
  }
612
 
613
  /** Returns true if field jsessionId is set (has been asigned a value) and false otherwise */
614
  public boolean isSetJsessionId() {
615
    return this.jsessionId != null;
616
  }
617
 
618
  public void setJsessionIdIsSet(boolean value) {
619
    if (!value) {
620
      this.jsessionId = null;
621
    }
622
  }
623
 
624
  public boolean isIsAnonymous() {
625
    return this.isAnonymous;
626
  }
627
 
628
  public User setIsAnonymous(boolean isAnonymous) {
629
    this.isAnonymous = isAnonymous;
630
    setIsAnonymousIsSet(true);
631
    return this;
632
  }
633
 
634
  public void unsetIsAnonymous() {
635
    __isset_bit_vector.clear(__ISANONYMOUS_ISSET_ID);
636
  }
637
 
638
  /** Returns true if field isAnonymous is set (has been asigned a value) and false otherwise */
639
  public boolean isSetIsAnonymous() {
640
    return __isset_bit_vector.get(__ISANONYMOUS_ISSET_ID);
641
  }
642
 
643
  public void setIsAnonymousIsSet(boolean value) {
644
    __isset_bit_vector.set(__ISANONYMOUS_ISSET_ID, value);
645
  }
646
 
647
  public void setFieldValue(_Fields field, Object value) {
648
    switch (field) {
649
    case USER_ID:
650
      if (value == null) {
651
        unsetUserId();
652
      } else {
653
        setUserId((Long)value);
654
      }
655
      break;
656
 
657
    case EMAIL:
658
      if (value == null) {
659
        unsetEmail();
660
      } else {
661
        setEmail((String)value);
662
      }
663
      break;
664
 
665
    case PASSWORD:
666
      if (value == null) {
667
        unsetPassword();
668
      } else {
669
        setPassword((String)value);
670
      }
671
      break;
672
 
673
    case NAME:
674
      if (value == null) {
675
        unsetName();
676
      } else {
677
        setName((String)value);
678
      }
679
      break;
680
 
681
    case DATE_OF_BIRTH:
682
      if (value == null) {
683
        unsetDateOfBirth();
684
      } else {
685
        setDateOfBirth((Long)value);
686
      }
687
      break;
688
 
689
    case SEX:
690
      if (value == null) {
691
        unsetSex();
692
      } else {
693
        setSex((Sex)value);
694
      }
695
      break;
696
 
697
    case PHONES:
698
      if (value == null) {
699
        unsetPhones();
700
      } else {
701
        setPhones((Set<Phone>)value);
702
      }
703
      break;
704
 
705
    case SOCIAL_HANDLES:
706
      if (value == null) {
707
        unsetSocialHandles();
708
      } else {
709
        setSocialHandles((SocialHandles)value);
710
      }
711
      break;
712
 
713
    case ADDRESSES:
714
      if (value == null) {
715
        unsetAddresses();
716
      } else {
717
        setAddresses((List<Address>)value);
718
      }
719
      break;
720
 
721
    case DEFAULT_ADDRESS_ID:
722
      if (value == null) {
723
        unsetDefaultAddressId();
724
      } else {
725
        setDefaultAddressId((Long)value);
726
      }
727
      break;
728
 
729
    case COMMUNICATION_EMAIL:
730
      if (value == null) {
731
        unsetCommunicationEmail();
732
      } else {
733
        setCommunicationEmail((String)value);
734
      }
735
      break;
736
 
737
    case ACTIVE_CART_ID:
738
      if (value == null) {
739
        unsetActiveCartId();
740
      } else {
741
        setActiveCartId((Long)value);
742
      }
743
      break;
744
 
745
    case JSESSION_ID:
746
      if (value == null) {
747
        unsetJsessionId();
748
      } else {
749
        setJsessionId((String)value);
750
      }
751
      break;
752
 
753
    case IS_ANONYMOUS:
754
      if (value == null) {
755
        unsetIsAnonymous();
756
      } else {
757
        setIsAnonymous((Boolean)value);
758
      }
759
      break;
760
 
761
    }
762
  }
763
 
764
  public void setFieldValue(int fieldID, Object value) {
765
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
766
  }
767
 
768
  public Object getFieldValue(_Fields field) {
769
    switch (field) {
770
    case USER_ID:
771
      return new Long(getUserId());
772
 
773
    case EMAIL:
774
      return getEmail();
775
 
776
    case PASSWORD:
777
      return getPassword();
778
 
779
    case NAME:
780
      return getName();
781
 
782
    case DATE_OF_BIRTH:
783
      return new Long(getDateOfBirth());
784
 
785
    case SEX:
786
      return getSex();
787
 
788
    case PHONES:
789
      return getPhones();
790
 
791
    case SOCIAL_HANDLES:
792
      return getSocialHandles();
793
 
794
    case ADDRESSES:
795
      return getAddresses();
796
 
797
    case DEFAULT_ADDRESS_ID:
798
      return new Long(getDefaultAddressId());
799
 
800
    case COMMUNICATION_EMAIL:
801
      return getCommunicationEmail();
802
 
803
    case ACTIVE_CART_ID:
804
      return new Long(getActiveCartId());
805
 
806
    case JSESSION_ID:
807
      return getJsessionId();
808
 
809
    case IS_ANONYMOUS:
810
      return new Boolean(isIsAnonymous());
811
 
812
    }
813
    throw new IllegalStateException();
814
  }
815
 
816
  public Object getFieldValue(int fieldId) {
817
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
818
  }
819
 
820
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
821
  public boolean isSet(_Fields field) {
822
    switch (field) {
823
    case USER_ID:
824
      return isSetUserId();
825
    case EMAIL:
826
      return isSetEmail();
827
    case PASSWORD:
828
      return isSetPassword();
829
    case NAME:
830
      return isSetName();
831
    case DATE_OF_BIRTH:
832
      return isSetDateOfBirth();
833
    case SEX:
834
      return isSetSex();
835
    case PHONES:
836
      return isSetPhones();
837
    case SOCIAL_HANDLES:
838
      return isSetSocialHandles();
839
    case ADDRESSES:
840
      return isSetAddresses();
841
    case DEFAULT_ADDRESS_ID:
842
      return isSetDefaultAddressId();
843
    case COMMUNICATION_EMAIL:
844
      return isSetCommunicationEmail();
845
    case ACTIVE_CART_ID:
846
      return isSetActiveCartId();
847
    case JSESSION_ID:
848
      return isSetJsessionId();
849
    case IS_ANONYMOUS:
850
      return isSetIsAnonymous();
851
    }
852
    throw new IllegalStateException();
853
  }
854
 
855
  public boolean isSet(int fieldID) {
856
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
857
  }
858
 
859
  @Override
860
  public boolean equals(Object that) {
861
    if (that == null)
862
      return false;
863
    if (that instanceof User)
864
      return this.equals((User)that);
865
    return false;
866
  }
867
 
868
  public boolean equals(User that) {
869
    if (that == null)
870
      return false;
871
 
872
    boolean this_present_userId = true;
873
    boolean that_present_userId = true;
874
    if (this_present_userId || that_present_userId) {
875
      if (!(this_present_userId && that_present_userId))
876
        return false;
877
      if (this.userId != that.userId)
878
        return false;
879
    }
880
 
881
    boolean this_present_email = true && this.isSetEmail();
882
    boolean that_present_email = true && that.isSetEmail();
883
    if (this_present_email || that_present_email) {
884
      if (!(this_present_email && that_present_email))
885
        return false;
886
      if (!this.email.equals(that.email))
887
        return false;
888
    }
889
 
890
    boolean this_present_password = true && this.isSetPassword();
891
    boolean that_present_password = true && that.isSetPassword();
892
    if (this_present_password || that_present_password) {
893
      if (!(this_present_password && that_present_password))
894
        return false;
895
      if (!this.password.equals(that.password))
896
        return false;
897
    }
898
 
899
    boolean this_present_name = true && this.isSetName();
900
    boolean that_present_name = true && that.isSetName();
901
    if (this_present_name || that_present_name) {
902
      if (!(this_present_name && that_present_name))
903
        return false;
904
      if (!this.name.equals(that.name))
905
        return false;
906
    }
907
 
908
    boolean this_present_dateOfBirth = true;
909
    boolean that_present_dateOfBirth = true;
910
    if (this_present_dateOfBirth || that_present_dateOfBirth) {
911
      if (!(this_present_dateOfBirth && that_present_dateOfBirth))
912
        return false;
913
      if (this.dateOfBirth != that.dateOfBirth)
914
        return false;
915
    }
916
 
917
    boolean this_present_sex = true && this.isSetSex();
918
    boolean that_present_sex = true && that.isSetSex();
919
    if (this_present_sex || that_present_sex) {
920
      if (!(this_present_sex && that_present_sex))
921
        return false;
922
      if (!this.sex.equals(that.sex))
923
        return false;
924
    }
925
 
926
    boolean this_present_phones = true && this.isSetPhones();
927
    boolean that_present_phones = true && that.isSetPhones();
928
    if (this_present_phones || that_present_phones) {
929
      if (!(this_present_phones && that_present_phones))
930
        return false;
931
      if (!this.phones.equals(that.phones))
932
        return false;
933
    }
934
 
935
    boolean this_present_socialHandles = true && this.isSetSocialHandles();
936
    boolean that_present_socialHandles = true && that.isSetSocialHandles();
937
    if (this_present_socialHandles || that_present_socialHandles) {
938
      if (!(this_present_socialHandles && that_present_socialHandles))
939
        return false;
940
      if (!this.socialHandles.equals(that.socialHandles))
941
        return false;
942
    }
943
 
944
    boolean this_present_addresses = true && this.isSetAddresses();
945
    boolean that_present_addresses = true && that.isSetAddresses();
946
    if (this_present_addresses || that_present_addresses) {
947
      if (!(this_present_addresses && that_present_addresses))
948
        return false;
949
      if (!this.addresses.equals(that.addresses))
950
        return false;
951
    }
952
 
953
    boolean this_present_defaultAddressId = true;
954
    boolean that_present_defaultAddressId = true;
955
    if (this_present_defaultAddressId || that_present_defaultAddressId) {
956
      if (!(this_present_defaultAddressId && that_present_defaultAddressId))
957
        return false;
958
      if (this.defaultAddressId != that.defaultAddressId)
959
        return false;
960
    }
961
 
962
    boolean this_present_communicationEmail = true && this.isSetCommunicationEmail();
963
    boolean that_present_communicationEmail = true && that.isSetCommunicationEmail();
964
    if (this_present_communicationEmail || that_present_communicationEmail) {
965
      if (!(this_present_communicationEmail && that_present_communicationEmail))
966
        return false;
967
      if (!this.communicationEmail.equals(that.communicationEmail))
968
        return false;
969
    }
970
 
971
    boolean this_present_activeCartId = true;
972
    boolean that_present_activeCartId = true;
973
    if (this_present_activeCartId || that_present_activeCartId) {
974
      if (!(this_present_activeCartId && that_present_activeCartId))
975
        return false;
976
      if (this.activeCartId != that.activeCartId)
977
        return false;
978
    }
979
 
980
    boolean this_present_jsessionId = true && this.isSetJsessionId();
981
    boolean that_present_jsessionId = true && that.isSetJsessionId();
982
    if (this_present_jsessionId || that_present_jsessionId) {
983
      if (!(this_present_jsessionId && that_present_jsessionId))
984
        return false;
985
      if (!this.jsessionId.equals(that.jsessionId))
986
        return false;
987
    }
988
 
989
    boolean this_present_isAnonymous = true;
990
    boolean that_present_isAnonymous = true;
991
    if (this_present_isAnonymous || that_present_isAnonymous) {
992
      if (!(this_present_isAnonymous && that_present_isAnonymous))
993
        return false;
994
      if (this.isAnonymous != that.isAnonymous)
995
        return false;
996
    }
997
 
998
    return true;
999
  }
1000
 
1001
  @Override
1002
  public int hashCode() {
1003
    return 0;
1004
  }
1005
 
1006
  public void read(TProtocol iprot) throws TException {
1007
    TField field;
1008
    iprot.readStructBegin();
1009
    while (true)
1010
    {
1011
      field = iprot.readFieldBegin();
1012
      if (field.type == TType.STOP) { 
1013
        break;
1014
      }
1015
      _Fields fieldId = _Fields.findByThriftId(field.id);
1016
      if (fieldId == null) {
1017
        TProtocolUtil.skip(iprot, field.type);
1018
      } else {
1019
        switch (fieldId) {
1020
          case USER_ID:
1021
            if (field.type == TType.I64) {
1022
              this.userId = iprot.readI64();
1023
              setUserIdIsSet(true);
1024
            } else { 
1025
              TProtocolUtil.skip(iprot, field.type);
1026
            }
1027
            break;
1028
          case EMAIL:
1029
            if (field.type == TType.STRING) {
1030
              this.email = iprot.readString();
1031
            } else { 
1032
              TProtocolUtil.skip(iprot, field.type);
1033
            }
1034
            break;
1035
          case PASSWORD:
1036
            if (field.type == TType.STRING) {
1037
              this.password = iprot.readString();
1038
            } else { 
1039
              TProtocolUtil.skip(iprot, field.type);
1040
            }
1041
            break;
1042
          case NAME:
1043
            if (field.type == TType.STRING) {
1044
              this.name = iprot.readString();
1045
            } else { 
1046
              TProtocolUtil.skip(iprot, field.type);
1047
            }
1048
            break;
1049
          case DATE_OF_BIRTH:
1050
            if (field.type == TType.I64) {
1051
              this.dateOfBirth = iprot.readI64();
1052
              setDateOfBirthIsSet(true);
1053
            } else { 
1054
              TProtocolUtil.skip(iprot, field.type);
1055
            }
1056
            break;
1057
          case SEX:
1058
            if (field.type == TType.I32) {
1059
              this.sex = Sex.findByValue(iprot.readI32());
1060
            } else { 
1061
              TProtocolUtil.skip(iprot, field.type);
1062
            }
1063
            break;
1064
          case PHONES:
1065
            if (field.type == TType.SET) {
1066
              {
1067
                TSet _set4 = iprot.readSetBegin();
1068
                this.phones = new HashSet<Phone>(2*_set4.size);
1069
                for (int _i5 = 0; _i5 < _set4.size; ++_i5)
1070
                {
1071
                  Phone _elem6;
1072
                  _elem6 = new Phone();
1073
                  _elem6.read(iprot);
1074
                  this.phones.add(_elem6);
1075
                }
1076
                iprot.readSetEnd();
1077
              }
1078
            } else { 
1079
              TProtocolUtil.skip(iprot, field.type);
1080
            }
1081
            break;
1082
          case SOCIAL_HANDLES:
1083
            if (field.type == TType.STRUCT) {
1084
              this.socialHandles = new SocialHandles();
1085
              this.socialHandles.read(iprot);
1086
            } else { 
1087
              TProtocolUtil.skip(iprot, field.type);
1088
            }
1089
            break;
1090
          case ADDRESSES:
1091
            if (field.type == TType.LIST) {
1092
              {
1093
                TList _list7 = iprot.readListBegin();
1094
                this.addresses = new ArrayList<Address>(_list7.size);
1095
                for (int _i8 = 0; _i8 < _list7.size; ++_i8)
1096
                {
1097
                  Address _elem9;
1098
                  _elem9 = new Address();
1099
                  _elem9.read(iprot);
1100
                  this.addresses.add(_elem9);
1101
                }
1102
                iprot.readListEnd();
1103
              }
1104
            } else { 
1105
              TProtocolUtil.skip(iprot, field.type);
1106
            }
1107
            break;
1108
          case DEFAULT_ADDRESS_ID:
1109
            if (field.type == TType.I64) {
1110
              this.defaultAddressId = iprot.readI64();
1111
              setDefaultAddressIdIsSet(true);
1112
            } else { 
1113
              TProtocolUtil.skip(iprot, field.type);
1114
            }
1115
            break;
1116
          case COMMUNICATION_EMAIL:
1117
            if (field.type == TType.STRING) {
1118
              this.communicationEmail = iprot.readString();
1119
            } else { 
1120
              TProtocolUtil.skip(iprot, field.type);
1121
            }
1122
            break;
1123
          case ACTIVE_CART_ID:
1124
            if (field.type == TType.I64) {
1125
              this.activeCartId = iprot.readI64();
1126
              setActiveCartIdIsSet(true);
1127
            } else { 
1128
              TProtocolUtil.skip(iprot, field.type);
1129
            }
1130
            break;
1131
          case JSESSION_ID:
1132
            if (field.type == TType.STRING) {
1133
              this.jsessionId = iprot.readString();
1134
            } else { 
1135
              TProtocolUtil.skip(iprot, field.type);
1136
            }
1137
            break;
1138
          case IS_ANONYMOUS:
1139
            if (field.type == TType.BOOL) {
1140
              this.isAnonymous = iprot.readBool();
1141
              setIsAnonymousIsSet(true);
1142
            } else { 
1143
              TProtocolUtil.skip(iprot, field.type);
1144
            }
1145
            break;
1146
        }
1147
        iprot.readFieldEnd();
1148
      }
1149
    }
1150
    iprot.readStructEnd();
1151
    validate();
1152
  }
1153
 
1154
  public void write(TProtocol oprot) throws TException {
1155
    validate();
1156
 
1157
    oprot.writeStructBegin(STRUCT_DESC);
1158
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
1159
    oprot.writeI64(this.userId);
1160
    oprot.writeFieldEnd();
1161
    if (this.email != null) {
1162
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
1163
      oprot.writeString(this.email);
1164
      oprot.writeFieldEnd();
1165
    }
1166
    if (this.password != null) {
1167
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
1168
      oprot.writeString(this.password);
1169
      oprot.writeFieldEnd();
1170
    }
1171
    if (this.name != null) {
1172
      oprot.writeFieldBegin(NAME_FIELD_DESC);
1173
      oprot.writeString(this.name);
1174
      oprot.writeFieldEnd();
1175
    }
1176
    oprot.writeFieldBegin(DATE_OF_BIRTH_FIELD_DESC);
1177
    oprot.writeI64(this.dateOfBirth);
1178
    oprot.writeFieldEnd();
1179
    if (this.sex != null) {
1180
      oprot.writeFieldBegin(SEX_FIELD_DESC);
1181
      oprot.writeI32(this.sex.getValue());
1182
      oprot.writeFieldEnd();
1183
    }
1184
    if (this.phones != null) {
1185
      oprot.writeFieldBegin(PHONES_FIELD_DESC);
1186
      {
1187
        oprot.writeSetBegin(new TSet(TType.STRUCT, this.phones.size()));
1188
        for (Phone _iter10 : this.phones)
1189
        {
1190
          _iter10.write(oprot);
1191
        }
1192
        oprot.writeSetEnd();
1193
      }
1194
      oprot.writeFieldEnd();
1195
    }
1196
    if (this.socialHandles != null) {
1197
      oprot.writeFieldBegin(SOCIAL_HANDLES_FIELD_DESC);
1198
      this.socialHandles.write(oprot);
1199
      oprot.writeFieldEnd();
1200
    }
1201
    if (this.addresses != null) {
1202
      oprot.writeFieldBegin(ADDRESSES_FIELD_DESC);
1203
      {
1204
        oprot.writeListBegin(new TList(TType.STRUCT, this.addresses.size()));
1205
        for (Address _iter11 : this.addresses)
1206
        {
1207
          _iter11.write(oprot);
1208
        }
1209
        oprot.writeListEnd();
1210
      }
1211
      oprot.writeFieldEnd();
1212
    }
1213
    oprot.writeFieldBegin(DEFAULT_ADDRESS_ID_FIELD_DESC);
1214
    oprot.writeI64(this.defaultAddressId);
1215
    oprot.writeFieldEnd();
1216
    if (this.communicationEmail != null) {
1217
      oprot.writeFieldBegin(COMMUNICATION_EMAIL_FIELD_DESC);
1218
      oprot.writeString(this.communicationEmail);
1219
      oprot.writeFieldEnd();
1220
    }
1221
    oprot.writeFieldBegin(ACTIVE_CART_ID_FIELD_DESC);
1222
    oprot.writeI64(this.activeCartId);
1223
    oprot.writeFieldEnd();
1224
    if (this.jsessionId != null) {
1225
      oprot.writeFieldBegin(JSESSION_ID_FIELD_DESC);
1226
      oprot.writeString(this.jsessionId);
1227
      oprot.writeFieldEnd();
1228
    }
1229
    oprot.writeFieldBegin(IS_ANONYMOUS_FIELD_DESC);
1230
    oprot.writeBool(this.isAnonymous);
1231
    oprot.writeFieldEnd();
1232
    oprot.writeFieldStop();
1233
    oprot.writeStructEnd();
1234
  }
1235
 
1236
  @Override
1237
  public String toString() {
1238
    StringBuilder sb = new StringBuilder("User(");
1239
    boolean first = true;
1240
 
1241
    sb.append("userId:");
1242
    sb.append(this.userId);
1243
    first = false;
1244
    if (!first) sb.append(", ");
1245
    sb.append("email:");
1246
    if (this.email == null) {
1247
      sb.append("null");
1248
    } else {
1249
      sb.append(this.email);
1250
    }
1251
    first = false;
1252
    if (!first) sb.append(", ");
1253
    sb.append("password:");
1254
    if (this.password == null) {
1255
      sb.append("null");
1256
    } else {
1257
      sb.append(this.password);
1258
    }
1259
    first = false;
1260
    if (!first) sb.append(", ");
1261
    sb.append("name:");
1262
    if (this.name == null) {
1263
      sb.append("null");
1264
    } else {
1265
      sb.append(this.name);
1266
    }
1267
    first = false;
1268
    if (!first) sb.append(", ");
1269
    sb.append("dateOfBirth:");
1270
    sb.append(this.dateOfBirth);
1271
    first = false;
1272
    if (!first) sb.append(", ");
1273
    sb.append("sex:");
1274
    if (this.sex == null) {
1275
      sb.append("null");
1276
    } else {
1277
      String sex_name = sex.name();
1278
      if (sex_name != null) {
1279
        sb.append(sex_name);
1280
        sb.append(" (");
1281
      }
1282
      sb.append(this.sex);
1283
      if (sex_name != null) {
1284
        sb.append(")");
1285
      }
1286
    }
1287
    first = false;
1288
    if (!first) sb.append(", ");
1289
    sb.append("phones:");
1290
    if (this.phones == null) {
1291
      sb.append("null");
1292
    } else {
1293
      sb.append(this.phones);
1294
    }
1295
    first = false;
1296
    if (!first) sb.append(", ");
1297
    sb.append("socialHandles:");
1298
    if (this.socialHandles == null) {
1299
      sb.append("null");
1300
    } else {
1301
      sb.append(this.socialHandles);
1302
    }
1303
    first = false;
1304
    if (!first) sb.append(", ");
1305
    sb.append("addresses:");
1306
    if (this.addresses == null) {
1307
      sb.append("null");
1308
    } else {
1309
      sb.append(this.addresses);
1310
    }
1311
    first = false;
1312
    if (!first) sb.append(", ");
1313
    sb.append("defaultAddressId:");
1314
    sb.append(this.defaultAddressId);
1315
    first = false;
1316
    if (!first) sb.append(", ");
1317
    sb.append("communicationEmail:");
1318
    if (this.communicationEmail == null) {
1319
      sb.append("null");
1320
    } else {
1321
      sb.append(this.communicationEmail);
1322
    }
1323
    first = false;
1324
    if (!first) sb.append(", ");
1325
    sb.append("activeCartId:");
1326
    sb.append(this.activeCartId);
1327
    first = false;
1328
    if (!first) sb.append(", ");
1329
    sb.append("jsessionId:");
1330
    if (this.jsessionId == null) {
1331
      sb.append("null");
1332
    } else {
1333
      sb.append(this.jsessionId);
1334
    }
1335
    first = false;
1336
    if (!first) sb.append(", ");
1337
    sb.append("isAnonymous:");
1338
    sb.append(this.isAnonymous);
1339
    first = false;
1340
    sb.append(")");
1341
    return sb.toString();
1342
  }
1343
 
1344
  public void validate() throws TException {
1345
    // check for required fields
1346
  }
1347
 
1348
}
1349