Subversion Repositories SmartDukaan

Rev

Rev 571 | Rev 2020 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.user;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

/**
 * The user structure holding the basic information that identifies the user.
 * *
 */
public class User implements TBase<User._Fields>, java.io.Serializable, Cloneable, Comparable<User> {
  private static final TStruct STRUCT_DESC = new TStruct("User");

  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)2);
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)3);
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)4);
  private static final TField DATE_OF_BIRTH_FIELD_DESC = new TField("dateOfBirth", TType.STRING, (short)5);
  private static final TField SEX_FIELD_DESC = new TField("sex", TType.I32, (short)6);
  private static final TField MOBILE_NUMBER_FIELD_DESC = new TField("mobileNumber", TType.STRING, (short)7);
  private static final TField SOCIAL_HANDLES_FIELD_DESC = new TField("socialHandles", TType.STRUCT, (short)8);
  private static final TField ADDRESSES_FIELD_DESC = new TField("addresses", TType.LIST, (short)9);
  private static final TField DEFAULT_ADDRESS_ID_FIELD_DESC = new TField("defaultAddressId", TType.I64, (short)10);
  private static final TField COMMUNICATION_EMAIL_FIELD_DESC = new TField("communicationEmail", TType.STRING, (short)11);
  private static final TField ACTIVE_CART_ID_FIELD_DESC = new TField("activeCartId", TType.I64, (short)12);
  private static final TField JSESSION_ID_FIELD_DESC = new TField("jsessionId", TType.STRING, (short)13);
  private static final TField IS_ANONYMOUS_FIELD_DESC = new TField("isAnonymous", TType.BOOL, (short)14);

  private long userId;
  private String email;
  private String password;
  private String name;
  private String dateOfBirth;
  private Sex sex;
  private String mobileNumber;
  private SocialHandles socialHandles;
  private List<Address> addresses;
  private long defaultAddressId;
  private String communicationEmail;
  private long activeCartId;
  private String jsessionId;
  private boolean isAnonymous;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    USER_ID((short)1, "userId"),
    EMAIL((short)2, "email"),
    PASSWORD((short)3, "password"),
    NAME((short)4, "name"),
    DATE_OF_BIRTH((short)5, "dateOfBirth"),
    /**
     * 
     * @see Sex
     */
    SEX((short)6, "sex"),
    MOBILE_NUMBER((short)7, "mobileNumber"),
    SOCIAL_HANDLES((short)8, "socialHandles"),
    ADDRESSES((short)9, "addresses"),
    DEFAULT_ADDRESS_ID((short)10, "defaultAddressId"),
    COMMUNICATION_EMAIL((short)11, "communicationEmail"),
    ACTIVE_CART_ID((short)12, "activeCartId"),
    JSESSION_ID((short)13, "jsessionId"),
    IS_ANONYMOUS((short)14, "isAnonymous");

    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byId.put((int)field._thriftId, field);
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __USERID_ISSET_ID = 0;
  private static final int __DEFAULTADDRESSID_ISSET_ID = 1;
  private static final int __ACTIVECARTID_ISSET_ID = 2;
  private static final int __ISANONYMOUS_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.DATE_OF_BIRTH, new FieldMetaData("dateOfBirth", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SEX, new FieldMetaData("sex", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, Sex.class)));
    put(_Fields.MOBILE_NUMBER, new FieldMetaData("mobileNumber", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SOCIAL_HANDLES, new FieldMetaData("socialHandles", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, SocialHandles.class)));
    put(_Fields.ADDRESSES, new FieldMetaData("addresses", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new StructMetaData(TType.STRUCT, Address.class))));
    put(_Fields.DEFAULT_ADDRESS_ID, new FieldMetaData("defaultAddressId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.COMMUNICATION_EMAIL, new FieldMetaData("communicationEmail", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ACTIVE_CART_ID, new FieldMetaData("activeCartId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.JSESSION_ID, new FieldMetaData("jsessionId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.IS_ANONYMOUS, new FieldMetaData("isAnonymous", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(User.class, metaDataMap);
  }

  public User() {
  }

  public User(
    long userId,
    String email,
    String password,
    String name,
    String dateOfBirth,
    Sex sex,
    String mobileNumber,
    SocialHandles socialHandles,
    List<Address> addresses,
    long defaultAddressId,
    String communicationEmail,
    long activeCartId,
    String jsessionId,
    boolean isAnonymous)
  {
    this();
    this.userId = userId;
    setUserIdIsSet(true);
    this.email = email;
    this.password = password;
    this.name = name;
    this.dateOfBirth = dateOfBirth;
    this.sex = sex;
    this.mobileNumber = mobileNumber;
    this.socialHandles = socialHandles;
    this.addresses = addresses;
    this.defaultAddressId = defaultAddressId;
    setDefaultAddressIdIsSet(true);
    this.communicationEmail = communicationEmail;
    this.activeCartId = activeCartId;
    setActiveCartIdIsSet(true);
    this.jsessionId = jsessionId;
    this.isAnonymous = isAnonymous;
    setIsAnonymousIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public User(User other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.userId = other.userId;
    if (other.isSetEmail()) {
      this.email = other.email;
    }
    if (other.isSetPassword()) {
      this.password = other.password;
    }
    if (other.isSetName()) {
      this.name = other.name;
    }
    if (other.isSetDateOfBirth()) {
      this.dateOfBirth = other.dateOfBirth;
    }
    if (other.isSetSex()) {
      this.sex = other.sex;
    }
    if (other.isSetMobileNumber()) {
      this.mobileNumber = other.mobileNumber;
    }
    if (other.isSetSocialHandles()) {
      this.socialHandles = new SocialHandles(other.socialHandles);
    }
    if (other.isSetAddresses()) {
      List<Address> __this__addresses = new ArrayList<Address>();
      for (Address other_element : other.addresses) {
        __this__addresses.add(new Address(other_element));
      }
      this.addresses = __this__addresses;
    }
    this.defaultAddressId = other.defaultAddressId;
    if (other.isSetCommunicationEmail()) {
      this.communicationEmail = other.communicationEmail;
    }
    this.activeCartId = other.activeCartId;
    if (other.isSetJsessionId()) {
      this.jsessionId = other.jsessionId;
    }
    this.isAnonymous = other.isAnonymous;
  }

  public User deepCopy() {
    return new User(this);
  }

  @Deprecated
  public User clone() {
    return new User(this);
  }

  public long getUserId() {
    return this.userId;
  }

  public User setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
    return this;
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  public String getEmail() {
    return this.email;
  }

  public User setEmail(String email) {
    this.email = email;
    return this;
  }

  public void unsetEmail() {
    this.email = null;
  }

  /** Returns true if field email is set (has been asigned a value) and false otherwise */
  public boolean isSetEmail() {
    return this.email != null;
  }

  public void setEmailIsSet(boolean value) {
    if (!value) {
      this.email = null;
    }
  }

  public String getPassword() {
    return this.password;
  }

  public User setPassword(String password) {
    this.password = password;
    return this;
  }

  public void unsetPassword() {
    this.password = null;
  }

  /** Returns true if field password is set (has been asigned a value) and false otherwise */
  public boolean isSetPassword() {
    return this.password != null;
  }

  public void setPasswordIsSet(boolean value) {
    if (!value) {
      this.password = null;
    }
  }

  public String getName() {
    return this.name;
  }

  public User setName(String name) {
    this.name = name;
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

  /** Returns true if field name is set (has been asigned a value) and false otherwise */
  public boolean isSetName() {
    return this.name != null;
  }

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

  public String getDateOfBirth() {
    return this.dateOfBirth;
  }

  public User setDateOfBirth(String dateOfBirth) {
    this.dateOfBirth = dateOfBirth;
    return this;
  }

  public void unsetDateOfBirth() {
    this.dateOfBirth = null;
  }

  /** Returns true if field dateOfBirth is set (has been asigned a value) and false otherwise */
  public boolean isSetDateOfBirth() {
    return this.dateOfBirth != null;
  }

  public void setDateOfBirthIsSet(boolean value) {
    if (!value) {
      this.dateOfBirth = null;
    }
  }

  /**
   * 
   * @see Sex
   */
  public Sex getSex() {
    return this.sex;
  }

  /**
   * 
   * @see Sex
   */
  public User setSex(Sex sex) {
    this.sex = sex;
    return this;
  }

  public void unsetSex() {
    this.sex = null;
  }

  /** Returns true if field sex is set (has been asigned a value) and false otherwise */
  public boolean isSetSex() {
    return this.sex != null;
  }

  public void setSexIsSet(boolean value) {
    if (!value) {
      this.sex = null;
    }
  }

  public String getMobileNumber() {
    return this.mobileNumber;
  }

  public User setMobileNumber(String mobileNumber) {
    this.mobileNumber = mobileNumber;
    return this;
  }

  public void unsetMobileNumber() {
    this.mobileNumber = null;
  }

  /** Returns true if field mobileNumber is set (has been asigned a value) and false otherwise */
  public boolean isSetMobileNumber() {
    return this.mobileNumber != null;
  }

  public void setMobileNumberIsSet(boolean value) {
    if (!value) {
      this.mobileNumber = null;
    }
  }

  public SocialHandles getSocialHandles() {
    return this.socialHandles;
  }

  public User setSocialHandles(SocialHandles socialHandles) {
    this.socialHandles = socialHandles;
    return this;
  }

  public void unsetSocialHandles() {
    this.socialHandles = null;
  }

  /** Returns true if field socialHandles is set (has been asigned a value) and false otherwise */
  public boolean isSetSocialHandles() {
    return this.socialHandles != null;
  }

  public void setSocialHandlesIsSet(boolean value) {
    if (!value) {
      this.socialHandles = null;
    }
  }

  public int getAddressesSize() {
    return (this.addresses == null) ? 0 : this.addresses.size();
  }

  public java.util.Iterator<Address> getAddressesIterator() {
    return (this.addresses == null) ? null : this.addresses.iterator();
  }

  public void addToAddresses(Address elem) {
    if (this.addresses == null) {
      this.addresses = new ArrayList<Address>();
    }
    this.addresses.add(elem);
  }

  public List<Address> getAddresses() {
    return this.addresses;
  }

  public User setAddresses(List<Address> addresses) {
    this.addresses = addresses;
    return this;
  }

  public void unsetAddresses() {
    this.addresses = null;
  }

  /** Returns true if field addresses is set (has been asigned a value) and false otherwise */
  public boolean isSetAddresses() {
    return this.addresses != null;
  }

  public void setAddressesIsSet(boolean value) {
    if (!value) {
      this.addresses = null;
    }
  }

  public long getDefaultAddressId() {
    return this.defaultAddressId;
  }

  public User setDefaultAddressId(long defaultAddressId) {
    this.defaultAddressId = defaultAddressId;
    setDefaultAddressIdIsSet(true);
    return this;
  }

  public void unsetDefaultAddressId() {
    __isset_bit_vector.clear(__DEFAULTADDRESSID_ISSET_ID);
  }

  /** Returns true if field defaultAddressId is set (has been asigned a value) and false otherwise */
  public boolean isSetDefaultAddressId() {
    return __isset_bit_vector.get(__DEFAULTADDRESSID_ISSET_ID);
  }

  public void setDefaultAddressIdIsSet(boolean value) {
    __isset_bit_vector.set(__DEFAULTADDRESSID_ISSET_ID, value);
  }

  public String getCommunicationEmail() {
    return this.communicationEmail;
  }

  public User setCommunicationEmail(String communicationEmail) {
    this.communicationEmail = communicationEmail;
    return this;
  }

  public void unsetCommunicationEmail() {
    this.communicationEmail = null;
  }

  /** Returns true if field communicationEmail is set (has been asigned a value) and false otherwise */
  public boolean isSetCommunicationEmail() {
    return this.communicationEmail != null;
  }

  public void setCommunicationEmailIsSet(boolean value) {
    if (!value) {
      this.communicationEmail = null;
    }
  }

  public long getActiveCartId() {
    return this.activeCartId;
  }

  public User setActiveCartId(long activeCartId) {
    this.activeCartId = activeCartId;
    setActiveCartIdIsSet(true);
    return this;
  }

  public void unsetActiveCartId() {
    __isset_bit_vector.clear(__ACTIVECARTID_ISSET_ID);
  }

  /** Returns true if field activeCartId is set (has been asigned a value) and false otherwise */
  public boolean isSetActiveCartId() {
    return __isset_bit_vector.get(__ACTIVECARTID_ISSET_ID);
  }

  public void setActiveCartIdIsSet(boolean value) {
    __isset_bit_vector.set(__ACTIVECARTID_ISSET_ID, value);
  }

  public String getJsessionId() {
    return this.jsessionId;
  }

  public User setJsessionId(String jsessionId) {
    this.jsessionId = jsessionId;
    return this;
  }

  public void unsetJsessionId() {
    this.jsessionId = null;
  }

  /** Returns true if field jsessionId is set (has been asigned a value) and false otherwise */
  public boolean isSetJsessionId() {
    return this.jsessionId != null;
  }

  public void setJsessionIdIsSet(boolean value) {
    if (!value) {
      this.jsessionId = null;
    }
  }

  public boolean isIsAnonymous() {
    return this.isAnonymous;
  }

  public User setIsAnonymous(boolean isAnonymous) {
    this.isAnonymous = isAnonymous;
    setIsAnonymousIsSet(true);
    return this;
  }

  public void unsetIsAnonymous() {
    __isset_bit_vector.clear(__ISANONYMOUS_ISSET_ID);
  }

  /** Returns true if field isAnonymous is set (has been asigned a value) and false otherwise */
  public boolean isSetIsAnonymous() {
    return __isset_bit_vector.get(__ISANONYMOUS_ISSET_ID);
  }

  public void setIsAnonymousIsSet(boolean value) {
    __isset_bit_vector.set(__ISANONYMOUS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case EMAIL:
      if (value == null) {
        unsetEmail();
      } else {
        setEmail((String)value);
      }
      break;

    case PASSWORD:
      if (value == null) {
        unsetPassword();
      } else {
        setPassword((String)value);
      }
      break;

    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((String)value);
      }
      break;

    case DATE_OF_BIRTH:
      if (value == null) {
        unsetDateOfBirth();
      } else {
        setDateOfBirth((String)value);
      }
      break;

    case SEX:
      if (value == null) {
        unsetSex();
      } else {
        setSex((Sex)value);
      }
      break;

    case MOBILE_NUMBER:
      if (value == null) {
        unsetMobileNumber();
      } else {
        setMobileNumber((String)value);
      }
      break;

    case SOCIAL_HANDLES:
      if (value == null) {
        unsetSocialHandles();
      } else {
        setSocialHandles((SocialHandles)value);
      }
      break;

    case ADDRESSES:
      if (value == null) {
        unsetAddresses();
      } else {
        setAddresses((List<Address>)value);
      }
      break;

    case DEFAULT_ADDRESS_ID:
      if (value == null) {
        unsetDefaultAddressId();
      } else {
        setDefaultAddressId((Long)value);
      }
      break;

    case COMMUNICATION_EMAIL:
      if (value == null) {
        unsetCommunicationEmail();
      } else {
        setCommunicationEmail((String)value);
      }
      break;

    case ACTIVE_CART_ID:
      if (value == null) {
        unsetActiveCartId();
      } else {
        setActiveCartId((Long)value);
      }
      break;

    case JSESSION_ID:
      if (value == null) {
        unsetJsessionId();
      } else {
        setJsessionId((String)value);
      }
      break;

    case IS_ANONYMOUS:
      if (value == null) {
        unsetIsAnonymous();
      } else {
        setIsAnonymous((Boolean)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case USER_ID:
      return new Long(getUserId());

    case EMAIL:
      return getEmail();

    case PASSWORD:
      return getPassword();

    case NAME:
      return getName();

    case DATE_OF_BIRTH:
      return getDateOfBirth();

    case SEX:
      return getSex();

    case MOBILE_NUMBER:
      return getMobileNumber();

    case SOCIAL_HANDLES:
      return getSocialHandles();

    case ADDRESSES:
      return getAddresses();

    case DEFAULT_ADDRESS_ID:
      return new Long(getDefaultAddressId());

    case COMMUNICATION_EMAIL:
      return getCommunicationEmail();

    case ACTIVE_CART_ID:
      return new Long(getActiveCartId());

    case JSESSION_ID:
      return getJsessionId();

    case IS_ANONYMOUS:
      return new Boolean(isIsAnonymous());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case USER_ID:
      return isSetUserId();
    case EMAIL:
      return isSetEmail();
    case PASSWORD:
      return isSetPassword();
    case NAME:
      return isSetName();
    case DATE_OF_BIRTH:
      return isSetDateOfBirth();
    case SEX:
      return isSetSex();
    case MOBILE_NUMBER:
      return isSetMobileNumber();
    case SOCIAL_HANDLES:
      return isSetSocialHandles();
    case ADDRESSES:
      return isSetAddresses();
    case DEFAULT_ADDRESS_ID:
      return isSetDefaultAddressId();
    case COMMUNICATION_EMAIL:
      return isSetCommunicationEmail();
    case ACTIVE_CART_ID:
      return isSetActiveCartId();
    case JSESSION_ID:
      return isSetJsessionId();
    case IS_ANONYMOUS:
      return isSetIsAnonymous();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof User)
      return this.equals((User)that);
    return false;
  }

  public boolean equals(User that) {
    if (that == null)
      return false;

    boolean this_present_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_email = true && this.isSetEmail();
    boolean that_present_email = true && that.isSetEmail();
    if (this_present_email || that_present_email) {
      if (!(this_present_email && that_present_email))
        return false;
      if (!this.email.equals(that.email))
        return false;
    }

    boolean this_present_password = true && this.isSetPassword();
    boolean that_present_password = true && that.isSetPassword();
    if (this_present_password || that_present_password) {
      if (!(this_present_password && that_present_password))
        return false;
      if (!this.password.equals(that.password))
        return false;
    }

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }

    boolean this_present_dateOfBirth = true && this.isSetDateOfBirth();
    boolean that_present_dateOfBirth = true && that.isSetDateOfBirth();
    if (this_present_dateOfBirth || that_present_dateOfBirth) {
      if (!(this_present_dateOfBirth && that_present_dateOfBirth))
        return false;
      if (!this.dateOfBirth.equals(that.dateOfBirth))
        return false;
    }

    boolean this_present_sex = true && this.isSetSex();
    boolean that_present_sex = true && that.isSetSex();
    if (this_present_sex || that_present_sex) {
      if (!(this_present_sex && that_present_sex))
        return false;
      if (!this.sex.equals(that.sex))
        return false;
    }

    boolean this_present_mobileNumber = true && this.isSetMobileNumber();
    boolean that_present_mobileNumber = true && that.isSetMobileNumber();
    if (this_present_mobileNumber || that_present_mobileNumber) {
      if (!(this_present_mobileNumber && that_present_mobileNumber))
        return false;
      if (!this.mobileNumber.equals(that.mobileNumber))
        return false;
    }

    boolean this_present_socialHandles = true && this.isSetSocialHandles();
    boolean that_present_socialHandles = true && that.isSetSocialHandles();
    if (this_present_socialHandles || that_present_socialHandles) {
      if (!(this_present_socialHandles && that_present_socialHandles))
        return false;
      if (!this.socialHandles.equals(that.socialHandles))
        return false;
    }

    boolean this_present_addresses = true && this.isSetAddresses();
    boolean that_present_addresses = true && that.isSetAddresses();
    if (this_present_addresses || that_present_addresses) {
      if (!(this_present_addresses && that_present_addresses))
        return false;
      if (!this.addresses.equals(that.addresses))
        return false;
    }

    boolean this_present_defaultAddressId = true;
    boolean that_present_defaultAddressId = true;
    if (this_present_defaultAddressId || that_present_defaultAddressId) {
      if (!(this_present_defaultAddressId && that_present_defaultAddressId))
        return false;
      if (this.defaultAddressId != that.defaultAddressId)
        return false;
    }

    boolean this_present_communicationEmail = true && this.isSetCommunicationEmail();
    boolean that_present_communicationEmail = true && that.isSetCommunicationEmail();
    if (this_present_communicationEmail || that_present_communicationEmail) {
      if (!(this_present_communicationEmail && that_present_communicationEmail))
        return false;
      if (!this.communicationEmail.equals(that.communicationEmail))
        return false;
    }

    boolean this_present_activeCartId = true;
    boolean that_present_activeCartId = true;
    if (this_present_activeCartId || that_present_activeCartId) {
      if (!(this_present_activeCartId && that_present_activeCartId))
        return false;
      if (this.activeCartId != that.activeCartId)
        return false;
    }

    boolean this_present_jsessionId = true && this.isSetJsessionId();
    boolean that_present_jsessionId = true && that.isSetJsessionId();
    if (this_present_jsessionId || that_present_jsessionId) {
      if (!(this_present_jsessionId && that_present_jsessionId))
        return false;
      if (!this.jsessionId.equals(that.jsessionId))
        return false;
    }

    boolean this_present_isAnonymous = true;
    boolean that_present_isAnonymous = true;
    if (this_present_isAnonymous || that_present_isAnonymous) {
      if (!(this_present_isAnonymous && that_present_isAnonymous))
        return false;
      if (this.isAnonymous != that.isAnonymous)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  public int compareTo(User other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    User typedOther = (User)other;

    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEmail()).compareTo(isSetEmail());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(email, typedOther.email);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(isSetPassword());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(password, typedOther.password);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDateOfBirth()).compareTo(isSetDateOfBirth());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(dateOfBirth, typedOther.dateOfBirth);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSex()).compareTo(isSetSex());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(sex, typedOther.sex);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMobileNumber()).compareTo(isSetMobileNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(mobileNumber, typedOther.mobileNumber);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSocialHandles()).compareTo(isSetSocialHandles());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(socialHandles, typedOther.socialHandles);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAddresses()).compareTo(isSetAddresses());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(addresses, typedOther.addresses);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDefaultAddressId()).compareTo(isSetDefaultAddressId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(defaultAddressId, typedOther.defaultAddressId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommunicationEmail()).compareTo(isSetCommunicationEmail());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(communicationEmail, typedOther.communicationEmail);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetActiveCartId()).compareTo(isSetActiveCartId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(activeCartId, typedOther.activeCartId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetJsessionId()).compareTo(isSetJsessionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(jsessionId, typedOther.jsessionId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIsAnonymous()).compareTo(isSetIsAnonymous());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(isAnonymous, typedOther.isAnonymous);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case USER_ID:
            if (field.type == TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case EMAIL:
            if (field.type == TType.STRING) {
              this.email = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PASSWORD:
            if (field.type == TType.STRING) {
              this.password = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case NAME:
            if (field.type == TType.STRING) {
              this.name = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DATE_OF_BIRTH:
            if (field.type == TType.STRING) {
              this.dateOfBirth = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SEX:
            if (field.type == TType.I32) {
              this.sex = Sex.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MOBILE_NUMBER:
            if (field.type == TType.STRING) {
              this.mobileNumber = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SOCIAL_HANDLES:
            if (field.type == TType.STRUCT) {
              this.socialHandles = new SocialHandles();
              this.socialHandles.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ADDRESSES:
            if (field.type == TType.LIST) {
              {
                TList _list4 = iprot.readListBegin();
                this.addresses = new ArrayList<Address>(_list4.size);
                for (int _i5 = 0; _i5 < _list4.size; ++_i5)
                {
                  Address _elem6;
                  _elem6 = new Address();
                  _elem6.read(iprot);
                  this.addresses.add(_elem6);
                }
                iprot.readListEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DEFAULT_ADDRESS_ID:
            if (field.type == TType.I64) {
              this.defaultAddressId = iprot.readI64();
              setDefaultAddressIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case COMMUNICATION_EMAIL:
            if (field.type == TType.STRING) {
              this.communicationEmail = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ACTIVE_CART_ID:
            if (field.type == TType.I64) {
              this.activeCartId = iprot.readI64();
              setActiveCartIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case JSESSION_ID:
            if (field.type == TType.STRING) {
              this.jsessionId = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case IS_ANONYMOUS:
            if (field.type == TType.BOOL) {
              this.isAnonymous = iprot.readBool();
              setIsAnonymousIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    if (this.email != null) {
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
      oprot.writeString(this.email);
      oprot.writeFieldEnd();
    }
    if (this.password != null) {
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
      oprot.writeString(this.password);
      oprot.writeFieldEnd();
    }
    if (this.name != null) {
      oprot.writeFieldBegin(NAME_FIELD_DESC);
      oprot.writeString(this.name);
      oprot.writeFieldEnd();
    }
    if (this.dateOfBirth != null) {
      oprot.writeFieldBegin(DATE_OF_BIRTH_FIELD_DESC);
      oprot.writeString(this.dateOfBirth);
      oprot.writeFieldEnd();
    }
    if (this.sex != null) {
      oprot.writeFieldBegin(SEX_FIELD_DESC);
      oprot.writeI32(this.sex.getValue());
      oprot.writeFieldEnd();
    }
    if (this.mobileNumber != null) {
      oprot.writeFieldBegin(MOBILE_NUMBER_FIELD_DESC);
      oprot.writeString(this.mobileNumber);
      oprot.writeFieldEnd();
    }
    if (this.socialHandles != null) {
      oprot.writeFieldBegin(SOCIAL_HANDLES_FIELD_DESC);
      this.socialHandles.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.addresses != null) {
      oprot.writeFieldBegin(ADDRESSES_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.addresses.size()));
        for (Address _iter7 : this.addresses)
        {
          _iter7.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DEFAULT_ADDRESS_ID_FIELD_DESC);
    oprot.writeI64(this.defaultAddressId);
    oprot.writeFieldEnd();
    if (this.communicationEmail != null) {
      oprot.writeFieldBegin(COMMUNICATION_EMAIL_FIELD_DESC);
      oprot.writeString(this.communicationEmail);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ACTIVE_CART_ID_FIELD_DESC);
    oprot.writeI64(this.activeCartId);
    oprot.writeFieldEnd();
    if (this.jsessionId != null) {
      oprot.writeFieldBegin(JSESSION_ID_FIELD_DESC);
      oprot.writeString(this.jsessionId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(IS_ANONYMOUS_FIELD_DESC);
    oprot.writeBool(this.isAnonymous);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("User(");
    boolean first = true;

    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("email:");
    if (this.email == null) {
      sb.append("null");
    } else {
      sb.append(this.email);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("password:");
    if (this.password == null) {
      sb.append("null");
    } else {
      sb.append(this.password);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("name:");
    if (this.name == null) {
      sb.append("null");
    } else {
      sb.append(this.name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("dateOfBirth:");
    if (this.dateOfBirth == null) {
      sb.append("null");
    } else {
      sb.append(this.dateOfBirth);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("sex:");
    if (this.sex == null) {
      sb.append("null");
    } else {
      String sex_name = sex.name();
      if (sex_name != null) {
        sb.append(sex_name);
        sb.append(" (");
      }
      sb.append(this.sex);
      if (sex_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("mobileNumber:");
    if (this.mobileNumber == null) {
      sb.append("null");
    } else {
      sb.append(this.mobileNumber);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("socialHandles:");
    if (this.socialHandles == null) {
      sb.append("null");
    } else {
      sb.append(this.socialHandles);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("addresses:");
    if (this.addresses == null) {
      sb.append("null");
    } else {
      sb.append(this.addresses);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("defaultAddressId:");
    sb.append(this.defaultAddressId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("communicationEmail:");
    if (this.communicationEmail == null) {
      sb.append("null");
    } else {
      sb.append(this.communicationEmail);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("activeCartId:");
    sb.append(this.activeCartId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("jsessionId:");
    if (this.jsessionId == null) {
      sb.append("null");
    } else {
      sb.append(this.jsessionId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("isAnonymous:");
    sb.append(this.isAnonymous);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}