Subversion Repositories SmartDukaan

Rev

Rev 20065 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.order;

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.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

  private static final org.apache.thrift.protocol.TField BUYER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("buyerId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField ORGANISATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("organisationName", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField REGISTERED_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("registeredAddress", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField REG_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("regId", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField CIN_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("cinNumber", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField TIN_FIELD_DESC = new org.apache.thrift.protocol.TField("tin", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField ADDRESS_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("addressId", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField BUYER_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("buyerAddress", org.apache.thrift.protocol.TType.STRUCT, (short)8);
  private static final org.apache.thrift.protocol.TField STATE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("stateId", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField GSTIN_FIELD_DESC = new org.apache.thrift.protocol.TField("gstin", org.apache.thrift.protocol.TType.STRING, (short)10);

  private long buyerId; // required
  private String organisationName; // required
  private String registeredAddress; // required
  private String regId; // required
  private String cinNumber; // required
  private String tin; // required
  private long addressId; // required
  private WarehouseAddress buyerAddress; // required
  private long stateId; // required
  private String gstin; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    BUYER_ID((short)1, "buyerId"),
    ORGANISATION_NAME((short)2, "organisationName"),
    REGISTERED_ADDRESS((short)3, "registeredAddress"),
    REG_ID((short)4, "regId"),
    CIN_NUMBER((short)5, "cinNumber"),
    TIN((short)6, "tin"),
    ADDRESS_ID((short)7, "addressId"),
    BUYER_ADDRESS((short)8, "buyerAddress"),
    STATE_ID((short)9, "stateId"),
    GSTIN((short)10, "gstin");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // BUYER_ID
          return BUYER_ID;
        case 2: // ORGANISATION_NAME
          return ORGANISATION_NAME;
        case 3: // REGISTERED_ADDRESS
          return REGISTERED_ADDRESS;
        case 4: // REG_ID
          return REG_ID;
        case 5: // CIN_NUMBER
          return CIN_NUMBER;
        case 6: // TIN
          return TIN;
        case 7: // ADDRESS_ID
          return ADDRESS_ID;
        case 8: // BUYER_ADDRESS
          return BUYER_ADDRESS;
        case 9: // STATE_ID
          return STATE_ID;
        case 10: // GSTIN
          return GSTIN;
        default:
          return null;
      }
    }

    /**
     * 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 __BUYERID_ISSET_ID = 0;
  private static final int __ADDRESSID_ISSET_ID = 1;
  private static final int __STATEID_ISSET_ID = 2;
  private BitSet __isset_bit_vector = new BitSet(3);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.BUYER_ID, new org.apache.thrift.meta_data.FieldMetaData("buyerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ORGANISATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("organisationName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.REGISTERED_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("registeredAddress", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.REG_ID, new org.apache.thrift.meta_data.FieldMetaData("regId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CIN_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("cinNumber", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TIN, new org.apache.thrift.meta_data.FieldMetaData("tin", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ADDRESS_ID, new org.apache.thrift.meta_data.FieldMetaData("addressId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BUYER_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("buyerAddress", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, WarehouseAddress.class)));
    tmpMap.put(_Fields.STATE_ID, new org.apache.thrift.meta_data.FieldMetaData("stateId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.GSTIN, new org.apache.thrift.meta_data.FieldMetaData("gstin", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BuyerInfo.class, metaDataMap);
  }

  public BuyerInfo() {
  }

  public BuyerInfo(
    long buyerId,
    String organisationName,
    String registeredAddress,
    String regId,
    String cinNumber,
    String tin,
    long addressId,
    WarehouseAddress buyerAddress,
    long stateId,
    String gstin)
  {
    this();
    this.buyerId = buyerId;
    setBuyerIdIsSet(true);
    this.organisationName = organisationName;
    this.registeredAddress = registeredAddress;
    this.regId = regId;
    this.cinNumber = cinNumber;
    this.tin = tin;
    this.addressId = addressId;
    setAddressIdIsSet(true);
    this.buyerAddress = buyerAddress;
    this.stateId = stateId;
    setStateIdIsSet(true);
    this.gstin = gstin;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public BuyerInfo(BuyerInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.buyerId = other.buyerId;
    if (other.isSetOrganisationName()) {
      this.organisationName = other.organisationName;
    }
    if (other.isSetRegisteredAddress()) {
      this.registeredAddress = other.registeredAddress;
    }
    if (other.isSetRegId()) {
      this.regId = other.regId;
    }
    if (other.isSetCinNumber()) {
      this.cinNumber = other.cinNumber;
    }
    if (other.isSetTin()) {
      this.tin = other.tin;
    }
    this.addressId = other.addressId;
    if (other.isSetBuyerAddress()) {
      this.buyerAddress = new WarehouseAddress(other.buyerAddress);
    }
    this.stateId = other.stateId;
    if (other.isSetGstin()) {
      this.gstin = other.gstin;
    }
  }

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

  @Override
  public void clear() {
    setBuyerIdIsSet(false);
    this.buyerId = 0;
    this.organisationName = null;
    this.registeredAddress = null;
    this.regId = null;
    this.cinNumber = null;
    this.tin = null;
    setAddressIdIsSet(false);
    this.addressId = 0;
    this.buyerAddress = null;
    setStateIdIsSet(false);
    this.stateId = 0;
    this.gstin = null;
  }

  public long getBuyerId() {
    return this.buyerId;
  }

  public void setBuyerId(long buyerId) {
    this.buyerId = buyerId;
    setBuyerIdIsSet(true);
  }

  public void unsetBuyerId() {
    __isset_bit_vector.clear(__BUYERID_ISSET_ID);
  }

  /** Returns true if field buyerId is set (has been assigned a value) and false otherwise */
  public boolean isSetBuyerId() {
    return __isset_bit_vector.get(__BUYERID_ISSET_ID);
  }

  public void setBuyerIdIsSet(boolean value) {
    __isset_bit_vector.set(__BUYERID_ISSET_ID, value);
  }

  public String getOrganisationName() {
    return this.organisationName;
  }

  public void setOrganisationName(String organisationName) {
    this.organisationName = organisationName;
  }

  public void unsetOrganisationName() {
    this.organisationName = null;
  }

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

  public void setOrganisationNameIsSet(boolean value) {
    if (!value) {
      this.organisationName = null;
    }
  }

  public String getRegisteredAddress() {
    return this.registeredAddress;
  }

  public void setRegisteredAddress(String registeredAddress) {
    this.registeredAddress = registeredAddress;
  }

  public void unsetRegisteredAddress() {
    this.registeredAddress = null;
  }

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

  public void setRegisteredAddressIsSet(boolean value) {
    if (!value) {
      this.registeredAddress = null;
    }
  }

  public String getRegId() {
    return this.regId;
  }

  public void setRegId(String regId) {
    this.regId = regId;
  }

  public void unsetRegId() {
    this.regId = null;
  }

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

  public void setRegIdIsSet(boolean value) {
    if (!value) {
      this.regId = null;
    }
  }

  public String getCinNumber() {
    return this.cinNumber;
  }

  public void setCinNumber(String cinNumber) {
    this.cinNumber = cinNumber;
  }

  public void unsetCinNumber() {
    this.cinNumber = null;
  }

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

  public void setCinNumberIsSet(boolean value) {
    if (!value) {
      this.cinNumber = null;
    }
  }

  public String getTin() {
    return this.tin;
  }

  public void setTin(String tin) {
    this.tin = tin;
  }

  public void unsetTin() {
    this.tin = null;
  }

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

  public void setTinIsSet(boolean value) {
    if (!value) {
      this.tin = null;
    }
  }

  public long getAddressId() {
    return this.addressId;
  }

  public void setAddressId(long addressId) {
    this.addressId = addressId;
    setAddressIdIsSet(true);
  }

  public void unsetAddressId() {
    __isset_bit_vector.clear(__ADDRESSID_ISSET_ID);
  }

  /** Returns true if field addressId is set (has been assigned a value) and false otherwise */
  public boolean isSetAddressId() {
    return __isset_bit_vector.get(__ADDRESSID_ISSET_ID);
  }

  public void setAddressIdIsSet(boolean value) {
    __isset_bit_vector.set(__ADDRESSID_ISSET_ID, value);
  }

  public WarehouseAddress getBuyerAddress() {
    return this.buyerAddress;
  }

  public void setBuyerAddress(WarehouseAddress buyerAddress) {
    this.buyerAddress = buyerAddress;
  }

  public void unsetBuyerAddress() {
    this.buyerAddress = null;
  }

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

  public void setBuyerAddressIsSet(boolean value) {
    if (!value) {
      this.buyerAddress = null;
    }
  }

  public long getStateId() {
    return this.stateId;
  }

  public void setStateId(long stateId) {
    this.stateId = stateId;
    setStateIdIsSet(true);
  }

  public void unsetStateId() {
    __isset_bit_vector.clear(__STATEID_ISSET_ID);
  }

  /** Returns true if field stateId is set (has been assigned a value) and false otherwise */
  public boolean isSetStateId() {
    return __isset_bit_vector.get(__STATEID_ISSET_ID);
  }

  public void setStateIdIsSet(boolean value) {
    __isset_bit_vector.set(__STATEID_ISSET_ID, value);
  }

  public String getGstin() {
    return this.gstin;
  }

  public void setGstin(String gstin) {
    this.gstin = gstin;
  }

  public void unsetGstin() {
    this.gstin = null;
  }

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

  public void setGstinIsSet(boolean value) {
    if (!value) {
      this.gstin = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case BUYER_ID:
      if (value == null) {
        unsetBuyerId();
      } else {
        setBuyerId((Long)value);
      }
      break;

    case ORGANISATION_NAME:
      if (value == null) {
        unsetOrganisationName();
      } else {
        setOrganisationName((String)value);
      }
      break;

    case REGISTERED_ADDRESS:
      if (value == null) {
        unsetRegisteredAddress();
      } else {
        setRegisteredAddress((String)value);
      }
      break;

    case REG_ID:
      if (value == null) {
        unsetRegId();
      } else {
        setRegId((String)value);
      }
      break;

    case CIN_NUMBER:
      if (value == null) {
        unsetCinNumber();
      } else {
        setCinNumber((String)value);
      }
      break;

    case TIN:
      if (value == null) {
        unsetTin();
      } else {
        setTin((String)value);
      }
      break;

    case ADDRESS_ID:
      if (value == null) {
        unsetAddressId();
      } else {
        setAddressId((Long)value);
      }
      break;

    case BUYER_ADDRESS:
      if (value == null) {
        unsetBuyerAddress();
      } else {
        setBuyerAddress((WarehouseAddress)value);
      }
      break;

    case STATE_ID:
      if (value == null) {
        unsetStateId();
      } else {
        setStateId((Long)value);
      }
      break;

    case GSTIN:
      if (value == null) {
        unsetGstin();
      } else {
        setGstin((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case BUYER_ID:
      return Long.valueOf(getBuyerId());

    case ORGANISATION_NAME:
      return getOrganisationName();

    case REGISTERED_ADDRESS:
      return getRegisteredAddress();

    case REG_ID:
      return getRegId();

    case CIN_NUMBER:
      return getCinNumber();

    case TIN:
      return getTin();

    case ADDRESS_ID:
      return Long.valueOf(getAddressId());

    case BUYER_ADDRESS:
      return getBuyerAddress();

    case STATE_ID:
      return Long.valueOf(getStateId());

    case GSTIN:
      return getGstin();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case BUYER_ID:
      return isSetBuyerId();
    case ORGANISATION_NAME:
      return isSetOrganisationName();
    case REGISTERED_ADDRESS:
      return isSetRegisteredAddress();
    case REG_ID:
      return isSetRegId();
    case CIN_NUMBER:
      return isSetCinNumber();
    case TIN:
      return isSetTin();
    case ADDRESS_ID:
      return isSetAddressId();
    case BUYER_ADDRESS:
      return isSetBuyerAddress();
    case STATE_ID:
      return isSetStateId();
    case GSTIN:
      return isSetGstin();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_buyerId = true;
    boolean that_present_buyerId = true;
    if (this_present_buyerId || that_present_buyerId) {
      if (!(this_present_buyerId && that_present_buyerId))
        return false;
      if (this.buyerId != that.buyerId)
        return false;
    }

    boolean this_present_organisationName = true && this.isSetOrganisationName();
    boolean that_present_organisationName = true && that.isSetOrganisationName();
    if (this_present_organisationName || that_present_organisationName) {
      if (!(this_present_organisationName && that_present_organisationName))
        return false;
      if (!this.organisationName.equals(that.organisationName))
        return false;
    }

    boolean this_present_registeredAddress = true && this.isSetRegisteredAddress();
    boolean that_present_registeredAddress = true && that.isSetRegisteredAddress();
    if (this_present_registeredAddress || that_present_registeredAddress) {
      if (!(this_present_registeredAddress && that_present_registeredAddress))
        return false;
      if (!this.registeredAddress.equals(that.registeredAddress))
        return false;
    }

    boolean this_present_regId = true && this.isSetRegId();
    boolean that_present_regId = true && that.isSetRegId();
    if (this_present_regId || that_present_regId) {
      if (!(this_present_regId && that_present_regId))
        return false;
      if (!this.regId.equals(that.regId))
        return false;
    }

    boolean this_present_cinNumber = true && this.isSetCinNumber();
    boolean that_present_cinNumber = true && that.isSetCinNumber();
    if (this_present_cinNumber || that_present_cinNumber) {
      if (!(this_present_cinNumber && that_present_cinNumber))
        return false;
      if (!this.cinNumber.equals(that.cinNumber))
        return false;
    }

    boolean this_present_tin = true && this.isSetTin();
    boolean that_present_tin = true && that.isSetTin();
    if (this_present_tin || that_present_tin) {
      if (!(this_present_tin && that_present_tin))
        return false;
      if (!this.tin.equals(that.tin))
        return false;
    }

    boolean this_present_addressId = true;
    boolean that_present_addressId = true;
    if (this_present_addressId || that_present_addressId) {
      if (!(this_present_addressId && that_present_addressId))
        return false;
      if (this.addressId != that.addressId)
        return false;
    }

    boolean this_present_buyerAddress = true && this.isSetBuyerAddress();
    boolean that_present_buyerAddress = true && that.isSetBuyerAddress();
    if (this_present_buyerAddress || that_present_buyerAddress) {
      if (!(this_present_buyerAddress && that_present_buyerAddress))
        return false;
      if (!this.buyerAddress.equals(that.buyerAddress))
        return false;
    }

    boolean this_present_stateId = true;
    boolean that_present_stateId = true;
    if (this_present_stateId || that_present_stateId) {
      if (!(this_present_stateId && that_present_stateId))
        return false;
      if (this.stateId != that.stateId)
        return false;
    }

    boolean this_present_gstin = true && this.isSetGstin();
    boolean that_present_gstin = true && that.isSetGstin();
    if (this_present_gstin || that_present_gstin) {
      if (!(this_present_gstin && that_present_gstin))
        return false;
      if (!this.gstin.equals(that.gstin))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetBuyerId()).compareTo(typedOther.isSetBuyerId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBuyerId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.buyerId, typedOther.buyerId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrganisationName()).compareTo(typedOther.isSetOrganisationName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrganisationName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organisationName, typedOther.organisationName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRegisteredAddress()).compareTo(typedOther.isSetRegisteredAddress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRegisteredAddress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.registeredAddress, typedOther.registeredAddress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRegId()).compareTo(typedOther.isSetRegId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRegId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.regId, typedOther.regId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCinNumber()).compareTo(typedOther.isSetCinNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCinNumber()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cinNumber, typedOther.cinNumber);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTin()).compareTo(typedOther.isSetTin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTin()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tin, typedOther.tin);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAddressId()).compareTo(typedOther.isSetAddressId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAddressId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addressId, typedOther.addressId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBuyerAddress()).compareTo(typedOther.isSetBuyerAddress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBuyerAddress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.buyerAddress, typedOther.buyerAddress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStateId()).compareTo(typedOther.isSetStateId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStateId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateId, typedOther.stateId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGstin()).compareTo(typedOther.isSetGstin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGstin()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gstin, typedOther.gstin);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // BUYER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.buyerId = iprot.readI64();
            setBuyerIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ORGANISATION_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.organisationName = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // REGISTERED_ADDRESS
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.registeredAddress = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // REG_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.regId = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // CIN_NUMBER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.cinNumber = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // TIN
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.tin = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // ADDRESS_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.addressId = iprot.readI64();
            setAddressIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // BUYER_ADDRESS
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.buyerAddress = new WarehouseAddress();
            this.buyerAddress.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // STATE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.stateId = iprot.readI64();
            setStateIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // GSTIN
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.gstin = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(BUYER_ID_FIELD_DESC);
    oprot.writeI64(this.buyerId);
    oprot.writeFieldEnd();
    if (this.organisationName != null) {
      oprot.writeFieldBegin(ORGANISATION_NAME_FIELD_DESC);
      oprot.writeString(this.organisationName);
      oprot.writeFieldEnd();
    }
    if (this.registeredAddress != null) {
      oprot.writeFieldBegin(REGISTERED_ADDRESS_FIELD_DESC);
      oprot.writeString(this.registeredAddress);
      oprot.writeFieldEnd();
    }
    if (this.regId != null) {
      oprot.writeFieldBegin(REG_ID_FIELD_DESC);
      oprot.writeString(this.regId);
      oprot.writeFieldEnd();
    }
    if (this.cinNumber != null) {
      oprot.writeFieldBegin(CIN_NUMBER_FIELD_DESC);
      oprot.writeString(this.cinNumber);
      oprot.writeFieldEnd();
    }
    if (this.tin != null) {
      oprot.writeFieldBegin(TIN_FIELD_DESC);
      oprot.writeString(this.tin);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ADDRESS_ID_FIELD_DESC);
    oprot.writeI64(this.addressId);
    oprot.writeFieldEnd();
    if (this.buyerAddress != null) {
      oprot.writeFieldBegin(BUYER_ADDRESS_FIELD_DESC);
      this.buyerAddress.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(STATE_ID_FIELD_DESC);
    oprot.writeI64(this.stateId);
    oprot.writeFieldEnd();
    if (this.gstin != null) {
      oprot.writeFieldBegin(GSTIN_FIELD_DESC);
      oprot.writeString(this.gstin);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("buyerId:");
    sb.append(this.buyerId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("organisationName:");
    if (this.organisationName == null) {
      sb.append("null");
    } else {
      sb.append(this.organisationName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("registeredAddress:");
    if (this.registeredAddress == null) {
      sb.append("null");
    } else {
      sb.append(this.registeredAddress);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("regId:");
    if (this.regId == null) {
      sb.append("null");
    } else {
      sb.append(this.regId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("cinNumber:");
    if (this.cinNumber == null) {
      sb.append("null");
    } else {
      sb.append(this.cinNumber);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("tin:");
    if (this.tin == null) {
      sb.append("null");
    } else {
      sb.append(this.tin);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("addressId:");
    sb.append(this.addressId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("buyerAddress:");
    if (this.buyerAddress == null) {
      sb.append("null");
    } else {
      sb.append(this.buyerAddress);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stateId:");
    sb.append(this.stateId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("gstin:");
    if (this.gstin == null) {
      sb.append("null");
    } else {
      sb.append(this.gstin);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

}