Subversion Repositories SmartDukaan

Rev

Rev 5553 | Go to most recent revision | 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.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 Cart implements org.apache.thrift.TBase<Cart, Cart._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Cart");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField LINES_FIELD_DESC = new org.apache.thrift.protocol.TField("lines", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField CREATED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("createdOn", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField UPDATED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedOn", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField CHECKED_OUT_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("checkedOutOn", org.apache.thrift.protocol.TType.I64, (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 TOTAL_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("totalPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)8);
  private static final org.apache.thrift.protocol.TField DISCOUNTED_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("discountedPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)9);
  private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField PICKUP_STORE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("pickupStoreId", org.apache.thrift.protocol.TType.I64, (short)11);
  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)12);

  private long id; // required
  private List<Line> lines; // required
  private CartStatus status; // required
  private long createdOn; // required
  private long updatedOn; // required
  private long checkedOutOn; // required
  private long addressId; // required
  private double totalPrice; // required
  private double discountedPrice; // required
  private String couponCode; // required
  private long pickupStoreId; // required
  private String message; // 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 {
    ID((short)1, "id"),
    LINES((short)2, "lines"),
    /**
     * 
     * @see CartStatus
     */
    STATUS((short)3, "status"),
    CREATED_ON((short)4, "createdOn"),
    UPDATED_ON((short)5, "updatedOn"),
    CHECKED_OUT_ON((short)6, "checkedOutOn"),
    ADDRESS_ID((short)7, "addressId"),
    TOTAL_PRICE((short)8, "totalPrice"),
    DISCOUNTED_PRICE((short)9, "discountedPrice"),
    COUPON_CODE((short)10, "couponCode"),
    PICKUP_STORE_ID((short)11, "pickupStoreId"),
    MESSAGE((short)12, "message");

    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: // ID
          return ID;
        case 2: // LINES
          return LINES;
        case 3: // STATUS
          return STATUS;
        case 4: // CREATED_ON
          return CREATED_ON;
        case 5: // UPDATED_ON
          return UPDATED_ON;
        case 6: // CHECKED_OUT_ON
          return CHECKED_OUT_ON;
        case 7: // ADDRESS_ID
          return ADDRESS_ID;
        case 8: // TOTAL_PRICE
          return TOTAL_PRICE;
        case 9: // DISCOUNTED_PRICE
          return DISCOUNTED_PRICE;
        case 10: // COUPON_CODE
          return COUPON_CODE;
        case 11: // PICKUP_STORE_ID
          return PICKUP_STORE_ID;
        case 12: // MESSAGE
          return MESSAGE;
        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 __ID_ISSET_ID = 0;
  private static final int __CREATEDON_ISSET_ID = 1;
  private static final int __UPDATEDON_ISSET_ID = 2;
  private static final int __CHECKEDOUTON_ISSET_ID = 3;
  private static final int __ADDRESSID_ISSET_ID = 4;
  private static final int __TOTALPRICE_ISSET_ID = 5;
  private static final int __DISCOUNTEDPRICE_ISSET_ID = 6;
  private static final int __PICKUPSTOREID_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LINES, new org.apache.thrift.meta_data.FieldMetaData("lines", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Line.class))));
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CartStatus.class)));
    tmpMap.put(_Fields.CREATED_ON, new org.apache.thrift.meta_data.FieldMetaData("createdOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.UPDATED_ON, new org.apache.thrift.meta_data.FieldMetaData("updatedOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CHECKED_OUT_ON, new org.apache.thrift.meta_data.FieldMetaData("checkedOutOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    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.TOTAL_PRICE, new org.apache.thrift.meta_data.FieldMetaData("totalPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.DISCOUNTED_PRICE, new org.apache.thrift.meta_data.FieldMetaData("discountedPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PICKUP_STORE_ID, new org.apache.thrift.meta_data.FieldMetaData("pickupStoreId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", 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(Cart.class, metaDataMap);
  }

  public Cart() {
  }

  public Cart(
    long id,
    List<Line> lines,
    CartStatus status,
    long createdOn,
    long updatedOn,
    long checkedOutOn,
    long addressId,
    double totalPrice,
    double discountedPrice,
    String couponCode,
    long pickupStoreId,
    String message)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.lines = lines;
    this.status = status;
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
    this.checkedOutOn = checkedOutOn;
    setCheckedOutOnIsSet(true);
    this.addressId = addressId;
    setAddressIdIsSet(true);
    this.totalPrice = totalPrice;
    setTotalPriceIsSet(true);
    this.discountedPrice = discountedPrice;
    setDiscountedPriceIsSet(true);
    this.couponCode = couponCode;
    this.pickupStoreId = pickupStoreId;
    setPickupStoreIdIsSet(true);
    this.message = message;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Cart(Cart other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetLines()) {
      List<Line> __this__lines = new ArrayList<Line>();
      for (Line other_element : other.lines) {
        __this__lines.add(new Line(other_element));
      }
      this.lines = __this__lines;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    this.createdOn = other.createdOn;
    this.updatedOn = other.updatedOn;
    this.checkedOutOn = other.checkedOutOn;
    this.addressId = other.addressId;
    this.totalPrice = other.totalPrice;
    this.discountedPrice = other.discountedPrice;
    if (other.isSetCouponCode()) {
      this.couponCode = other.couponCode;
    }
    this.pickupStoreId = other.pickupStoreId;
    if (other.isSetMessage()) {
      this.message = other.message;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.lines = null;
    this.status = null;
    setCreatedOnIsSet(false);
    this.createdOn = 0;
    setUpdatedOnIsSet(false);
    this.updatedOn = 0;
    setCheckedOutOnIsSet(false);
    this.checkedOutOn = 0;
    setAddressIdIsSet(false);
    this.addressId = 0;
    setTotalPriceIsSet(false);
    this.totalPrice = 0.0;
    setDiscountedPriceIsSet(false);
    this.discountedPrice = 0.0;
    this.couponCode = null;
    setPickupStoreIdIsSet(false);
    this.pickupStoreId = 0;
    this.message = null;
  }

  public long getId() {
    return this.id;
  }

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

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

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

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

  public java.util.Iterator<Line> getLinesIterator() {
    return (this.lines == null) ? null : this.lines.iterator();
  }

  public void addToLines(Line elem) {
    if (this.lines == null) {
      this.lines = new ArrayList<Line>();
    }
    this.lines.add(elem);
  }

  public List<Line> getLines() {
    return this.lines;
  }

  public void setLines(List<Line> lines) {
    this.lines = lines;
  }

  public void unsetLines() {
    this.lines = null;
  }

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

  public void setLinesIsSet(boolean value) {
    if (!value) {
      this.lines = null;
    }
  }

  /**
   * 
   * @see CartStatus
   */
  public CartStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see CartStatus
   */
  public void setStatus(CartStatus status) {
    this.status = status;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public long getCreatedOn() {
    return this.createdOn;
  }

  public void setCreatedOn(long createdOn) {
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
  }

  public void unsetCreatedOn() {
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
  }

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

  public void setCreatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
  }

  public long getUpdatedOn() {
    return this.updatedOn;
  }

  public void setUpdatedOn(long updatedOn) {
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
  }

  public void unsetUpdatedOn() {
    __isset_bit_vector.clear(__UPDATEDON_ISSET_ID);
  }

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

  public void setUpdatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__UPDATEDON_ISSET_ID, value);
  }

  public long getCheckedOutOn() {
    return this.checkedOutOn;
  }

  public void setCheckedOutOn(long checkedOutOn) {
    this.checkedOutOn = checkedOutOn;
    setCheckedOutOnIsSet(true);
  }

  public void unsetCheckedOutOn() {
    __isset_bit_vector.clear(__CHECKEDOUTON_ISSET_ID);
  }

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

  public void setCheckedOutOnIsSet(boolean value) {
    __isset_bit_vector.set(__CHECKEDOUTON_ISSET_ID, value);
  }

  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 double getTotalPrice() {
    return this.totalPrice;
  }

  public void setTotalPrice(double totalPrice) {
    this.totalPrice = totalPrice;
    setTotalPriceIsSet(true);
  }

  public void unsetTotalPrice() {
    __isset_bit_vector.clear(__TOTALPRICE_ISSET_ID);
  }

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

  public void setTotalPriceIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALPRICE_ISSET_ID, value);
  }

  public double getDiscountedPrice() {
    return this.discountedPrice;
  }

  public void setDiscountedPrice(double discountedPrice) {
    this.discountedPrice = discountedPrice;
    setDiscountedPriceIsSet(true);
  }

  public void unsetDiscountedPrice() {
    __isset_bit_vector.clear(__DISCOUNTEDPRICE_ISSET_ID);
  }

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

  public void setDiscountedPriceIsSet(boolean value) {
    __isset_bit_vector.set(__DISCOUNTEDPRICE_ISSET_ID, value);
  }

  public String getCouponCode() {
    return this.couponCode;
  }

  public void setCouponCode(String couponCode) {
    this.couponCode = couponCode;
  }

  public void unsetCouponCode() {
    this.couponCode = null;
  }

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

  public void setCouponCodeIsSet(boolean value) {
    if (!value) {
      this.couponCode = null;
    }
  }

  public long getPickupStoreId() {
    return this.pickupStoreId;
  }

  public void setPickupStoreId(long pickupStoreId) {
    this.pickupStoreId = pickupStoreId;
    setPickupStoreIdIsSet(true);
  }

  public void unsetPickupStoreId() {
    __isset_bit_vector.clear(__PICKUPSTOREID_ISSET_ID);
  }

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

  public void setPickupStoreIdIsSet(boolean value) {
    __isset_bit_vector.set(__PICKUPSTOREID_ISSET_ID, value);
  }

  public String getMessage() {
    return this.message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public void unsetMessage() {
    this.message = null;
  }

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

  public void setMessageIsSet(boolean value) {
    if (!value) {
      this.message = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case LINES:
      if (value == null) {
        unsetLines();
      } else {
        setLines((List<Line>)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((CartStatus)value);
      }
      break;

    case CREATED_ON:
      if (value == null) {
        unsetCreatedOn();
      } else {
        setCreatedOn((Long)value);
      }
      break;

    case UPDATED_ON:
      if (value == null) {
        unsetUpdatedOn();
      } else {
        setUpdatedOn((Long)value);
      }
      break;

    case CHECKED_OUT_ON:
      if (value == null) {
        unsetCheckedOutOn();
      } else {
        setCheckedOutOn((Long)value);
      }
      break;

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

    case TOTAL_PRICE:
      if (value == null) {
        unsetTotalPrice();
      } else {
        setTotalPrice((Double)value);
      }
      break;

    case DISCOUNTED_PRICE:
      if (value == null) {
        unsetDiscountedPrice();
      } else {
        setDiscountedPrice((Double)value);
      }
      break;

    case COUPON_CODE:
      if (value == null) {
        unsetCouponCode();
      } else {
        setCouponCode((String)value);
      }
      break;

    case PICKUP_STORE_ID:
      if (value == null) {
        unsetPickupStoreId();
      } else {
        setPickupStoreId((Long)value);
      }
      break;

    case MESSAGE:
      if (value == null) {
        unsetMessage();
      } else {
        setMessage((String)value);
      }
      break;

    }
  }

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

    case LINES:
      return getLines();

    case STATUS:
      return getStatus();

    case CREATED_ON:
      return Long.valueOf(getCreatedOn());

    case UPDATED_ON:
      return Long.valueOf(getUpdatedOn());

    case CHECKED_OUT_ON:
      return Long.valueOf(getCheckedOutOn());

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

    case TOTAL_PRICE:
      return Double.valueOf(getTotalPrice());

    case DISCOUNTED_PRICE:
      return Double.valueOf(getDiscountedPrice());

    case COUPON_CODE:
      return getCouponCode();

    case PICKUP_STORE_ID:
      return Long.valueOf(getPickupStoreId());

    case MESSAGE:
      return getMessage();

    }
    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 ID:
      return isSetId();
    case LINES:
      return isSetLines();
    case STATUS:
      return isSetStatus();
    case CREATED_ON:
      return isSetCreatedOn();
    case UPDATED_ON:
      return isSetUpdatedOn();
    case CHECKED_OUT_ON:
      return isSetCheckedOutOn();
    case ADDRESS_ID:
      return isSetAddressId();
    case TOTAL_PRICE:
      return isSetTotalPrice();
    case DISCOUNTED_PRICE:
      return isSetDiscountedPrice();
    case COUPON_CODE:
      return isSetCouponCode();
    case PICKUP_STORE_ID:
      return isSetPickupStoreId();
    case MESSAGE:
      return isSetMessage();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_lines = true && this.isSetLines();
    boolean that_present_lines = true && that.isSetLines();
    if (this_present_lines || that_present_lines) {
      if (!(this_present_lines && that_present_lines))
        return false;
      if (!this.lines.equals(that.lines))
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_createdOn = true;
    boolean that_present_createdOn = true;
    if (this_present_createdOn || that_present_createdOn) {
      if (!(this_present_createdOn && that_present_createdOn))
        return false;
      if (this.createdOn != that.createdOn)
        return false;
    }

    boolean this_present_updatedOn = true;
    boolean that_present_updatedOn = true;
    if (this_present_updatedOn || that_present_updatedOn) {
      if (!(this_present_updatedOn && that_present_updatedOn))
        return false;
      if (this.updatedOn != that.updatedOn)
        return false;
    }

    boolean this_present_checkedOutOn = true;
    boolean that_present_checkedOutOn = true;
    if (this_present_checkedOutOn || that_present_checkedOutOn) {
      if (!(this_present_checkedOutOn && that_present_checkedOutOn))
        return false;
      if (this.checkedOutOn != that.checkedOutOn)
        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_totalPrice = true;
    boolean that_present_totalPrice = true;
    if (this_present_totalPrice || that_present_totalPrice) {
      if (!(this_present_totalPrice && that_present_totalPrice))
        return false;
      if (this.totalPrice != that.totalPrice)
        return false;
    }

    boolean this_present_discountedPrice = true;
    boolean that_present_discountedPrice = true;
    if (this_present_discountedPrice || that_present_discountedPrice) {
      if (!(this_present_discountedPrice && that_present_discountedPrice))
        return false;
      if (this.discountedPrice != that.discountedPrice)
        return false;
    }

    boolean this_present_couponCode = true && this.isSetCouponCode();
    boolean that_present_couponCode = true && that.isSetCouponCode();
    if (this_present_couponCode || that_present_couponCode) {
      if (!(this_present_couponCode && that_present_couponCode))
        return false;
      if (!this.couponCode.equals(that.couponCode))
        return false;
    }

    boolean this_present_pickupStoreId = true;
    boolean that_present_pickupStoreId = true;
    if (this_present_pickupStoreId || that_present_pickupStoreId) {
      if (!(this_present_pickupStoreId && that_present_pickupStoreId))
        return false;
      if (this.pickupStoreId != that.pickupStoreId)
        return false;
    }

    boolean this_present_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message))
        return false;
      if (!this.message.equals(that.message))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLines()).compareTo(typedOther.isSetLines());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLines()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lines, typedOther.lines);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(typedOther.isSetCreatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreatedOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createdOn, typedOther.createdOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpdatedOn()).compareTo(typedOther.isSetUpdatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdatedOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updatedOn, typedOther.updatedOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCheckedOutOn()).compareTo(typedOther.isSetCheckedOutOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCheckedOutOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.checkedOutOn, typedOther.checkedOutOn);
      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(isSetTotalPrice()).compareTo(typedOther.isSetTotalPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalPrice, typedOther.totalPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDiscountedPrice()).compareTo(typedOther.isSetDiscountedPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDiscountedPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discountedPrice, typedOther.discountedPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCouponCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPickupStoreId()).compareTo(typedOther.isSetPickupStoreId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPickupStoreId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pickupStoreId, typedOther.pickupStoreId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
      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: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // LINES
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
              this.lines = new ArrayList<Line>(_list8.size);
              for (int _i9 = 0; _i9 < _list8.size; ++_i9)
              {
                Line _elem10; // required
                _elem10 = new Line();
                _elem10.read(iprot);
                this.lines.add(_elem10);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // STATUS
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.status = CartStatus.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CREATED_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.createdOn = iprot.readI64();
            setCreatedOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // UPDATED_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.updatedOn = iprot.readI64();
            setUpdatedOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // CHECKED_OUT_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.checkedOutOn = iprot.readI64();
            setCheckedOutOnIsSet(true);
          } 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: // TOTAL_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.totalPrice = iprot.readDouble();
            setTotalPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // DISCOUNTED_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.discountedPrice = iprot.readDouble();
            setDiscountedPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // COUPON_CODE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.couponCode = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // PICKUP_STORE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.pickupStoreId = iprot.readI64();
            setPickupStoreIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 12: // MESSAGE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.message = 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(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.lines != null) {
      oprot.writeFieldBegin(LINES_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.lines.size()));
        for (Line _iter11 : this.lines)
        {
          _iter11.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
    oprot.writeI64(this.createdOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_ON_FIELD_DESC);
    oprot.writeI64(this.updatedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CHECKED_OUT_ON_FIELD_DESC);
    oprot.writeI64(this.checkedOutOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ADDRESS_ID_FIELD_DESC);
    oprot.writeI64(this.addressId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_PRICE_FIELD_DESC);
    oprot.writeDouble(this.totalPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DISCOUNTED_PRICE_FIELD_DESC);
    oprot.writeDouble(this.discountedPrice);
    oprot.writeFieldEnd();
    if (this.couponCode != null) {
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
      oprot.writeString(this.couponCode);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(PICKUP_STORE_ID_FIELD_DESC);
    oprot.writeI64(this.pickupStoreId);
    oprot.writeFieldEnd();
    if (this.message != null) {
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
      oprot.writeString(this.message);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("lines:");
    if (this.lines == null) {
      sb.append("null");
    } else {
      sb.append(this.lines);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdOn:");
    sb.append(this.createdOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("updatedOn:");
    sb.append(this.updatedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("checkedOutOn:");
    sb.append(this.checkedOutOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("addressId:");
    sb.append(this.addressId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("totalPrice:");
    sb.append(this.totalPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("discountedPrice:");
    sb.append(this.discountedPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("couponCode:");
    if (this.couponCode == null) {
      sb.append("null");
    } else {
      sb.append(this.couponCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pickupStoreId:");
    sb.append(this.pickupStoreId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("message:");
    if (this.message == null) {
      sb.append("null");
    } else {
      sb.append(this.message);
    }
    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);
    }
  }

}