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.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 AmazonFbaOrderItem implements org.apache.thrift.TBase<AmazonFbaOrderItem, AmazonFbaOrderItem._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AmazonFbaOrderItem");

  private static final org.apache.thrift.protocol.TField AMAZON_ORDER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("amazonOrderId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField PURCHASE_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("purchaseDate", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField ORDER_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("orderStatus", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("item_id", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField FC_LOCATION_FIELD_DESC = new org.apache.thrift.protocol.TField("fcLocation", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField TOTAL_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalAmount", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
  private static final org.apache.thrift.protocol.TField PROMOTION_DISCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionDiscount", org.apache.thrift.protocol.TType.DOUBLE, (short)7);
  private static final org.apache.thrift.protocol.TField QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("quantity", org.apache.thrift.protocol.TType.I64, (short)8);

  private String amazonOrderId; // required
  private long purchaseDate; // required
  private String orderStatus; // required
  private long item_id; // required
  private AmazonFCWarehouseLocation fcLocation; // required
  private double totalAmount; // required
  private double promotionDiscount; // required
  private long quantity; // 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 {
    AMAZON_ORDER_ID((short)1, "amazonOrderId"),
    PURCHASE_DATE((short)2, "purchaseDate"),
    ORDER_STATUS((short)3, "orderStatus"),
    ITEM_ID((short)4, "item_id"),
    /**
     * 
     * @see AmazonFCWarehouseLocation
     */
    FC_LOCATION((short)5, "fcLocation"),
    TOTAL_AMOUNT((short)6, "totalAmount"),
    PROMOTION_DISCOUNT((short)7, "promotionDiscount"),
    QUANTITY((short)8, "quantity");

    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: // AMAZON_ORDER_ID
          return AMAZON_ORDER_ID;
        case 2: // PURCHASE_DATE
          return PURCHASE_DATE;
        case 3: // ORDER_STATUS
          return ORDER_STATUS;
        case 4: // ITEM_ID
          return ITEM_ID;
        case 5: // FC_LOCATION
          return FC_LOCATION;
        case 6: // TOTAL_AMOUNT
          return TOTAL_AMOUNT;
        case 7: // PROMOTION_DISCOUNT
          return PROMOTION_DISCOUNT;
        case 8: // QUANTITY
          return QUANTITY;
        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 __PURCHASEDATE_ISSET_ID = 0;
  private static final int __ITEM_ID_ISSET_ID = 1;
  private static final int __TOTALAMOUNT_ISSET_ID = 2;
  private static final int __PROMOTIONDISCOUNT_ISSET_ID = 3;
  private static final int __QUANTITY_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  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.AMAZON_ORDER_ID, new org.apache.thrift.meta_data.FieldMetaData("amazonOrderId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PURCHASE_DATE, new org.apache.thrift.meta_data.FieldMetaData("purchaseDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ORDER_STATUS, new org.apache.thrift.meta_data.FieldMetaData("orderStatus", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FC_LOCATION, new org.apache.thrift.meta_data.FieldMetaData("fcLocation", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AmazonFCWarehouseLocation.class)));
    tmpMap.put(_Fields.TOTAL_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("totalAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.PROMOTION_DISCOUNT, new org.apache.thrift.meta_data.FieldMetaData("promotionDiscount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("quantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AmazonFbaOrderItem.class, metaDataMap);
  }

  public AmazonFbaOrderItem() {
  }

  public AmazonFbaOrderItem(
    String amazonOrderId,
    long purchaseDate,
    String orderStatus,
    long item_id,
    AmazonFCWarehouseLocation fcLocation,
    double totalAmount,
    double promotionDiscount,
    long quantity)
  {
    this();
    this.amazonOrderId = amazonOrderId;
    this.purchaseDate = purchaseDate;
    setPurchaseDateIsSet(true);
    this.orderStatus = orderStatus;
    this.item_id = item_id;
    setItem_idIsSet(true);
    this.fcLocation = fcLocation;
    this.totalAmount = totalAmount;
    setTotalAmountIsSet(true);
    this.promotionDiscount = promotionDiscount;
    setPromotionDiscountIsSet(true);
    this.quantity = quantity;
    setQuantityIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AmazonFbaOrderItem(AmazonFbaOrderItem other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetAmazonOrderId()) {
      this.amazonOrderId = other.amazonOrderId;
    }
    this.purchaseDate = other.purchaseDate;
    if (other.isSetOrderStatus()) {
      this.orderStatus = other.orderStatus;
    }
    this.item_id = other.item_id;
    if (other.isSetFcLocation()) {
      this.fcLocation = other.fcLocation;
    }
    this.totalAmount = other.totalAmount;
    this.promotionDiscount = other.promotionDiscount;
    this.quantity = other.quantity;
  }

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

  @Override
  public void clear() {
    this.amazonOrderId = null;
    setPurchaseDateIsSet(false);
    this.purchaseDate = 0;
    this.orderStatus = null;
    setItem_idIsSet(false);
    this.item_id = 0;
    this.fcLocation = null;
    setTotalAmountIsSet(false);
    this.totalAmount = 0.0;
    setPromotionDiscountIsSet(false);
    this.promotionDiscount = 0.0;
    setQuantityIsSet(false);
    this.quantity = 0;
  }

  public String getAmazonOrderId() {
    return this.amazonOrderId;
  }

  public void setAmazonOrderId(String amazonOrderId) {
    this.amazonOrderId = amazonOrderId;
  }

  public void unsetAmazonOrderId() {
    this.amazonOrderId = null;
  }

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

  public void setAmazonOrderIdIsSet(boolean value) {
    if (!value) {
      this.amazonOrderId = null;
    }
  }

  public long getPurchaseDate() {
    return this.purchaseDate;
  }

  public void setPurchaseDate(long purchaseDate) {
    this.purchaseDate = purchaseDate;
    setPurchaseDateIsSet(true);
  }

  public void unsetPurchaseDate() {
    __isset_bit_vector.clear(__PURCHASEDATE_ISSET_ID);
  }

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

  public void setPurchaseDateIsSet(boolean value) {
    __isset_bit_vector.set(__PURCHASEDATE_ISSET_ID, value);
  }

  public String getOrderStatus() {
    return this.orderStatus;
  }

  public void setOrderStatus(String orderStatus) {
    this.orderStatus = orderStatus;
  }

  public void unsetOrderStatus() {
    this.orderStatus = null;
  }

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

  public void setOrderStatusIsSet(boolean value) {
    if (!value) {
      this.orderStatus = null;
    }
  }

  public long getItem_id() {
    return this.item_id;
  }

  public void setItem_id(long item_id) {
    this.item_id = item_id;
    setItem_idIsSet(true);
  }

  public void unsetItem_id() {
    __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
  }

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

  public void setItem_idIsSet(boolean value) {
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
  }

  /**
   * 
   * @see AmazonFCWarehouseLocation
   */
  public AmazonFCWarehouseLocation getFcLocation() {
    return this.fcLocation;
  }

  /**
   * 
   * @see AmazonFCWarehouseLocation
   */
  public void setFcLocation(AmazonFCWarehouseLocation fcLocation) {
    this.fcLocation = fcLocation;
  }

  public void unsetFcLocation() {
    this.fcLocation = null;
  }

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

  public void setFcLocationIsSet(boolean value) {
    if (!value) {
      this.fcLocation = null;
    }
  }

  public double getTotalAmount() {
    return this.totalAmount;
  }

  public void setTotalAmount(double totalAmount) {
    this.totalAmount = totalAmount;
    setTotalAmountIsSet(true);
  }

  public void unsetTotalAmount() {
    __isset_bit_vector.clear(__TOTALAMOUNT_ISSET_ID);
  }

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

  public void setTotalAmountIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALAMOUNT_ISSET_ID, value);
  }

  public double getPromotionDiscount() {
    return this.promotionDiscount;
  }

  public void setPromotionDiscount(double promotionDiscount) {
    this.promotionDiscount = promotionDiscount;
    setPromotionDiscountIsSet(true);
  }

  public void unsetPromotionDiscount() {
    __isset_bit_vector.clear(__PROMOTIONDISCOUNT_ISSET_ID);
  }

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

  public void setPromotionDiscountIsSet(boolean value) {
    __isset_bit_vector.set(__PROMOTIONDISCOUNT_ISSET_ID, value);
  }

  public long getQuantity() {
    return this.quantity;
  }

  public void setQuantity(long quantity) {
    this.quantity = quantity;
    setQuantityIsSet(true);
  }

  public void unsetQuantity() {
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
  }

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

  public void setQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case AMAZON_ORDER_ID:
      if (value == null) {
        unsetAmazonOrderId();
      } else {
        setAmazonOrderId((String)value);
      }
      break;

    case PURCHASE_DATE:
      if (value == null) {
        unsetPurchaseDate();
      } else {
        setPurchaseDate((Long)value);
      }
      break;

    case ORDER_STATUS:
      if (value == null) {
        unsetOrderStatus();
      } else {
        setOrderStatus((String)value);
      }
      break;

    case ITEM_ID:
      if (value == null) {
        unsetItem_id();
      } else {
        setItem_id((Long)value);
      }
      break;

    case FC_LOCATION:
      if (value == null) {
        unsetFcLocation();
      } else {
        setFcLocation((AmazonFCWarehouseLocation)value);
      }
      break;

    case TOTAL_AMOUNT:
      if (value == null) {
        unsetTotalAmount();
      } else {
        setTotalAmount((Double)value);
      }
      break;

    case PROMOTION_DISCOUNT:
      if (value == null) {
        unsetPromotionDiscount();
      } else {
        setPromotionDiscount((Double)value);
      }
      break;

    case QUANTITY:
      if (value == null) {
        unsetQuantity();
      } else {
        setQuantity((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case AMAZON_ORDER_ID:
      return getAmazonOrderId();

    case PURCHASE_DATE:
      return Long.valueOf(getPurchaseDate());

    case ORDER_STATUS:
      return getOrderStatus();

    case ITEM_ID:
      return Long.valueOf(getItem_id());

    case FC_LOCATION:
      return getFcLocation();

    case TOTAL_AMOUNT:
      return Double.valueOf(getTotalAmount());

    case PROMOTION_DISCOUNT:
      return Double.valueOf(getPromotionDiscount());

    case QUANTITY:
      return Long.valueOf(getQuantity());

    }
    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 AMAZON_ORDER_ID:
      return isSetAmazonOrderId();
    case PURCHASE_DATE:
      return isSetPurchaseDate();
    case ORDER_STATUS:
      return isSetOrderStatus();
    case ITEM_ID:
      return isSetItem_id();
    case FC_LOCATION:
      return isSetFcLocation();
    case TOTAL_AMOUNT:
      return isSetTotalAmount();
    case PROMOTION_DISCOUNT:
      return isSetPromotionDiscount();
    case QUANTITY:
      return isSetQuantity();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_amazonOrderId = true && this.isSetAmazonOrderId();
    boolean that_present_amazonOrderId = true && that.isSetAmazonOrderId();
    if (this_present_amazonOrderId || that_present_amazonOrderId) {
      if (!(this_present_amazonOrderId && that_present_amazonOrderId))
        return false;
      if (!this.amazonOrderId.equals(that.amazonOrderId))
        return false;
    }

    boolean this_present_purchaseDate = true;
    boolean that_present_purchaseDate = true;
    if (this_present_purchaseDate || that_present_purchaseDate) {
      if (!(this_present_purchaseDate && that_present_purchaseDate))
        return false;
      if (this.purchaseDate != that.purchaseDate)
        return false;
    }

    boolean this_present_orderStatus = true && this.isSetOrderStatus();
    boolean that_present_orderStatus = true && that.isSetOrderStatus();
    if (this_present_orderStatus || that_present_orderStatus) {
      if (!(this_present_orderStatus && that_present_orderStatus))
        return false;
      if (!this.orderStatus.equals(that.orderStatus))
        return false;
    }

    boolean this_present_item_id = true;
    boolean that_present_item_id = true;
    if (this_present_item_id || that_present_item_id) {
      if (!(this_present_item_id && that_present_item_id))
        return false;
      if (this.item_id != that.item_id)
        return false;
    }

    boolean this_present_fcLocation = true && this.isSetFcLocation();
    boolean that_present_fcLocation = true && that.isSetFcLocation();
    if (this_present_fcLocation || that_present_fcLocation) {
      if (!(this_present_fcLocation && that_present_fcLocation))
        return false;
      if (!this.fcLocation.equals(that.fcLocation))
        return false;
    }

    boolean this_present_totalAmount = true;
    boolean that_present_totalAmount = true;
    if (this_present_totalAmount || that_present_totalAmount) {
      if (!(this_present_totalAmount && that_present_totalAmount))
        return false;
      if (this.totalAmount != that.totalAmount)
        return false;
    }

    boolean this_present_promotionDiscount = true;
    boolean that_present_promotionDiscount = true;
    if (this_present_promotionDiscount || that_present_promotionDiscount) {
      if (!(this_present_promotionDiscount && that_present_promotionDiscount))
        return false;
      if (this.promotionDiscount != that.promotionDiscount)
        return false;
    }

    boolean this_present_quantity = true;
    boolean that_present_quantity = true;
    if (this_present_quantity || that_present_quantity) {
      if (!(this_present_quantity && that_present_quantity))
        return false;
      if (this.quantity != that.quantity)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetAmazonOrderId()).compareTo(typedOther.isSetAmazonOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmazonOrderId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amazonOrderId, typedOther.amazonOrderId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPurchaseDate()).compareTo(typedOther.isSetPurchaseDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPurchaseDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purchaseDate, typedOther.purchaseDate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrderStatus()).compareTo(typedOther.isSetOrderStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrderStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orderStatus, typedOther.orderStatus);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(typedOther.isSetItem_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItem_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFcLocation()).compareTo(typedOther.isSetFcLocation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFcLocation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fcLocation, typedOther.fcLocation);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotalAmount()).compareTo(typedOther.isSetTotalAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalAmount, typedOther.totalAmount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPromotionDiscount()).compareTo(typedOther.isSetPromotionDiscount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPromotionDiscount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionDiscount, typedOther.promotionDiscount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(typedOther.isSetQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.quantity, typedOther.quantity);
      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: // AMAZON_ORDER_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.amazonOrderId = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // PURCHASE_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.purchaseDate = iprot.readI64();
            setPurchaseDateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // ORDER_STATUS
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.orderStatus = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.item_id = iprot.readI64();
            setItem_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // FC_LOCATION
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.fcLocation = AmazonFCWarehouseLocation.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // TOTAL_AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.totalAmount = iprot.readDouble();
            setTotalAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // PROMOTION_DISCOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.promotionDiscount = iprot.readDouble();
            setPromotionDiscountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.quantity = iprot.readI64();
            setQuantityIsSet(true);
          } 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.amazonOrderId != null) {
      oprot.writeFieldBegin(AMAZON_ORDER_ID_FIELD_DESC);
      oprot.writeString(this.amazonOrderId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(PURCHASE_DATE_FIELD_DESC);
    oprot.writeI64(this.purchaseDate);
    oprot.writeFieldEnd();
    if (this.orderStatus != null) {
      oprot.writeFieldBegin(ORDER_STATUS_FIELD_DESC);
      oprot.writeString(this.orderStatus);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.item_id);
    oprot.writeFieldEnd();
    if (this.fcLocation != null) {
      oprot.writeFieldBegin(FC_LOCATION_FIELD_DESC);
      oprot.writeI32(this.fcLocation.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(TOTAL_AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.totalAmount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROMOTION_DISCOUNT_FIELD_DESC);
    oprot.writeDouble(this.promotionDiscount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
    oprot.writeI64(this.quantity);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("amazonOrderId:");
    if (this.amazonOrderId == null) {
      sb.append("null");
    } else {
      sb.append(this.amazonOrderId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("purchaseDate:");
    sb.append(this.purchaseDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("orderStatus:");
    if (this.orderStatus == null) {
      sb.append("null");
    } else {
      sb.append(this.orderStatus);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("item_id:");
    sb.append(this.item_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fcLocation:");
    if (this.fcLocation == null) {
      sb.append("null");
    } else {
      sb.append(this.fcLocation);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("totalAmount:");
    sb.append(this.totalAmount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("promotionDiscount:");
    sb.append(this.promotionDiscount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("quantity:");
    sb.append(this.quantity);
    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);
    }
  }

}