Subversion Repositories SmartDukaan

Rev

Rev 1982 | Rev 2383 | Go to most recent revision | Blame | Compare with Previous | 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.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.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 ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField ITEM_ID_FIELD_DESC = new TField("item_id", 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("model_number", TType.STRING, (short)5);
  private static final TField COLOR_FIELD_DESC = new TField("color", TType.STRING, (short)6);
  private static final TField MODEL_NAME_FIELD_DESC = new TField("model_name", TType.STRING, (short)7);
  private static final TField EXTRA_INFO_FIELD_DESC = new TField("extra_info", TType.STRING, (short)8);
  private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.DOUBLE, (short)9);
  private static final TField UNIT_PRICE_FIELD_DESC = new TField("unit_price", TType.DOUBLE, (short)10);
  private static final TField UNIT_WEIGHT_FIELD_DESC = new TField("unit_weight", TType.DOUBLE, (short)11);
  private static final TField TOTAL_PRICE_FIELD_DESC = new TField("total_price", TType.DOUBLE, (short)12);
  private static final TField TRANSFER_PRICE_FIELD_DESC = new TField("transfer_price", TType.DOUBLE, (short)13);
  private static final TField TOTAL_WEIGHT_FIELD_DESC = new TField("total_weight", TType.DOUBLE, (short)14);

  private long id;
  private long item_id;
  private String productGroup;
  private String brand;
  private String model_number;
  private String color;
  private String model_name;
  private String extra_info;
  private double quantity;
  private double unit_price;
  private double unit_weight;
  private double total_price;
  private double transfer_price;
  private double total_weight;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ID((short)1, "id"),
    ITEM_ID((short)2, "item_id"),
    PRODUCT_GROUP((short)3, "productGroup"),
    BRAND((short)4, "brand"),
    MODEL_NUMBER((short)5, "model_number"),
    COLOR((short)6, "color"),
    MODEL_NAME((short)7, "model_name"),
    EXTRA_INFO((short)8, "extra_info"),
    QUANTITY((short)9, "quantity"),
    UNIT_PRICE((short)10, "unit_price"),
    UNIT_WEIGHT((short)11, "unit_weight"),
    TOTAL_PRICE((short)12, "total_price"),
    TRANSFER_PRICE((short)13, "transfer_price"),
    TOTAL_WEIGHT((short)14, "total_weight");

    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 __ID_ISSET_ID = 0;
  private static final int __ITEM_ID_ISSET_ID = 1;
  private static final int __QUANTITY_ISSET_ID = 2;
  private static final int __UNIT_PRICE_ISSET_ID = 3;
  private static final int __UNIT_WEIGHT_ISSET_ID = 4;
  private static final int __TOTAL_PRICE_ISSET_ID = 5;
  private static final int __TRANSFER_PRICE_ISSET_ID = 6;
  private static final int __TOTAL_WEIGHT_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ITEM_ID, new FieldMetaData("item_id", 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("model_number", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.COLOR, new FieldMetaData("color", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MODEL_NAME, new FieldMetaData("model_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.EXTRA_INFO, new FieldMetaData("extra_info", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.UNIT_PRICE, new FieldMetaData("unit_price", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.UNIT_WEIGHT, new FieldMetaData("unit_weight", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.TOTAL_PRICE, new FieldMetaData("total_price", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.TRANSFER_PRICE, new FieldMetaData("transfer_price", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.TOTAL_WEIGHT, new FieldMetaData("total_weight", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
  }});

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

  public LineItem() {
  }

  public LineItem(
    long id,
    long item_id,
    String productGroup,
    String brand,
    String model_number,
    String color,
    String model_name,
    String extra_info,
    double quantity,
    double unit_price,
    double unit_weight,
    double total_price,
    double transfer_price,
    double total_weight)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.item_id = item_id;
    setItem_idIsSet(true);
    this.productGroup = productGroup;
    this.brand = brand;
    this.model_number = model_number;
    this.color = color;
    this.model_name = model_name;
    this.extra_info = extra_info;
    this.quantity = quantity;
    setQuantityIsSet(true);
    this.unit_price = unit_price;
    setUnit_priceIsSet(true);
    this.unit_weight = unit_weight;
    setUnit_weightIsSet(true);
    this.total_price = total_price;
    setTotal_priceIsSet(true);
    this.transfer_price = transfer_price;
    setTransfer_priceIsSet(true);
    this.total_weight = total_weight;
    setTotal_weightIsSet(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.id = other.id;
    this.item_id = other.item_id;
    if (other.isSetProductGroup()) {
      this.productGroup = other.productGroup;
    }
    if (other.isSetBrand()) {
      this.brand = other.brand;
    }
    if (other.isSetModel_number()) {
      this.model_number = other.model_number;
    }
    if (other.isSetColor()) {
      this.color = other.color;
    }
    if (other.isSetModel_name()) {
      this.model_name = other.model_name;
    }
    if (other.isSetExtra_info()) {
      this.extra_info = other.extra_info;
    }
    this.quantity = other.quantity;
    this.unit_price = other.unit_price;
    this.unit_weight = other.unit_weight;
    this.total_price = other.total_price;
    this.transfer_price = other.transfer_price;
    this.total_weight = other.total_weight;
  }

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

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

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

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

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

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

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

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

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

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

  /** Returns true if field item_id is set (has been asigned 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);
  }

  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 getModel_number() {
    return this.model_number;
  }

  public LineItem setModel_number(String model_number) {
    this.model_number = model_number;
    return this;
  }

  public void unsetModel_number() {
    this.model_number = null;
  }

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

  public void setModel_numberIsSet(boolean value) {
    if (!value) {
      this.model_number = 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 getModel_name() {
    return this.model_name;
  }

  public LineItem setModel_name(String model_name) {
    this.model_name = model_name;
    return this;
  }

  public void unsetModel_name() {
    this.model_name = null;
  }

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

  public void setModel_nameIsSet(boolean value) {
    if (!value) {
      this.model_name = null;
    }
  }

  public String getExtra_info() {
    return this.extra_info;
  }

  public LineItem setExtra_info(String extra_info) {
    this.extra_info = extra_info;
    return this;
  }

  public void unsetExtra_info() {
    this.extra_info = null;
  }

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

  public void setExtra_infoIsSet(boolean value) {
    if (!value) {
      this.extra_info = 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 getUnit_price() {
    return this.unit_price;
  }

  public LineItem setUnit_price(double unit_price) {
    this.unit_price = unit_price;
    setUnit_priceIsSet(true);
    return this;
  }

  public void unsetUnit_price() {
    __isset_bit_vector.clear(__UNIT_PRICE_ISSET_ID);
  }

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

  public void setUnit_priceIsSet(boolean value) {
    __isset_bit_vector.set(__UNIT_PRICE_ISSET_ID, value);
  }

  public double getUnit_weight() {
    return this.unit_weight;
  }

  public LineItem setUnit_weight(double unit_weight) {
    this.unit_weight = unit_weight;
    setUnit_weightIsSet(true);
    return this;
  }

  public void unsetUnit_weight() {
    __isset_bit_vector.clear(__UNIT_WEIGHT_ISSET_ID);
  }

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

  public void setUnit_weightIsSet(boolean value) {
    __isset_bit_vector.set(__UNIT_WEIGHT_ISSET_ID, value);
  }

  public double getTotal_price() {
    return this.total_price;
  }

  public LineItem setTotal_price(double total_price) {
    this.total_price = total_price;
    setTotal_priceIsSet(true);
    return this;
  }

  public void unsetTotal_price() {
    __isset_bit_vector.clear(__TOTAL_PRICE_ISSET_ID);
  }

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

  public void setTotal_priceIsSet(boolean value) {
    __isset_bit_vector.set(__TOTAL_PRICE_ISSET_ID, value);
  }

  public double getTransfer_price() {
    return this.transfer_price;
  }

  public LineItem setTransfer_price(double transfer_price) {
    this.transfer_price = transfer_price;
    setTransfer_priceIsSet(true);
    return this;
  }

  public void unsetTransfer_price() {
    __isset_bit_vector.clear(__TRANSFER_PRICE_ISSET_ID);
  }

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

  public void setTransfer_priceIsSet(boolean value) {
    __isset_bit_vector.set(__TRANSFER_PRICE_ISSET_ID, value);
  }

  public double getTotal_weight() {
    return this.total_weight;
  }

  public LineItem setTotal_weight(double total_weight) {
    this.total_weight = total_weight;
    setTotal_weightIsSet(true);
    return this;
  }

  public void unsetTotal_weight() {
    __isset_bit_vector.clear(__TOTAL_WEIGHT_ISSET_ID);
  }

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

  public void setTotal_weightIsSet(boolean value) {
    __isset_bit_vector.set(__TOTAL_WEIGHT_ISSET_ID, value);
  }

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

    case ITEM_ID:
      if (value == null) {
        unsetItem_id();
      } else {
        setItem_id((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) {
        unsetModel_number();
      } else {
        setModel_number((String)value);
      }
      break;

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

    case MODEL_NAME:
      if (value == null) {
        unsetModel_name();
      } else {
        setModel_name((String)value);
      }
      break;

    case EXTRA_INFO:
      if (value == null) {
        unsetExtra_info();
      } else {
        setExtra_info((String)value);
      }
      break;

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

    case UNIT_PRICE:
      if (value == null) {
        unsetUnit_price();
      } else {
        setUnit_price((Double)value);
      }
      break;

    case UNIT_WEIGHT:
      if (value == null) {
        unsetUnit_weight();
      } else {
        setUnit_weight((Double)value);
      }
      break;

    case TOTAL_PRICE:
      if (value == null) {
        unsetTotal_price();
      } else {
        setTotal_price((Double)value);
      }
      break;

    case TRANSFER_PRICE:
      if (value == null) {
        unsetTransfer_price();
      } else {
        setTransfer_price((Double)value);
      }
      break;

    case TOTAL_WEIGHT:
      if (value == null) {
        unsetTotal_weight();
      } else {
        setTotal_weight((Double)value);
      }
      break;

    }
  }

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

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

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

    case PRODUCT_GROUP:
      return getProductGroup();

    case BRAND:
      return getBrand();

    case MODEL_NUMBER:
      return getModel_number();

    case COLOR:
      return getColor();

    case MODEL_NAME:
      return getModel_name();

    case EXTRA_INFO:
      return getExtra_info();

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

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

    case UNIT_WEIGHT:
      return new Double(getUnit_weight());

    case TOTAL_PRICE:
      return new Double(getTotal_price());

    case TRANSFER_PRICE:
      return new Double(getTransfer_price());

    case TOTAL_WEIGHT:
      return new Double(getTotal_weight());

    }
    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 ID:
      return isSetId();
    case ITEM_ID:
      return isSetItem_id();
    case PRODUCT_GROUP:
      return isSetProductGroup();
    case BRAND:
      return isSetBrand();
    case MODEL_NUMBER:
      return isSetModel_number();
    case COLOR:
      return isSetColor();
    case MODEL_NAME:
      return isSetModel_name();
    case EXTRA_INFO:
      return isSetExtra_info();
    case QUANTITY:
      return isSetQuantity();
    case UNIT_PRICE:
      return isSetUnit_price();
    case UNIT_WEIGHT:
      return isSetUnit_weight();
    case TOTAL_PRICE:
      return isSetTotal_price();
    case TRANSFER_PRICE:
      return isSetTransfer_price();
    case TOTAL_WEIGHT:
      return isSetTotal_weight();
    }
    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_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_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_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_model_number = true && this.isSetModel_number();
    boolean that_present_model_number = true && that.isSetModel_number();
    if (this_present_model_number || that_present_model_number) {
      if (!(this_present_model_number && that_present_model_number))
        return false;
      if (!this.model_number.equals(that.model_number))
        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_model_name = true && this.isSetModel_name();
    boolean that_present_model_name = true && that.isSetModel_name();
    if (this_present_model_name || that_present_model_name) {
      if (!(this_present_model_name && that_present_model_name))
        return false;
      if (!this.model_name.equals(that.model_name))
        return false;
    }

    boolean this_present_extra_info = true && this.isSetExtra_info();
    boolean that_present_extra_info = true && that.isSetExtra_info();
    if (this_present_extra_info || that_present_extra_info) {
      if (!(this_present_extra_info && that_present_extra_info))
        return false;
      if (!this.extra_info.equals(that.extra_info))
        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_unit_price = true;
    boolean that_present_unit_price = true;
    if (this_present_unit_price || that_present_unit_price) {
      if (!(this_present_unit_price && that_present_unit_price))
        return false;
      if (this.unit_price != that.unit_price)
        return false;
    }

    boolean this_present_unit_weight = true;
    boolean that_present_unit_weight = true;
    if (this_present_unit_weight || that_present_unit_weight) {
      if (!(this_present_unit_weight && that_present_unit_weight))
        return false;
      if (this.unit_weight != that.unit_weight)
        return false;
    }

    boolean this_present_total_price = true;
    boolean that_present_total_price = true;
    if (this_present_total_price || that_present_total_price) {
      if (!(this_present_total_price && that_present_total_price))
        return false;
      if (this.total_price != that.total_price)
        return false;
    }

    boolean this_present_transfer_price = true;
    boolean that_present_transfer_price = true;
    if (this_present_transfer_price || that_present_transfer_price) {
      if (!(this_present_transfer_price && that_present_transfer_price))
        return false;
      if (this.transfer_price != that.transfer_price)
        return false;
    }

    boolean this_present_total_weight = true;
    boolean that_present_total_weight = true;
    if (this_present_total_weight || that_present_total_weight) {
      if (!(this_present_total_weight && that_present_total_weight))
        return false;
      if (this.total_weight != that.total_weight)
        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(isSetId()).compareTo(isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(isSetItem_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(item_id, typedOther.item_id);
    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(isSetModel_number()).compareTo(isSetModel_number());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(model_number, typedOther.model_number);
    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(isSetModel_name()).compareTo(isSetModel_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(model_name, typedOther.model_name);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetExtra_info()).compareTo(isSetExtra_info());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(extra_info, typedOther.extra_info);
    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(isSetUnit_price()).compareTo(isSetUnit_price());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(unit_price, typedOther.unit_price);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUnit_weight()).compareTo(isSetUnit_weight());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(unit_weight, typedOther.unit_weight);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTotal_price()).compareTo(isSetTotal_price());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(total_price, typedOther.total_price);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTransfer_price()).compareTo(isSetTransfer_price());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(transfer_price, typedOther.transfer_price);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTotal_weight()).compareTo(isSetTotal_weight());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(total_weight, typedOther.total_weight);
    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 ID:
            if (field.type == TType.I64) {
              this.id = iprot.readI64();
              setIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_ID:
            if (field.type == TType.I64) {
              this.item_id = iprot.readI64();
              setItem_idIsSet(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.model_number = 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 MODEL_NAME:
            if (field.type == TType.STRING) {
              this.model_name = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case EXTRA_INFO:
            if (field.type == TType.STRING) {
              this.extra_info = 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 UNIT_PRICE:
            if (field.type == TType.DOUBLE) {
              this.unit_price = iprot.readDouble();
              setUnit_priceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case UNIT_WEIGHT:
            if (field.type == TType.DOUBLE) {
              this.unit_weight = iprot.readDouble();
              setUnit_weightIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TOTAL_PRICE:
            if (field.type == TType.DOUBLE) {
              this.total_price = iprot.readDouble();
              setTotal_priceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TRANSFER_PRICE:
            if (field.type == TType.DOUBLE) {
              this.transfer_price = iprot.readDouble();
              setTransfer_priceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TOTAL_WEIGHT:
            if (field.type == TType.DOUBLE) {
              this.total_weight = iprot.readDouble();
              setTotal_weightIsSet(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(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.item_id);
    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.model_number != null) {
      oprot.writeFieldBegin(MODEL_NUMBER_FIELD_DESC);
      oprot.writeString(this.model_number);
      oprot.writeFieldEnd();
    }
    if (this.color != null) {
      oprot.writeFieldBegin(COLOR_FIELD_DESC);
      oprot.writeString(this.color);
      oprot.writeFieldEnd();
    }
    if (this.model_name != null) {
      oprot.writeFieldBegin(MODEL_NAME_FIELD_DESC);
      oprot.writeString(this.model_name);
      oprot.writeFieldEnd();
    }
    if (this.extra_info != null) {
      oprot.writeFieldBegin(EXTRA_INFO_FIELD_DESC);
      oprot.writeString(this.extra_info);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
    oprot.writeDouble(this.quantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UNIT_PRICE_FIELD_DESC);
    oprot.writeDouble(this.unit_price);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UNIT_WEIGHT_FIELD_DESC);
    oprot.writeDouble(this.unit_weight);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_PRICE_FIELD_DESC);
    oprot.writeDouble(this.total_price);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TRANSFER_PRICE_FIELD_DESC);
    oprot.writeDouble(this.transfer_price);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_WEIGHT_FIELD_DESC);
    oprot.writeDouble(this.total_weight);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("item_id:");
    sb.append(this.item_id);
    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("model_number:");
    if (this.model_number == null) {
      sb.append("null");
    } else {
      sb.append(this.model_number);
    }
    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("model_name:");
    if (this.model_name == null) {
      sb.append("null");
    } else {
      sb.append(this.model_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("extra_info:");
    if (this.extra_info == null) {
      sb.append("null");
    } else {
      sb.append(this.extra_info);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("quantity:");
    sb.append(this.quantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("unit_price:");
    sb.append(this.unit_price);
    first = false;
    if (!first) sb.append(", ");
    sb.append("unit_weight:");
    sb.append(this.unit_weight);
    first = false;
    if (!first) sb.append(", ");
    sb.append("total_price:");
    sb.append(this.total_price);
    first = false;
    if (!first) sb.append(", ");
    sb.append("transfer_price:");
    sb.append(this.transfer_price);
    first = false;
    if (!first) sb.append(", ");
    sb.append("total_weight:");
    sb.append(this.total_weight);
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}