Subversion Repositories SmartDukaan

Rev

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

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

  private static final org.apache.thrift.protocol.TField CART_FIELD_DESC = new org.apache.thrift.protocol.TField("cart", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField PIN_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("pinCode", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField NEED_INSURANCE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("needInsuranceInfo", org.apache.thrift.protocol.TType.BOOL, (short)3);
  private static final org.apache.thrift.protocol.TField VALIDATE_CART_MESSAGES_FIELD_DESC = new org.apache.thrift.protocol.TField("validateCartMessages", org.apache.thrift.protocol.TType.LIST, (short)4);

  private Cart cart; // required
  private String pinCode; // required
  private boolean needInsuranceInfo; // required
  private List<String> validateCartMessages; // 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 {
    CART((short)1, "cart"),
    PIN_CODE((short)2, "pinCode"),
    NEED_INSURANCE_INFO((short)3, "needInsuranceInfo"),
    VALIDATE_CART_MESSAGES((short)4, "validateCartMessages");

    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: // CART
          return CART;
        case 2: // PIN_CODE
          return PIN_CODE;
        case 3: // NEED_INSURANCE_INFO
          return NEED_INSURANCE_INFO;
        case 4: // VALIDATE_CART_MESSAGES
          return VALIDATE_CART_MESSAGES;
        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 __NEEDINSURANCEINFO_ISSET_ID = 0;
  private BitSet __isset_bit_vector = new BitSet(1);

  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.CART, new org.apache.thrift.meta_data.FieldMetaData("cart", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Cart.class)));
    tmpMap.put(_Fields.PIN_CODE, new org.apache.thrift.meta_data.FieldMetaData("pinCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NEED_INSURANCE_INFO, new org.apache.thrift.meta_data.FieldMetaData("needInsuranceInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.VALIDATE_CART_MESSAGES, new org.apache.thrift.meta_data.FieldMetaData("validateCartMessages", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CartPlus.class, metaDataMap);
  }

  public CartPlus() {
  }

  public CartPlus(
    Cart cart,
    String pinCode,
    boolean needInsuranceInfo,
    List<String> validateCartMessages)
  {
    this();
    this.cart = cart;
    this.pinCode = pinCode;
    this.needInsuranceInfo = needInsuranceInfo;
    setNeedInsuranceInfoIsSet(true);
    this.validateCartMessages = validateCartMessages;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public CartPlus(CartPlus other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetCart()) {
      this.cart = new Cart(other.cart);
    }
    if (other.isSetPinCode()) {
      this.pinCode = other.pinCode;
    }
    this.needInsuranceInfo = other.needInsuranceInfo;
    if (other.isSetValidateCartMessages()) {
      List<String> __this__validateCartMessages = new ArrayList<String>();
      for (String other_element : other.validateCartMessages) {
        __this__validateCartMessages.add(other_element);
      }
      this.validateCartMessages = __this__validateCartMessages;
    }
  }

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

  @Override
  public void clear() {
    this.cart = null;
    this.pinCode = null;
    setNeedInsuranceInfoIsSet(false);
    this.needInsuranceInfo = false;
    this.validateCartMessages = null;
  }

  public Cart getCart() {
    return this.cart;
  }

  public void setCart(Cart cart) {
    this.cart = cart;
  }

  public void unsetCart() {
    this.cart = null;
  }

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

  public void setCartIsSet(boolean value) {
    if (!value) {
      this.cart = null;
    }
  }

  public String getPinCode() {
    return this.pinCode;
  }

  public void setPinCode(String pinCode) {
    this.pinCode = pinCode;
  }

  public void unsetPinCode() {
    this.pinCode = null;
  }

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

  public void setPinCodeIsSet(boolean value) {
    if (!value) {
      this.pinCode = null;
    }
  }

  public boolean isNeedInsuranceInfo() {
    return this.needInsuranceInfo;
  }

  public void setNeedInsuranceInfo(boolean needInsuranceInfo) {
    this.needInsuranceInfo = needInsuranceInfo;
    setNeedInsuranceInfoIsSet(true);
  }

  public void unsetNeedInsuranceInfo() {
    __isset_bit_vector.clear(__NEEDINSURANCEINFO_ISSET_ID);
  }

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

  public void setNeedInsuranceInfoIsSet(boolean value) {
    __isset_bit_vector.set(__NEEDINSURANCEINFO_ISSET_ID, value);
  }

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

  public java.util.Iterator<String> getValidateCartMessagesIterator() {
    return (this.validateCartMessages == null) ? null : this.validateCartMessages.iterator();
  }

  public void addToValidateCartMessages(String elem) {
    if (this.validateCartMessages == null) {
      this.validateCartMessages = new ArrayList<String>();
    }
    this.validateCartMessages.add(elem);
  }

  public List<String> getValidateCartMessages() {
    return this.validateCartMessages;
  }

  public void setValidateCartMessages(List<String> validateCartMessages) {
    this.validateCartMessages = validateCartMessages;
  }

  public void unsetValidateCartMessages() {
    this.validateCartMessages = null;
  }

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

  public void setValidateCartMessagesIsSet(boolean value) {
    if (!value) {
      this.validateCartMessages = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CART:
      if (value == null) {
        unsetCart();
      } else {
        setCart((Cart)value);
      }
      break;

    case PIN_CODE:
      if (value == null) {
        unsetPinCode();
      } else {
        setPinCode((String)value);
      }
      break;

    case NEED_INSURANCE_INFO:
      if (value == null) {
        unsetNeedInsuranceInfo();
      } else {
        setNeedInsuranceInfo((Boolean)value);
      }
      break;

    case VALIDATE_CART_MESSAGES:
      if (value == null) {
        unsetValidateCartMessages();
      } else {
        setValidateCartMessages((List<String>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case CART:
      return getCart();

    case PIN_CODE:
      return getPinCode();

    case NEED_INSURANCE_INFO:
      return Boolean.valueOf(isNeedInsuranceInfo());

    case VALIDATE_CART_MESSAGES:
      return getValidateCartMessages();

    }
    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 CART:
      return isSetCart();
    case PIN_CODE:
      return isSetPinCode();
    case NEED_INSURANCE_INFO:
      return isSetNeedInsuranceInfo();
    case VALIDATE_CART_MESSAGES:
      return isSetValidateCartMessages();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_cart = true && this.isSetCart();
    boolean that_present_cart = true && that.isSetCart();
    if (this_present_cart || that_present_cart) {
      if (!(this_present_cart && that_present_cart))
        return false;
      if (!this.cart.equals(that.cart))
        return false;
    }

    boolean this_present_pinCode = true && this.isSetPinCode();
    boolean that_present_pinCode = true && that.isSetPinCode();
    if (this_present_pinCode || that_present_pinCode) {
      if (!(this_present_pinCode && that_present_pinCode))
        return false;
      if (!this.pinCode.equals(that.pinCode))
        return false;
    }

    boolean this_present_needInsuranceInfo = true;
    boolean that_present_needInsuranceInfo = true;
    if (this_present_needInsuranceInfo || that_present_needInsuranceInfo) {
      if (!(this_present_needInsuranceInfo && that_present_needInsuranceInfo))
        return false;
      if (this.needInsuranceInfo != that.needInsuranceInfo)
        return false;
    }

    boolean this_present_validateCartMessages = true && this.isSetValidateCartMessages();
    boolean that_present_validateCartMessages = true && that.isSetValidateCartMessages();
    if (this_present_validateCartMessages || that_present_validateCartMessages) {
      if (!(this_present_validateCartMessages && that_present_validateCartMessages))
        return false;
      if (!this.validateCartMessages.equals(that.validateCartMessages))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetCart()).compareTo(typedOther.isSetCart());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCart()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cart, typedOther.cart);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPinCode()).compareTo(typedOther.isSetPinCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPinCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pinCode, typedOther.pinCode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNeedInsuranceInfo()).compareTo(typedOther.isSetNeedInsuranceInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNeedInsuranceInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.needInsuranceInfo, typedOther.needInsuranceInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValidateCartMessages()).compareTo(typedOther.isSetValidateCartMessages());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValidateCartMessages()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validateCartMessages, typedOther.validateCartMessages);
      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: // CART
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.cart = new Cart();
            this.cart.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // PIN_CODE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.pinCode = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // NEED_INSURANCE_INFO
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.needInsuranceInfo = iprot.readBool();
            setNeedInsuranceInfoIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // VALIDATE_CART_MESSAGES
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list12 = iprot.readListBegin();
              this.validateCartMessages = new ArrayList<String>(_list12.size);
              for (int _i13 = 0; _i13 < _list12.size; ++_i13)
              {
                String _elem14; // required
                _elem14 = iprot.readString();
                this.validateCartMessages.add(_elem14);
              }
              iprot.readListEnd();
            }
          } 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);
    if (this.cart != null) {
      oprot.writeFieldBegin(CART_FIELD_DESC);
      this.cart.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.pinCode != null) {
      oprot.writeFieldBegin(PIN_CODE_FIELD_DESC);
      oprot.writeString(this.pinCode);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(NEED_INSURANCE_INFO_FIELD_DESC);
    oprot.writeBool(this.needInsuranceInfo);
    oprot.writeFieldEnd();
    if (this.validateCartMessages != null) {
      oprot.writeFieldBegin(VALIDATE_CART_MESSAGES_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.validateCartMessages.size()));
        for (String _iter15 : this.validateCartMessages)
        {
          oprot.writeString(_iter15);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("cart:");
    if (this.cart == null) {
      sb.append("null");
    } else {
      sb.append(this.cart);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pinCode:");
    if (this.pinCode == null) {
      sb.append("null");
    } else {
      sb.append(this.pinCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("needInsuranceInfo:");
    sb.append(this.needInsuranceInfo);
    first = false;
    if (!first) sb.append(", ");
    sb.append("validateCartMessages:");
    if (this.validateCartMessages == null) {
      sb.append("null");
    } else {
      sb.append(this.validateCartMessages);
    }
    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);
    }
  }

}