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

  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 INSERTION_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("insertionTimestamp", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField SKU_FIELD_DESC = new org.apache.thrift.protocol.TField("sku", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField CREATION_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTimestamp", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField SHIPPED_QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("shippedQuantity", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField SELLABLE_RETURN_QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("sellableReturnQuantity", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField NON_SELLABLE_RETURN_QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("nonSellableReturnQuantity", org.apache.thrift.protocol.TType.I64, (short)7);

  private String amazonOrderId; // required
  private long insertionTimestamp; // required
  private long sku; // required
  private long creationTimestamp; // required
  private long shippedQuantity; // required
  private long sellableReturnQuantity; // required
  private long nonSellableReturnQuantity; // 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"),
    INSERTION_TIMESTAMP((short)2, "insertionTimestamp"),
    SKU((short)3, "sku"),
    CREATION_TIMESTAMP((short)4, "creationTimestamp"),
    SHIPPED_QUANTITY((short)5, "shippedQuantity"),
    SELLABLE_RETURN_QUANTITY((short)6, "sellableReturnQuantity"),
    NON_SELLABLE_RETURN_QUANTITY((short)7, "nonSellableReturnQuantity");

    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: // INSERTION_TIMESTAMP
          return INSERTION_TIMESTAMP;
        case 3: // SKU
          return SKU;
        case 4: // CREATION_TIMESTAMP
          return CREATION_TIMESTAMP;
        case 5: // SHIPPED_QUANTITY
          return SHIPPED_QUANTITY;
        case 6: // SELLABLE_RETURN_QUANTITY
          return SELLABLE_RETURN_QUANTITY;
        case 7: // NON_SELLABLE_RETURN_QUANTITY
          return NON_SELLABLE_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 __INSERTIONTIMESTAMP_ISSET_ID = 0;
  private static final int __SKU_ISSET_ID = 1;
  private static final int __CREATIONTIMESTAMP_ISSET_ID = 2;
  private static final int __SHIPPEDQUANTITY_ISSET_ID = 3;
  private static final int __SELLABLERETURNQUANTITY_ISSET_ID = 4;
  private static final int __NONSELLABLERETURNQUANTITY_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  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.INSERTION_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("insertionTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SKU, new org.apache.thrift.meta_data.FieldMetaData("sku", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CREATION_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("creationTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SHIPPED_QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("shippedQuantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SELLABLE_RETURN_QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("sellableReturnQuantity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.NON_SELLABLE_RETURN_QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("nonSellableReturnQuantity", 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(AmazonFbaOrderReturns.class, metaDataMap);
  }

  public AmazonFbaOrderReturns() {
  }

  public AmazonFbaOrderReturns(
    String amazonOrderId,
    long insertionTimestamp,
    long sku,
    long creationTimestamp,
    long shippedQuantity,
    long sellableReturnQuantity,
    long nonSellableReturnQuantity)
  {
    this();
    this.amazonOrderId = amazonOrderId;
    this.insertionTimestamp = insertionTimestamp;
    setInsertionTimestampIsSet(true);
    this.sku = sku;
    setSkuIsSet(true);
    this.creationTimestamp = creationTimestamp;
    setCreationTimestampIsSet(true);
    this.shippedQuantity = shippedQuantity;
    setShippedQuantityIsSet(true);
    this.sellableReturnQuantity = sellableReturnQuantity;
    setSellableReturnQuantityIsSet(true);
    this.nonSellableReturnQuantity = nonSellableReturnQuantity;
    setNonSellableReturnQuantityIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AmazonFbaOrderReturns(AmazonFbaOrderReturns other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetAmazonOrderId()) {
      this.amazonOrderId = other.amazonOrderId;
    }
    this.insertionTimestamp = other.insertionTimestamp;
    this.sku = other.sku;
    this.creationTimestamp = other.creationTimestamp;
    this.shippedQuantity = other.shippedQuantity;
    this.sellableReturnQuantity = other.sellableReturnQuantity;
    this.nonSellableReturnQuantity = other.nonSellableReturnQuantity;
  }

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

  @Override
  public void clear() {
    this.amazonOrderId = null;
    setInsertionTimestampIsSet(false);
    this.insertionTimestamp = 0;
    setSkuIsSet(false);
    this.sku = 0;
    setCreationTimestampIsSet(false);
    this.creationTimestamp = 0;
    setShippedQuantityIsSet(false);
    this.shippedQuantity = 0;
    setSellableReturnQuantityIsSet(false);
    this.sellableReturnQuantity = 0;
    setNonSellableReturnQuantityIsSet(false);
    this.nonSellableReturnQuantity = 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 getInsertionTimestamp() {
    return this.insertionTimestamp;
  }

  public void setInsertionTimestamp(long insertionTimestamp) {
    this.insertionTimestamp = insertionTimestamp;
    setInsertionTimestampIsSet(true);
  }

  public void unsetInsertionTimestamp() {
    __isset_bit_vector.clear(__INSERTIONTIMESTAMP_ISSET_ID);
  }

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

  public void setInsertionTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__INSERTIONTIMESTAMP_ISSET_ID, value);
  }

  public long getSku() {
    return this.sku;
  }

  public void setSku(long sku) {
    this.sku = sku;
    setSkuIsSet(true);
  }

  public void unsetSku() {
    __isset_bit_vector.clear(__SKU_ISSET_ID);
  }

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

  public void setSkuIsSet(boolean value) {
    __isset_bit_vector.set(__SKU_ISSET_ID, value);
  }

  public long getCreationTimestamp() {
    return this.creationTimestamp;
  }

  public void setCreationTimestamp(long creationTimestamp) {
    this.creationTimestamp = creationTimestamp;
    setCreationTimestampIsSet(true);
  }

  public void unsetCreationTimestamp() {
    __isset_bit_vector.clear(__CREATIONTIMESTAMP_ISSET_ID);
  }

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

  public void setCreationTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__CREATIONTIMESTAMP_ISSET_ID, value);
  }

  public long getShippedQuantity() {
    return this.shippedQuantity;
  }

  public void setShippedQuantity(long shippedQuantity) {
    this.shippedQuantity = shippedQuantity;
    setShippedQuantityIsSet(true);
  }

  public void unsetShippedQuantity() {
    __isset_bit_vector.clear(__SHIPPEDQUANTITY_ISSET_ID);
  }

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

  public void setShippedQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__SHIPPEDQUANTITY_ISSET_ID, value);
  }

  public long getSellableReturnQuantity() {
    return this.sellableReturnQuantity;
  }

  public void setSellableReturnQuantity(long sellableReturnQuantity) {
    this.sellableReturnQuantity = sellableReturnQuantity;
    setSellableReturnQuantityIsSet(true);
  }

  public void unsetSellableReturnQuantity() {
    __isset_bit_vector.clear(__SELLABLERETURNQUANTITY_ISSET_ID);
  }

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

  public void setSellableReturnQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__SELLABLERETURNQUANTITY_ISSET_ID, value);
  }

  public long getNonSellableReturnQuantity() {
    return this.nonSellableReturnQuantity;
  }

  public void setNonSellableReturnQuantity(long nonSellableReturnQuantity) {
    this.nonSellableReturnQuantity = nonSellableReturnQuantity;
    setNonSellableReturnQuantityIsSet(true);
  }

  public void unsetNonSellableReturnQuantity() {
    __isset_bit_vector.clear(__NONSELLABLERETURNQUANTITY_ISSET_ID);
  }

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

  public void setNonSellableReturnQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__NONSELLABLERETURNQUANTITY_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 INSERTION_TIMESTAMP:
      if (value == null) {
        unsetInsertionTimestamp();
      } else {
        setInsertionTimestamp((Long)value);
      }
      break;

    case SKU:
      if (value == null) {
        unsetSku();
      } else {
        setSku((Long)value);
      }
      break;

    case CREATION_TIMESTAMP:
      if (value == null) {
        unsetCreationTimestamp();
      } else {
        setCreationTimestamp((Long)value);
      }
      break;

    case SHIPPED_QUANTITY:
      if (value == null) {
        unsetShippedQuantity();
      } else {
        setShippedQuantity((Long)value);
      }
      break;

    case SELLABLE_RETURN_QUANTITY:
      if (value == null) {
        unsetSellableReturnQuantity();
      } else {
        setSellableReturnQuantity((Long)value);
      }
      break;

    case NON_SELLABLE_RETURN_QUANTITY:
      if (value == null) {
        unsetNonSellableReturnQuantity();
      } else {
        setNonSellableReturnQuantity((Long)value);
      }
      break;

    }
  }

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

    case INSERTION_TIMESTAMP:
      return Long.valueOf(getInsertionTimestamp());

    case SKU:
      return Long.valueOf(getSku());

    case CREATION_TIMESTAMP:
      return Long.valueOf(getCreationTimestamp());

    case SHIPPED_QUANTITY:
      return Long.valueOf(getShippedQuantity());

    case SELLABLE_RETURN_QUANTITY:
      return Long.valueOf(getSellableReturnQuantity());

    case NON_SELLABLE_RETURN_QUANTITY:
      return Long.valueOf(getNonSellableReturnQuantity());

    }
    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 INSERTION_TIMESTAMP:
      return isSetInsertionTimestamp();
    case SKU:
      return isSetSku();
    case CREATION_TIMESTAMP:
      return isSetCreationTimestamp();
    case SHIPPED_QUANTITY:
      return isSetShippedQuantity();
    case SELLABLE_RETURN_QUANTITY:
      return isSetSellableReturnQuantity();
    case NON_SELLABLE_RETURN_QUANTITY:
      return isSetNonSellableReturnQuantity();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(AmazonFbaOrderReturns 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_insertionTimestamp = true;
    boolean that_present_insertionTimestamp = true;
    if (this_present_insertionTimestamp || that_present_insertionTimestamp) {
      if (!(this_present_insertionTimestamp && that_present_insertionTimestamp))
        return false;
      if (this.insertionTimestamp != that.insertionTimestamp)
        return false;
    }

    boolean this_present_sku = true;
    boolean that_present_sku = true;
    if (this_present_sku || that_present_sku) {
      if (!(this_present_sku && that_present_sku))
        return false;
      if (this.sku != that.sku)
        return false;
    }

    boolean this_present_creationTimestamp = true;
    boolean that_present_creationTimestamp = true;
    if (this_present_creationTimestamp || that_present_creationTimestamp) {
      if (!(this_present_creationTimestamp && that_present_creationTimestamp))
        return false;
      if (this.creationTimestamp != that.creationTimestamp)
        return false;
    }

    boolean this_present_shippedQuantity = true;
    boolean that_present_shippedQuantity = true;
    if (this_present_shippedQuantity || that_present_shippedQuantity) {
      if (!(this_present_shippedQuantity && that_present_shippedQuantity))
        return false;
      if (this.shippedQuantity != that.shippedQuantity)
        return false;
    }

    boolean this_present_sellableReturnQuantity = true;
    boolean that_present_sellableReturnQuantity = true;
    if (this_present_sellableReturnQuantity || that_present_sellableReturnQuantity) {
      if (!(this_present_sellableReturnQuantity && that_present_sellableReturnQuantity))
        return false;
      if (this.sellableReturnQuantity != that.sellableReturnQuantity)
        return false;
    }

    boolean this_present_nonSellableReturnQuantity = true;
    boolean that_present_nonSellableReturnQuantity = true;
    if (this_present_nonSellableReturnQuantity || that_present_nonSellableReturnQuantity) {
      if (!(this_present_nonSellableReturnQuantity && that_present_nonSellableReturnQuantity))
        return false;
      if (this.nonSellableReturnQuantity != that.nonSellableReturnQuantity)
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    AmazonFbaOrderReturns typedOther = (AmazonFbaOrderReturns)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(isSetInsertionTimestamp()).compareTo(typedOther.isSetInsertionTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInsertionTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.insertionTimestamp, typedOther.insertionTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSku()).compareTo(typedOther.isSetSku());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSku()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sku, typedOther.sku);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreationTimestamp()).compareTo(typedOther.isSetCreationTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreationTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creationTimestamp, typedOther.creationTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShippedQuantity()).compareTo(typedOther.isSetShippedQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShippedQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shippedQuantity, typedOther.shippedQuantity);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSellableReturnQuantity()).compareTo(typedOther.isSetSellableReturnQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSellableReturnQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sellableReturnQuantity, typedOther.sellableReturnQuantity);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNonSellableReturnQuantity()).compareTo(typedOther.isSetNonSellableReturnQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNonSellableReturnQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nonSellableReturnQuantity, typedOther.nonSellableReturnQuantity);
      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: // INSERTION_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.insertionTimestamp = iprot.readI64();
            setInsertionTimestampIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // SKU
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.sku = iprot.readI64();
            setSkuIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CREATION_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.creationTimestamp = iprot.readI64();
            setCreationTimestampIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // SHIPPED_QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.shippedQuantity = iprot.readI64();
            setShippedQuantityIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // SELLABLE_RETURN_QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.sellableReturnQuantity = iprot.readI64();
            setSellableReturnQuantityIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // NON_SELLABLE_RETURN_QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.nonSellableReturnQuantity = iprot.readI64();
            setNonSellableReturnQuantityIsSet(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(INSERTION_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.insertionTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SKU_FIELD_DESC);
    oprot.writeI64(this.sku);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATION_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.creationTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SHIPPED_QUANTITY_FIELD_DESC);
    oprot.writeI64(this.shippedQuantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SELLABLE_RETURN_QUANTITY_FIELD_DESC);
    oprot.writeI64(this.sellableReturnQuantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(NON_SELLABLE_RETURN_QUANTITY_FIELD_DESC);
    oprot.writeI64(this.nonSellableReturnQuantity);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("AmazonFbaOrderReturns(");
    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("insertionTimestamp:");
    sb.append(this.insertionTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("sku:");
    sb.append(this.sku);
    first = false;
    if (!first) sb.append(", ");
    sb.append("creationTimestamp:");
    sb.append(this.creationTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("shippedQuantity:");
    sb.append(this.shippedQuantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("sellableReturnQuantity:");
    sb.append(this.sellableReturnQuantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("nonSellableReturnQuantity:");
    sb.append(this.nonSellableReturnQuantity);
    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);
    }
  }

}