Subversion Repositories SmartDukaan

Rev

Blame | 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.*;

public class TUserPrimaryInfo implements TBase<TUserPrimaryInfo._Fields>, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("TUserPrimaryInfo");

  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
  private static final TField TITLE_FIELD_DESC = new TField("title", TType.STRING, (short)2);
  private static final TField FIRST_NAME_FIELD_DESC = new TField("firstName", TType.STRING, (short)3);
  private static final TField LAST_NAME_FIELD_DESC = new TField("lastName", TType.STRING, (short)4);
  private static final TField PICTURE_URL_FIELD_DESC = new TField("pictureUrl", TType.STRING, (short)5);
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)6);
  private static final TField MOBILE_FIELD_DESC = new TField("mobile", TType.STRING, (short)7);
  private static final TField WORK_PHONE_FIELD_DESC = new TField("workPhone", TType.STRING, (short)8);
  private static final TField USER_HANDLE_FIELD_DESC = new TField("userHandle", TType.STRING, (short)9);
  private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)10);
  private static final TField SOCIAL_HANDLES_FIELD_DESC = new TField("socialHandles", TType.STRUCT, (short)11);
  private static final TField DATE_OF_BIRTH_FIELD_DESC = new TField("dateOfBirth", TType.I64, (short)12);
  private static final TField ANNIVERSARY_FIELD_DESC = new TField("anniversary", TType.I64, (short)13);
  private static final TField ADDRESSES_FIELD_DESC = new TField("addresses", TType.SET, (short)14);
  private static final TField SHIPMENT_OPTION_FIELD_DESC = new TField("shipmentOption", TType.I32, (short)16);
  private static final TField MIDDLE_NAME_FIELD_DESC = new TField("middleName", TType.STRING, (short)17);
  private static final TField OCCUPATION_FIELD_DESC = new TField("occupation", TType.STRING, (short)18);

  private long userId;
  private String title;
  private String firstName;
  private String lastName;
  private String pictureUrl;
  private String email;
  private String mobile;
  private String workPhone;
  private String userHandle;
  private String password;
  private TSocialHandles socialHandles;
  private long dateOfBirth;
  private long anniversary;
  private Set<TAddress> addresses;
  private int shipmentOption;
  private String middleName;
  private String occupation;

  /** 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"),
    TITLE((short)2, "title"),
    FIRST_NAME((short)3, "firstName"),
    LAST_NAME((short)4, "lastName"),
    PICTURE_URL((short)5, "pictureUrl"),
    EMAIL((short)6, "email"),
    MOBILE((short)7, "mobile"),
    WORK_PHONE((short)8, "workPhone"),
    USER_HANDLE((short)9, "userHandle"),
    PASSWORD((short)10, "password"),
    SOCIAL_HANDLES((short)11, "socialHandles"),
    DATE_OF_BIRTH((short)12, "dateOfBirth"),
    ANNIVERSARY((short)13, "anniversary"),
    ADDRESSES((short)14, "addresses"),
    SHIPMENT_OPTION((short)16, "shipmentOption"),
    MIDDLE_NAME((short)17, "middleName"),
    OCCUPATION((short)18, "occupation");

    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 __DATEOFBIRTH_ISSET_ID = 1;
  private static final int __ANNIVERSARY_ISSET_ID = 2;
  private static final int __SHIPMENTOPTION_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.TITLE, new FieldMetaData("title", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.FIRST_NAME, new FieldMetaData("firstName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.LAST_NAME, new FieldMetaData("lastName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PICTURE_URL, new FieldMetaData("pictureUrl", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MOBILE, new FieldMetaData("mobile", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.WORK_PHONE, new FieldMetaData("workPhone", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.USER_HANDLE, new FieldMetaData("userHandle", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SOCIAL_HANDLES, new FieldMetaData("socialHandles", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, TSocialHandles.class)));
    put(_Fields.DATE_OF_BIRTH, new FieldMetaData("dateOfBirth", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ANNIVERSARY, new FieldMetaData("anniversary", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ADDRESSES, new FieldMetaData("addresses", TFieldRequirementType.DEFAULT, 
        new SetMetaData(TType.SET, 
            new StructMetaData(TType.STRUCT, TAddress.class))));
    put(_Fields.SHIPMENT_OPTION, new FieldMetaData("shipmentOption", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    put(_Fields.MIDDLE_NAME, new FieldMetaData("middleName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.OCCUPATION, new FieldMetaData("occupation", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
  }});

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

  public TUserPrimaryInfo() {
  }

  public TUserPrimaryInfo(
    long userId,
    String title,
    String firstName,
    String lastName,
    String pictureUrl,
    String email,
    String mobile,
    String workPhone,
    String userHandle,
    String password,
    TSocialHandles socialHandles,
    long dateOfBirth,
    long anniversary,
    Set<TAddress> addresses,
    int shipmentOption,
    String middleName,
    String occupation)
  {
    this();
    this.userId = userId;
    setUserIdIsSet(true);
    this.title = title;
    this.firstName = firstName;
    this.lastName = lastName;
    this.pictureUrl = pictureUrl;
    this.email = email;
    this.mobile = mobile;
    this.workPhone = workPhone;
    this.userHandle = userHandle;
    this.password = password;
    this.socialHandles = socialHandles;
    this.dateOfBirth = dateOfBirth;
    setDateOfBirthIsSet(true);
    this.anniversary = anniversary;
    setAnniversaryIsSet(true);
    this.addresses = addresses;
    this.shipmentOption = shipmentOption;
    setShipmentOptionIsSet(true);
    this.middleName = middleName;
    this.occupation = occupation;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TUserPrimaryInfo(TUserPrimaryInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.userId = other.userId;
    if (other.isSetTitle()) {
      this.title = other.title;
    }
    if (other.isSetFirstName()) {
      this.firstName = other.firstName;
    }
    if (other.isSetLastName()) {
      this.lastName = other.lastName;
    }
    if (other.isSetPictureUrl()) {
      this.pictureUrl = other.pictureUrl;
    }
    if (other.isSetEmail()) {
      this.email = other.email;
    }
    if (other.isSetMobile()) {
      this.mobile = other.mobile;
    }
    if (other.isSetWorkPhone()) {
      this.workPhone = other.workPhone;
    }
    if (other.isSetUserHandle()) {
      this.userHandle = other.userHandle;
    }
    if (other.isSetPassword()) {
      this.password = other.password;
    }
    if (other.isSetSocialHandles()) {
      this.socialHandles = new TSocialHandles(other.socialHandles);
    }
    this.dateOfBirth = other.dateOfBirth;
    this.anniversary = other.anniversary;
    if (other.isSetAddresses()) {
      Set<TAddress> __this__addresses = new HashSet<TAddress>();
      for (TAddress other_element : other.addresses) {
        __this__addresses.add(new TAddress(other_element));
      }
      this.addresses = __this__addresses;
    }
    this.shipmentOption = other.shipmentOption;
    if (other.isSetMiddleName()) {
      this.middleName = other.middleName;
    }
    if (other.isSetOccupation()) {
      this.occupation = other.occupation;
    }
  }

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

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

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

  public TUserPrimaryInfo 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 getTitle() {
    return this.title;
  }

  public TUserPrimaryInfo setTitle(String title) {
    this.title = title;
    return this;
  }

  public void unsetTitle() {
    this.title = null;
  }

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

  public void setTitleIsSet(boolean value) {
    if (!value) {
      this.title = null;
    }
  }

  public String getFirstName() {
    return this.firstName;
  }

  public TUserPrimaryInfo setFirstName(String firstName) {
    this.firstName = firstName;
    return this;
  }

  public void unsetFirstName() {
    this.firstName = null;
  }

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

  public void setFirstNameIsSet(boolean value) {
    if (!value) {
      this.firstName = null;
    }
  }

  public String getLastName() {
    return this.lastName;
  }

  public TUserPrimaryInfo setLastName(String lastName) {
    this.lastName = lastName;
    return this;
  }

  public void unsetLastName() {
    this.lastName = null;
  }

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

  public void setLastNameIsSet(boolean value) {
    if (!value) {
      this.lastName = null;
    }
  }

  public String getPictureUrl() {
    return this.pictureUrl;
  }

  public TUserPrimaryInfo setPictureUrl(String pictureUrl) {
    this.pictureUrl = pictureUrl;
    return this;
  }

  public void unsetPictureUrl() {
    this.pictureUrl = null;
  }

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

  public void setPictureUrlIsSet(boolean value) {
    if (!value) {
      this.pictureUrl = null;
    }
  }

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

  public TUserPrimaryInfo 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 getMobile() {
    return this.mobile;
  }

  public TUserPrimaryInfo setMobile(String mobile) {
    this.mobile = mobile;
    return this;
  }

  public void unsetMobile() {
    this.mobile = null;
  }

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

  public void setMobileIsSet(boolean value) {
    if (!value) {
      this.mobile = null;
    }
  }

  public String getWorkPhone() {
    return this.workPhone;
  }

  public TUserPrimaryInfo setWorkPhone(String workPhone) {
    this.workPhone = workPhone;
    return this;
  }

  public void unsetWorkPhone() {
    this.workPhone = null;
  }

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

  public void setWorkPhoneIsSet(boolean value) {
    if (!value) {
      this.workPhone = null;
    }
  }

  public String getUserHandle() {
    return this.userHandle;
  }

  public TUserPrimaryInfo setUserHandle(String userHandle) {
    this.userHandle = userHandle;
    return this;
  }

  public void unsetUserHandle() {
    this.userHandle = null;
  }

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

  public void setUserHandleIsSet(boolean value) {
    if (!value) {
      this.userHandle = null;
    }
  }

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

  public TUserPrimaryInfo 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 TSocialHandles getSocialHandles() {
    return this.socialHandles;
  }

  public TUserPrimaryInfo setSocialHandles(TSocialHandles 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 long getDateOfBirth() {
    return this.dateOfBirth;
  }

  public TUserPrimaryInfo setDateOfBirth(long dateOfBirth) {
    this.dateOfBirth = dateOfBirth;
    setDateOfBirthIsSet(true);
    return this;
  }

  public void unsetDateOfBirth() {
    __isset_bit_vector.clear(__DATEOFBIRTH_ISSET_ID);
  }

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

  public void setDateOfBirthIsSet(boolean value) {
    __isset_bit_vector.set(__DATEOFBIRTH_ISSET_ID, value);
  }

  public long getAnniversary() {
    return this.anniversary;
  }

  public TUserPrimaryInfo setAnniversary(long anniversary) {
    this.anniversary = anniversary;
    setAnniversaryIsSet(true);
    return this;
  }

  public void unsetAnniversary() {
    __isset_bit_vector.clear(__ANNIVERSARY_ISSET_ID);
  }

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

  public void setAnniversaryIsSet(boolean value) {
    __isset_bit_vector.set(__ANNIVERSARY_ISSET_ID, value);
  }

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

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

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

  public Set<TAddress> getAddresses() {
    return this.addresses;
  }

  public TUserPrimaryInfo setAddresses(Set<TAddress> 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 int getShipmentOption() {
    return this.shipmentOption;
  }

  public TUserPrimaryInfo setShipmentOption(int shipmentOption) {
    this.shipmentOption = shipmentOption;
    setShipmentOptionIsSet(true);
    return this;
  }

  public void unsetShipmentOption() {
    __isset_bit_vector.clear(__SHIPMENTOPTION_ISSET_ID);
  }

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

  public void setShipmentOptionIsSet(boolean value) {
    __isset_bit_vector.set(__SHIPMENTOPTION_ISSET_ID, value);
  }

  public String getMiddleName() {
    return this.middleName;
  }

  public TUserPrimaryInfo setMiddleName(String middleName) {
    this.middleName = middleName;
    return this;
  }

  public void unsetMiddleName() {
    this.middleName = null;
  }

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

  public void setMiddleNameIsSet(boolean value) {
    if (!value) {
      this.middleName = null;
    }
  }

  public String getOccupation() {
    return this.occupation;
  }

  public TUserPrimaryInfo setOccupation(String occupation) {
    this.occupation = occupation;
    return this;
  }

  public void unsetOccupation() {
    this.occupation = null;
  }

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

  public void setOccupationIsSet(boolean value) {
    if (!value) {
      this.occupation = null;
    }
  }

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

    case TITLE:
      if (value == null) {
        unsetTitle();
      } else {
        setTitle((String)value);
      }
      break;

    case FIRST_NAME:
      if (value == null) {
        unsetFirstName();
      } else {
        setFirstName((String)value);
      }
      break;

    case LAST_NAME:
      if (value == null) {
        unsetLastName();
      } else {
        setLastName((String)value);
      }
      break;

    case PICTURE_URL:
      if (value == null) {
        unsetPictureUrl();
      } else {
        setPictureUrl((String)value);
      }
      break;

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

    case MOBILE:
      if (value == null) {
        unsetMobile();
      } else {
        setMobile((String)value);
      }
      break;

    case WORK_PHONE:
      if (value == null) {
        unsetWorkPhone();
      } else {
        setWorkPhone((String)value);
      }
      break;

    case USER_HANDLE:
      if (value == null) {
        unsetUserHandle();
      } else {
        setUserHandle((String)value);
      }
      break;

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

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

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

    case ANNIVERSARY:
      if (value == null) {
        unsetAnniversary();
      } else {
        setAnniversary((Long)value);
      }
      break;

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

    case SHIPMENT_OPTION:
      if (value == null) {
        unsetShipmentOption();
      } else {
        setShipmentOption((Integer)value);
      }
      break;

    case MIDDLE_NAME:
      if (value == null) {
        unsetMiddleName();
      } else {
        setMiddleName((String)value);
      }
      break;

    case OCCUPATION:
      if (value == null) {
        unsetOccupation();
      } else {
        setOccupation((String)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 TITLE:
      return getTitle();

    case FIRST_NAME:
      return getFirstName();

    case LAST_NAME:
      return getLastName();

    case PICTURE_URL:
      return getPictureUrl();

    case EMAIL:
      return getEmail();

    case MOBILE:
      return getMobile();

    case WORK_PHONE:
      return getWorkPhone();

    case USER_HANDLE:
      return getUserHandle();

    case PASSWORD:
      return getPassword();

    case SOCIAL_HANDLES:
      return getSocialHandles();

    case DATE_OF_BIRTH:
      return new Long(getDateOfBirth());

    case ANNIVERSARY:
      return new Long(getAnniversary());

    case ADDRESSES:
      return getAddresses();

    case SHIPMENT_OPTION:
      return new Integer(getShipmentOption());

    case MIDDLE_NAME:
      return getMiddleName();

    case OCCUPATION:
      return getOccupation();

    }
    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 TITLE:
      return isSetTitle();
    case FIRST_NAME:
      return isSetFirstName();
    case LAST_NAME:
      return isSetLastName();
    case PICTURE_URL:
      return isSetPictureUrl();
    case EMAIL:
      return isSetEmail();
    case MOBILE:
      return isSetMobile();
    case WORK_PHONE:
      return isSetWorkPhone();
    case USER_HANDLE:
      return isSetUserHandle();
    case PASSWORD:
      return isSetPassword();
    case SOCIAL_HANDLES:
      return isSetSocialHandles();
    case DATE_OF_BIRTH:
      return isSetDateOfBirth();
    case ANNIVERSARY:
      return isSetAnniversary();
    case ADDRESSES:
      return isSetAddresses();
    case SHIPMENT_OPTION:
      return isSetShipmentOption();
    case MIDDLE_NAME:
      return isSetMiddleName();
    case OCCUPATION:
      return isSetOccupation();
    }
    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 TUserPrimaryInfo)
      return this.equals((TUserPrimaryInfo)that);
    return false;
  }

  public boolean equals(TUserPrimaryInfo 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_title = true && this.isSetTitle();
    boolean that_present_title = true && that.isSetTitle();
    if (this_present_title || that_present_title) {
      if (!(this_present_title && that_present_title))
        return false;
      if (!this.title.equals(that.title))
        return false;
    }

    boolean this_present_firstName = true && this.isSetFirstName();
    boolean that_present_firstName = true && that.isSetFirstName();
    if (this_present_firstName || that_present_firstName) {
      if (!(this_present_firstName && that_present_firstName))
        return false;
      if (!this.firstName.equals(that.firstName))
        return false;
    }

    boolean this_present_lastName = true && this.isSetLastName();
    boolean that_present_lastName = true && that.isSetLastName();
    if (this_present_lastName || that_present_lastName) {
      if (!(this_present_lastName && that_present_lastName))
        return false;
      if (!this.lastName.equals(that.lastName))
        return false;
    }

    boolean this_present_pictureUrl = true && this.isSetPictureUrl();
    boolean that_present_pictureUrl = true && that.isSetPictureUrl();
    if (this_present_pictureUrl || that_present_pictureUrl) {
      if (!(this_present_pictureUrl && that_present_pictureUrl))
        return false;
      if (!this.pictureUrl.equals(that.pictureUrl))
        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_mobile = true && this.isSetMobile();
    boolean that_present_mobile = true && that.isSetMobile();
    if (this_present_mobile || that_present_mobile) {
      if (!(this_present_mobile && that_present_mobile))
        return false;
      if (!this.mobile.equals(that.mobile))
        return false;
    }

    boolean this_present_workPhone = true && this.isSetWorkPhone();
    boolean that_present_workPhone = true && that.isSetWorkPhone();
    if (this_present_workPhone || that_present_workPhone) {
      if (!(this_present_workPhone && that_present_workPhone))
        return false;
      if (!this.workPhone.equals(that.workPhone))
        return false;
    }

    boolean this_present_userHandle = true && this.isSetUserHandle();
    boolean that_present_userHandle = true && that.isSetUserHandle();
    if (this_present_userHandle || that_present_userHandle) {
      if (!(this_present_userHandle && that_present_userHandle))
        return false;
      if (!this.userHandle.equals(that.userHandle))
        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_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_dateOfBirth = true;
    boolean that_present_dateOfBirth = true;
    if (this_present_dateOfBirth || that_present_dateOfBirth) {
      if (!(this_present_dateOfBirth && that_present_dateOfBirth))
        return false;
      if (this.dateOfBirth != that.dateOfBirth)
        return false;
    }

    boolean this_present_anniversary = true;
    boolean that_present_anniversary = true;
    if (this_present_anniversary || that_present_anniversary) {
      if (!(this_present_anniversary && that_present_anniversary))
        return false;
      if (this.anniversary != that.anniversary)
        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_shipmentOption = true;
    boolean that_present_shipmentOption = true;
    if (this_present_shipmentOption || that_present_shipmentOption) {
      if (!(this_present_shipmentOption && that_present_shipmentOption))
        return false;
      if (this.shipmentOption != that.shipmentOption)
        return false;
    }

    boolean this_present_middleName = true && this.isSetMiddleName();
    boolean that_present_middleName = true && that.isSetMiddleName();
    if (this_present_middleName || that_present_middleName) {
      if (!(this_present_middleName && that_present_middleName))
        return false;
      if (!this.middleName.equals(that.middleName))
        return false;
    }

    boolean this_present_occupation = true && this.isSetOccupation();
    boolean that_present_occupation = true && that.isSetOccupation();
    if (this_present_occupation || that_present_occupation) {
      if (!(this_present_occupation && that_present_occupation))
        return false;
      if (!this.occupation.equals(that.occupation))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    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 TITLE:
            if (field.type == TType.STRING) {
              this.title = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case FIRST_NAME:
            if (field.type == TType.STRING) {
              this.firstName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case LAST_NAME:
            if (field.type == TType.STRING) {
              this.lastName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PICTURE_URL:
            if (field.type == TType.STRING) {
              this.pictureUrl = iprot.readString();
            } 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 MOBILE:
            if (field.type == TType.STRING) {
              this.mobile = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case WORK_PHONE:
            if (field.type == TType.STRING) {
              this.workPhone = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_HANDLE:
            if (field.type == TType.STRING) {
              this.userHandle = 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 SOCIAL_HANDLES:
            if (field.type == TType.STRUCT) {
              this.socialHandles = new TSocialHandles();
              this.socialHandles.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DATE_OF_BIRTH:
            if (field.type == TType.I64) {
              this.dateOfBirth = iprot.readI64();
              setDateOfBirthIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ANNIVERSARY:
            if (field.type == TType.I64) {
              this.anniversary = iprot.readI64();
              setAnniversaryIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ADDRESSES:
            if (field.type == TType.SET) {
              {
                TSet _set0 = iprot.readSetBegin();
                this.addresses = new HashSet<TAddress>(2*_set0.size);
                for (int _i1 = 0; _i1 < _set0.size; ++_i1)
                {
                  TAddress _elem2;
                  _elem2 = new TAddress();
                  _elem2.read(iprot);
                  this.addresses.add(_elem2);
                }
                iprot.readSetEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHIPMENT_OPTION:
            if (field.type == TType.I32) {
              this.shipmentOption = iprot.readI32();
              setShipmentOptionIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MIDDLE_NAME:
            if (field.type == TType.STRING) {
              this.middleName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case OCCUPATION:
            if (field.type == TType.STRING) {
              this.occupation = iprot.readString();
            } 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.title != null) {
      oprot.writeFieldBegin(TITLE_FIELD_DESC);
      oprot.writeString(this.title);
      oprot.writeFieldEnd();
    }
    if (this.firstName != null) {
      oprot.writeFieldBegin(FIRST_NAME_FIELD_DESC);
      oprot.writeString(this.firstName);
      oprot.writeFieldEnd();
    }
    if (this.lastName != null) {
      oprot.writeFieldBegin(LAST_NAME_FIELD_DESC);
      oprot.writeString(this.lastName);
      oprot.writeFieldEnd();
    }
    if (this.pictureUrl != null) {
      oprot.writeFieldBegin(PICTURE_URL_FIELD_DESC);
      oprot.writeString(this.pictureUrl);
      oprot.writeFieldEnd();
    }
    if (this.email != null) {
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
      oprot.writeString(this.email);
      oprot.writeFieldEnd();
    }
    if (this.mobile != null) {
      oprot.writeFieldBegin(MOBILE_FIELD_DESC);
      oprot.writeString(this.mobile);
      oprot.writeFieldEnd();
    }
    if (this.workPhone != null) {
      oprot.writeFieldBegin(WORK_PHONE_FIELD_DESC);
      oprot.writeString(this.workPhone);
      oprot.writeFieldEnd();
    }
    if (this.userHandle != null) {
      oprot.writeFieldBegin(USER_HANDLE_FIELD_DESC);
      oprot.writeString(this.userHandle);
      oprot.writeFieldEnd();
    }
    if (this.password != null) {
      oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
      oprot.writeString(this.password);
      oprot.writeFieldEnd();
    }
    if (this.socialHandles != null) {
      oprot.writeFieldBegin(SOCIAL_HANDLES_FIELD_DESC);
      this.socialHandles.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DATE_OF_BIRTH_FIELD_DESC);
    oprot.writeI64(this.dateOfBirth);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ANNIVERSARY_FIELD_DESC);
    oprot.writeI64(this.anniversary);
    oprot.writeFieldEnd();
    if (this.addresses != null) {
      oprot.writeFieldBegin(ADDRESSES_FIELD_DESC);
      {
        oprot.writeSetBegin(new TSet(TType.STRUCT, this.addresses.size()));
        for (TAddress _iter3 : this.addresses)
        {
          _iter3.write(oprot);
        }
        oprot.writeSetEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(SHIPMENT_OPTION_FIELD_DESC);
    oprot.writeI32(this.shipmentOption);
    oprot.writeFieldEnd();
    if (this.middleName != null) {
      oprot.writeFieldBegin(MIDDLE_NAME_FIELD_DESC);
      oprot.writeString(this.middleName);
      oprot.writeFieldEnd();
    }
    if (this.occupation != null) {
      oprot.writeFieldBegin(OCCUPATION_FIELD_DESC);
      oprot.writeString(this.occupation);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("title:");
    if (this.title == null) {
      sb.append("null");
    } else {
      sb.append(this.title);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("firstName:");
    if (this.firstName == null) {
      sb.append("null");
    } else {
      sb.append(this.firstName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("lastName:");
    if (this.lastName == null) {
      sb.append("null");
    } else {
      sb.append(this.lastName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pictureUrl:");
    if (this.pictureUrl == null) {
      sb.append("null");
    } else {
      sb.append(this.pictureUrl);
    }
    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("mobile:");
    if (this.mobile == null) {
      sb.append("null");
    } else {
      sb.append(this.mobile);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("workPhone:");
    if (this.workPhone == null) {
      sb.append("null");
    } else {
      sb.append(this.workPhone);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("userHandle:");
    if (this.userHandle == null) {
      sb.append("null");
    } else {
      sb.append(this.userHandle);
    }
    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("socialHandles:");
    if (this.socialHandles == null) {
      sb.append("null");
    } else {
      sb.append(this.socialHandles);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("dateOfBirth:");
    sb.append(this.dateOfBirth);
    first = false;
    if (!first) sb.append(", ");
    sb.append("anniversary:");
    sb.append(this.anniversary);
    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("shipmentOption:");
    sb.append(this.shipmentOption);
    first = false;
    if (!first) sb.append(", ");
    sb.append("middleName:");
    if (this.middleName == null) {
      sb.append("null");
    } else {
      sb.append(this.middleName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("occupation:");
    if (this.occupation == null) {
      sb.append("null");
    } else {
      sb.append(this.occupation);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}