Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.warehouse;

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

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class LineItem implements TBase<LineItem._Fields>, java.io.Serializable, Cloneable, Comparable<LineItem> {
  private static final TStruct STRUCT_DESC = new TStruct("LineItem");

  private static final TField ORDER_ID_FIELD_DESC = new TField("orderId", TType.I64, (short)1);
  private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)2);
  private static final TField PRODUCT_GROUP_FIELD_DESC = new TField("productGroup", TType.STRING, (short)3);
  private static final TField BRAND_FIELD_DESC = new TField("brand", TType.STRING, (short)4);
  private static final TField MODEL_NUMBER_FIELD_DESC = new TField("modelNumber", TType.STRING, (short)5);
  private static final TField MODEL_NAME_FIELD_DESC = new TField("modelName", TType.STRING, (short)6);
  private static final TField COLOR_FIELD_DESC = new TField("color", TType.STRING, (short)7);
  private static final TField ITEM_NUMBER_FIELD_DESC = new TField("itemNumber", TType.STRING, (short)8);
  private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.DOUBLE, (short)9);
  private static final TField UNFULFILLED_QUANTITY_FIELD_DESC = new TField("unfulfilledQuantity", TType.DOUBLE, (short)10);
  private static final TField CREATED_AT_FIELD_DESC = new TField("createdAt", TType.I64, (short)11);
  private static final TField UNIT_PRICE_FIELD_DESC = new TField("unitPrice", TType.DOUBLE, (short)12);
  private static final TField FULFILLED_FIELD_DESC = new TField("fulfilled", TType.BOOL, (short)13);

  private long orderId;
  private long itemId;
  private String productGroup;
  private String brand;
  private String modelNumber;
  private String modelName;
  private String color;
  private String itemNumber;
  private double quantity;
  private double unfulfilledQuantity;
  private long createdAt;
  private double unitPrice;
  private boolean fulfilled;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ORDER_ID((short)1, "orderId"),
    ITEM_ID((short)2, "itemId"),
    PRODUCT_GROUP((short)3, "productGroup"),
    BRAND((short)4, "brand"),
    MODEL_NUMBER((short)5, "modelNumber"),
    MODEL_NAME((short)6, "modelName"),
    COLOR((short)7, "color"),
    ITEM_NUMBER((short)8, "itemNumber"),
    QUANTITY((short)9, "quantity"),
    UNFULFILLED_QUANTITY((short)10, "unfulfilledQuantity"),
    CREATED_AT((short)11, "createdAt"),
    UNIT_PRICE((short)12, "unitPrice"),
    FULFILLED((short)13, "fulfilled");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __ORDERID_ISSET_ID = 0;
  private static final int __ITEMID_ISSET_ID = 1;
  private static final int __QUANTITY_ISSET_ID = 2;
  private static final int __UNFULFILLEDQUANTITY_ISSET_ID = 3;
  private static final int __CREATEDAT_ISSET_ID = 4;
  private static final int __UNITPRICE_ISSET_ID = 5;
  private static final int __FULFILLED_ISSET_ID = 6;
  private BitSet __isset_bit_vector = new BitSet(7);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.ORDER_ID, new FieldMetaData("orderId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.PRODUCT_GROUP, new FieldMetaData("productGroup", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.BRAND, new FieldMetaData("brand", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MODEL_NUMBER, new FieldMetaData("modelNumber", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MODEL_NAME, new FieldMetaData("modelName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.COLOR, new FieldMetaData("color", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ITEM_NUMBER, new FieldMetaData("itemNumber", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.UNFULFILLED_QUANTITY, new FieldMetaData("unfulfilledQuantity", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.CREATED_AT, new FieldMetaData("createdAt", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.UNIT_PRICE, new FieldMetaData("unitPrice", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.FULFILLED, new FieldMetaData("fulfilled", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(LineItem.class, metaDataMap);
  }

  public LineItem() {
  }

  public LineItem(
    long orderId,
    long itemId,
    String productGroup,
    String brand,
    String modelNumber,
    String modelName,
    String color,
    String itemNumber,
    double quantity,
    double unfulfilledQuantity,
    long createdAt,
    double unitPrice,
    boolean fulfilled)
  {
    this();
    this.orderId = orderId;
    setOrderIdIsSet(true);
    this.itemId = itemId;
    setItemIdIsSet(true);
    this.productGroup = productGroup;
    this.brand = brand;
    this.modelNumber = modelNumber;
    this.modelName = modelName;
    this.color = color;
    this.itemNumber = itemNumber;
    this.quantity = quantity;
    setQuantityIsSet(true);
    this.unfulfilledQuantity = unfulfilledQuantity;
    setUnfulfilledQuantityIsSet(true);
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
    this.unitPrice = unitPrice;
    setUnitPriceIsSet(true);
    this.fulfilled = fulfilled;
    setFulfilledIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public LineItem(LineItem other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.orderId = other.orderId;
    this.itemId = other.itemId;
    if (other.isSetProductGroup()) {
      this.productGroup = other.productGroup;
    }
    if (other.isSetBrand()) {
      this.brand = other.brand;
    }
    if (other.isSetModelNumber()) {
      this.modelNumber = other.modelNumber;
    }
    if (other.isSetModelName()) {
      this.modelName = other.modelName;
    }
    if (other.isSetColor()) {
      this.color = other.color;
    }
    if (other.isSetItemNumber()) {
      this.itemNumber = other.itemNumber;
    }
    this.quantity = other.quantity;
    this.unfulfilledQuantity = other.unfulfilledQuantity;
    this.createdAt = other.createdAt;
    this.unitPrice = other.unitPrice;
    this.fulfilled = other.fulfilled;
  }

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

  @Deprecated
  public LineItem clone() {
    return new LineItem(this);
  }

  public long getOrderId() {
    return this.orderId;
  }

  public LineItem setOrderId(long orderId) {
    this.orderId = orderId;
    setOrderIdIsSet(true);
    return this;
  }

  public void unsetOrderId() {
    __isset_bit_vector.clear(__ORDERID_ISSET_ID);
  }

  /** Returns true if field orderId is set (has been asigned a value) and false otherwise */
  public boolean isSetOrderId() {
    return __isset_bit_vector.get(__ORDERID_ISSET_ID);
  }

  public void setOrderIdIsSet(boolean value) {
    __isset_bit_vector.set(__ORDERID_ISSET_ID, value);
  }

  public long getItemId() {
    return this.itemId;
  }

  public LineItem setItemId(long itemId) {
    this.itemId = itemId;
    setItemIdIsSet(true);
    return this;
  }

  public void unsetItemId() {
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
  }

  /** Returns true if field itemId is set (has been asigned a value) and false otherwise */
  public boolean isSetItemId() {
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
  }

  public void setItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
  }

  public String getProductGroup() {
    return this.productGroup;
  }

  public LineItem setProductGroup(String productGroup) {
    this.productGroup = productGroup;
    return this;
  }

  public void unsetProductGroup() {
    this.productGroup = null;
  }

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

  public void setProductGroupIsSet(boolean value) {
    if (!value) {
      this.productGroup = null;
    }
  }

  public String getBrand() {
    return this.brand;
  }

  public LineItem setBrand(String brand) {
    this.brand = brand;
    return this;
  }

  public void unsetBrand() {
    this.brand = null;
  }

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

  public void setBrandIsSet(boolean value) {
    if (!value) {
      this.brand = null;
    }
  }

  public String getModelNumber() {
    return this.modelNumber;
  }

  public LineItem setModelNumber(String modelNumber) {
    this.modelNumber = modelNumber;
    return this;
  }

  public void unsetModelNumber() {
    this.modelNumber = null;
  }

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

  public void setModelNumberIsSet(boolean value) {
    if (!value) {
      this.modelNumber = null;
    }
  }

  public String getModelName() {
    return this.modelName;
  }

  public LineItem setModelName(String modelName) {
    this.modelName = modelName;
    return this;
  }

  public void unsetModelName() {
    this.modelName = null;
  }

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

  public void setModelNameIsSet(boolean value) {
    if (!value) {
      this.modelName = null;
    }
  }

  public String getColor() {
    return this.color;
  }

  public LineItem setColor(String color) {
    this.color = color;
    return this;
  }

  public void unsetColor() {
    this.color = null;
  }

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

  public void setColorIsSet(boolean value) {
    if (!value) {
      this.color = null;
    }
  }

  public String getItemNumber() {
    return this.itemNumber;
  }

  public LineItem setItemNumber(String itemNumber) {
    this.itemNumber = itemNumber;
    return this;
  }

  public void unsetItemNumber() {
    this.itemNumber = null;
  }

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

  public void setItemNumberIsSet(boolean value) {
    if (!value) {
      this.itemNumber = null;
    }
  }

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

  public LineItem setQuantity(double quantity) {
    this.quantity = quantity;
    setQuantityIsSet(true);
    return this;
  }

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

  /** Returns true if field quantity is set (has been asigned 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 double getUnfulfilledQuantity() {
    return this.unfulfilledQuantity;
  }

  public LineItem setUnfulfilledQuantity(double unfulfilledQuantity) {
    this.unfulfilledQuantity = unfulfilledQuantity;
    setUnfulfilledQuantityIsSet(true);
    return this;
  }

  public void unsetUnfulfilledQuantity() {
    __isset_bit_vector.clear(__UNFULFILLEDQUANTITY_ISSET_ID);
  }

  /** Returns true if field unfulfilledQuantity is set (has been asigned a value) and false otherwise */
  public boolean isSetUnfulfilledQuantity() {
    return __isset_bit_vector.get(__UNFULFILLEDQUANTITY_ISSET_ID);
  }

  public void setUnfulfilledQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__UNFULFILLEDQUANTITY_ISSET_ID, value);
  }

  public long getCreatedAt() {
    return this.createdAt;
  }

  public LineItem setCreatedAt(long createdAt) {
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
    return this;
  }

  public void unsetCreatedAt() {
    __isset_bit_vector.clear(__CREATEDAT_ISSET_ID);
  }

  /** Returns true if field createdAt is set (has been asigned a value) and false otherwise */
  public boolean isSetCreatedAt() {
    return __isset_bit_vector.get(__CREATEDAT_ISSET_ID);
  }

  public void setCreatedAtIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDAT_ISSET_ID, value);
  }

  public double getUnitPrice() {
    return this.unitPrice;
  }

  public LineItem setUnitPrice(double unitPrice) {
    this.unitPrice = unitPrice;
    setUnitPriceIsSet(true);
    return this;
  }

  public void unsetUnitPrice() {
    __isset_bit_vector.clear(__UNITPRICE_ISSET_ID);
  }

  /** Returns true if field unitPrice is set (has been asigned a value) and false otherwise */
  public boolean isSetUnitPrice() {
    return __isset_bit_vector.get(__UNITPRICE_ISSET_ID);
  }

  public void setUnitPriceIsSet(boolean value) {
    __isset_bit_vector.set(__UNITPRICE_ISSET_ID, value);
  }

  public boolean isFulfilled() {
    return this.fulfilled;
  }

  public LineItem setFulfilled(boolean fulfilled) {
    this.fulfilled = fulfilled;
    setFulfilledIsSet(true);
    return this;
  }

  public void unsetFulfilled() {
    __isset_bit_vector.clear(__FULFILLED_ISSET_ID);
  }

  /** Returns true if field fulfilled is set (has been asigned a value) and false otherwise */
  public boolean isSetFulfilled() {
    return __isset_bit_vector.get(__FULFILLED_ISSET_ID);
  }

  public void setFulfilledIsSet(boolean value) {
    __isset_bit_vector.set(__FULFILLED_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ORDER_ID:
      if (value == null) {
        unsetOrderId();
      } else {
        setOrderId((Long)value);
      }
      break;

    case ITEM_ID:
      if (value == null) {
        unsetItemId();
      } else {
        setItemId((Long)value);
      }
      break;

    case PRODUCT_GROUP:
      if (value == null) {
        unsetProductGroup();
      } else {
        setProductGroup((String)value);
      }
      break;

    case BRAND:
      if (value == null) {
        unsetBrand();
      } else {
        setBrand((String)value);
      }
      break;

    case MODEL_NUMBER:
      if (value == null) {
        unsetModelNumber();
      } else {
        setModelNumber((String)value);
      }
      break;

    case MODEL_NAME:
      if (value == null) {
        unsetModelName();
      } else {
        setModelName((String)value);
      }
      break;

    case COLOR:
      if (value == null) {
        unsetColor();
      } else {
        setColor((String)value);
      }
      break;

    case ITEM_NUMBER:
      if (value == null) {
        unsetItemNumber();
      } else {
        setItemNumber((String)value);
      }
      break;

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

    case UNFULFILLED_QUANTITY:
      if (value == null) {
        unsetUnfulfilledQuantity();
      } else {
        setUnfulfilledQuantity((Double)value);
      }
      break;

    case CREATED_AT:
      if (value == null) {
        unsetCreatedAt();
      } else {
        setCreatedAt((Long)value);
      }
      break;

    case UNIT_PRICE:
      if (value == null) {
        unsetUnitPrice();
      } else {
        setUnitPrice((Double)value);
      }
      break;

    case FULFILLED:
      if (value == null) {
        unsetFulfilled();
      } else {
        setFulfilled((Boolean)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ORDER_ID:
      return new Long(getOrderId());

    case ITEM_ID:
      return new Long(getItemId());

    case PRODUCT_GROUP:
      return getProductGroup();

    case BRAND:
      return getBrand();

    case MODEL_NUMBER:
      return getModelNumber();

    case MODEL_NAME:
      return getModelName();

    case COLOR:
      return getColor();

    case ITEM_NUMBER:
      return getItemNumber();

    case QUANTITY:
      return new Double(getQuantity());

    case UNFULFILLED_QUANTITY:
      return new Double(getUnfulfilledQuantity());

    case CREATED_AT:
      return new Long(getCreatedAt());

    case UNIT_PRICE:
      return new Double(getUnitPrice());

    case FULFILLED:
      return new Boolean(isFulfilled());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case ORDER_ID:
      return isSetOrderId();
    case ITEM_ID:
      return isSetItemId();
    case PRODUCT_GROUP:
      return isSetProductGroup();
    case BRAND:
      return isSetBrand();
    case MODEL_NUMBER:
      return isSetModelNumber();
    case MODEL_NAME:
      return isSetModelName();
    case COLOR:
      return isSetColor();
    case ITEM_NUMBER:
      return isSetItemNumber();
    case QUANTITY:
      return isSetQuantity();
    case UNFULFILLED_QUANTITY:
      return isSetUnfulfilledQuantity();
    case CREATED_AT:
      return isSetCreatedAt();
    case UNIT_PRICE:
      return isSetUnitPrice();
    case FULFILLED:
      return isSetFulfilled();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

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

    boolean this_present_orderId = true;
    boolean that_present_orderId = true;
    if (this_present_orderId || that_present_orderId) {
      if (!(this_present_orderId && that_present_orderId))
        return false;
      if (this.orderId != that.orderId)
        return false;
    }

    boolean this_present_itemId = true;
    boolean that_present_itemId = true;
    if (this_present_itemId || that_present_itemId) {
      if (!(this_present_itemId && that_present_itemId))
        return false;
      if (this.itemId != that.itemId)
        return false;
    }

    boolean this_present_productGroup = true && this.isSetProductGroup();
    boolean that_present_productGroup = true && that.isSetProductGroup();
    if (this_present_productGroup || that_present_productGroup) {
      if (!(this_present_productGroup && that_present_productGroup))
        return false;
      if (!this.productGroup.equals(that.productGroup))
        return false;
    }

    boolean this_present_brand = true && this.isSetBrand();
    boolean that_present_brand = true && that.isSetBrand();
    if (this_present_brand || that_present_brand) {
      if (!(this_present_brand && that_present_brand))
        return false;
      if (!this.brand.equals(that.brand))
        return false;
    }

    boolean this_present_modelNumber = true && this.isSetModelNumber();
    boolean that_present_modelNumber = true && that.isSetModelNumber();
    if (this_present_modelNumber || that_present_modelNumber) {
      if (!(this_present_modelNumber && that_present_modelNumber))
        return false;
      if (!this.modelNumber.equals(that.modelNumber))
        return false;
    }

    boolean this_present_modelName = true && this.isSetModelName();
    boolean that_present_modelName = true && that.isSetModelName();
    if (this_present_modelName || that_present_modelName) {
      if (!(this_present_modelName && that_present_modelName))
        return false;
      if (!this.modelName.equals(that.modelName))
        return false;
    }

    boolean this_present_color = true && this.isSetColor();
    boolean that_present_color = true && that.isSetColor();
    if (this_present_color || that_present_color) {
      if (!(this_present_color && that_present_color))
        return false;
      if (!this.color.equals(that.color))
        return false;
    }

    boolean this_present_itemNumber = true && this.isSetItemNumber();
    boolean that_present_itemNumber = true && that.isSetItemNumber();
    if (this_present_itemNumber || that_present_itemNumber) {
      if (!(this_present_itemNumber && that_present_itemNumber))
        return false;
      if (!this.itemNumber.equals(that.itemNumber))
        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;
    }

    boolean this_present_unfulfilledQuantity = true;
    boolean that_present_unfulfilledQuantity = true;
    if (this_present_unfulfilledQuantity || that_present_unfulfilledQuantity) {
      if (!(this_present_unfulfilledQuantity && that_present_unfulfilledQuantity))
        return false;
      if (this.unfulfilledQuantity != that.unfulfilledQuantity)
        return false;
    }

    boolean this_present_createdAt = true;
    boolean that_present_createdAt = true;
    if (this_present_createdAt || that_present_createdAt) {
      if (!(this_present_createdAt && that_present_createdAt))
        return false;
      if (this.createdAt != that.createdAt)
        return false;
    }

    boolean this_present_unitPrice = true;
    boolean that_present_unitPrice = true;
    if (this_present_unitPrice || that_present_unitPrice) {
      if (!(this_present_unitPrice && that_present_unitPrice))
        return false;
      if (this.unitPrice != that.unitPrice)
        return false;
    }

    boolean this_present_fulfilled = true;
    boolean that_present_fulfilled = true;
    if (this_present_fulfilled || that_present_fulfilled) {
      if (!(this_present_fulfilled && that_present_fulfilled))
        return false;
      if (this.fulfilled != that.fulfilled)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(isSetOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(orderId, typedOther.orderId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetProductGroup()).compareTo(isSetProductGroup());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(productGroup, typedOther.productGroup);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetBrand()).compareTo(isSetBrand());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(brand, typedOther.brand);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetModelNumber()).compareTo(isSetModelNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(modelNumber, typedOther.modelNumber);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetModelName()).compareTo(isSetModelName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(modelName, typedOther.modelName);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetColor()).compareTo(isSetColor());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(color, typedOther.color);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetItemNumber()).compareTo(isSetItemNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(itemNumber, typedOther.itemNumber);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(isSetQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(quantity, typedOther.quantity);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUnfulfilledQuantity()).compareTo(isSetUnfulfilledQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(unfulfilledQuantity, typedOther.unfulfilledQuantity);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCreatedAt()).compareTo(isSetCreatedAt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(createdAt, typedOther.createdAt);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUnitPrice()).compareTo(isSetUnitPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(unitPrice, typedOther.unitPrice);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetFulfilled()).compareTo(isSetFulfilled());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(fulfilled, typedOther.fulfilled);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case ORDER_ID:
            if (field.type == TType.I64) {
              this.orderId = iprot.readI64();
              setOrderIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_ID:
            if (field.type == TType.I64) {
              this.itemId = iprot.readI64();
              setItemIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PRODUCT_GROUP:
            if (field.type == TType.STRING) {
              this.productGroup = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case BRAND:
            if (field.type == TType.STRING) {
              this.brand = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MODEL_NUMBER:
            if (field.type == TType.STRING) {
              this.modelNumber = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MODEL_NAME:
            if (field.type == TType.STRING) {
              this.modelName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case COLOR:
            if (field.type == TType.STRING) {
              this.color = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_NUMBER:
            if (field.type == TType.STRING) {
              this.itemNumber = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case QUANTITY:
            if (field.type == TType.DOUBLE) {
              this.quantity = iprot.readDouble();
              setQuantityIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case UNFULFILLED_QUANTITY:
            if (field.type == TType.DOUBLE) {
              this.unfulfilledQuantity = iprot.readDouble();
              setUnfulfilledQuantityIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CREATED_AT:
            if (field.type == TType.I64) {
              this.createdAt = iprot.readI64();
              setCreatedAtIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case UNIT_PRICE:
            if (field.type == TType.DOUBLE) {
              this.unitPrice = iprot.readDouble();
              setUnitPriceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case FULFILLED:
            if (field.type == TType.BOOL) {
              this.fulfilled = iprot.readBool();
              setFulfilledIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
    oprot.writeI64(this.orderId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.itemId);
    oprot.writeFieldEnd();
    if (this.productGroup != null) {
      oprot.writeFieldBegin(PRODUCT_GROUP_FIELD_DESC);
      oprot.writeString(this.productGroup);
      oprot.writeFieldEnd();
    }
    if (this.brand != null) {
      oprot.writeFieldBegin(BRAND_FIELD_DESC);
      oprot.writeString(this.brand);
      oprot.writeFieldEnd();
    }
    if (this.modelNumber != null) {
      oprot.writeFieldBegin(MODEL_NUMBER_FIELD_DESC);
      oprot.writeString(this.modelNumber);
      oprot.writeFieldEnd();
    }
    if (this.modelName != null) {
      oprot.writeFieldBegin(MODEL_NAME_FIELD_DESC);
      oprot.writeString(this.modelName);
      oprot.writeFieldEnd();
    }
    if (this.color != null) {
      oprot.writeFieldBegin(COLOR_FIELD_DESC);
      oprot.writeString(this.color);
      oprot.writeFieldEnd();
    }
    if (this.itemNumber != null) {
      oprot.writeFieldBegin(ITEM_NUMBER_FIELD_DESC);
      oprot.writeString(this.itemNumber);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
    oprot.writeDouble(this.quantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UNFULFILLED_QUANTITY_FIELD_DESC);
    oprot.writeDouble(this.unfulfilledQuantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATED_AT_FIELD_DESC);
    oprot.writeI64(this.createdAt);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UNIT_PRICE_FIELD_DESC);
    oprot.writeDouble(this.unitPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(FULFILLED_FIELD_DESC);
    oprot.writeBool(this.fulfilled);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("orderId:");
    sb.append(this.orderId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemId:");
    sb.append(this.itemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("productGroup:");
    if (this.productGroup == null) {
      sb.append("null");
    } else {
      sb.append(this.productGroup);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("brand:");
    if (this.brand == null) {
      sb.append("null");
    } else {
      sb.append(this.brand);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("modelNumber:");
    if (this.modelNumber == null) {
      sb.append("null");
    } else {
      sb.append(this.modelNumber);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("modelName:");
    if (this.modelName == null) {
      sb.append("null");
    } else {
      sb.append(this.modelName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("color:");
    if (this.color == null) {
      sb.append("null");
    } else {
      sb.append(this.color);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemNumber:");
    if (this.itemNumber == null) {
      sb.append("null");
    } else {
      sb.append(this.itemNumber);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("quantity:");
    sb.append(this.quantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("unfulfilledQuantity:");
    sb.append(this.unfulfilledQuantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdAt:");
    sb.append(this.createdAt);
    first = false;
    if (!first) sb.append(", ");
    sb.append("unitPrice:");
    sb.append(this.unitPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fulfilled:");
    sb.append(this.fulfilled);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}