Subversion Repositories SmartDukaan

Rev

Rev 103 | Rev 483 | 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.catalog;

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

  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField CATALOG_ITEM_ID_FIELD_DESC = new TField("catalogItemId", TType.I64, (short)2);
  private static final TField ITEM_INVENTORY_FIELD_DESC = new TField("itemInventory", TType.STRUCT, (short)3);
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)4);
  private static final TField START_DATE_FIELD_DESC = new TField("startDate", TType.I64, (short)5);
  private static final TField ITEM_STATUS_FIELD_DESC = new TField("itemStatus", TType.I32, (short)6);
  private static final TField OTHER_INFO_FIELD_DESC = new TField("otherInfo", TType.MAP, (short)7);
  private static final TField PRICE_FIELD_DESC = new TField("price", TType.MAP, (short)8);
  private static final TField WEIGHT_FIELD_DESC = new TField("weight", TType.DOUBLE, (short)9);
  private static final TField FEATURE_ID_FIELD_DESC = new TField("featureId", TType.I64, (short)10);
  private static final TField FEATURE_DESCRIPTION_FIELD_DESC = new TField("featureDescription", TType.STRING, (short)11);
  private static final TField VENDOR_ITEM_ID_FIELD_DESC = new TField("vendorItemId", TType.I64, (short)12);

  private long id;
  private long catalogItemId;
  private ItemInventory itemInventory;
  private long addedOn;
  private long startDate;
  private status itemStatus;
  private Map<String,String> otherInfo;
  private Map<Long,Double> price;
  private double weight;
  private long featureId;
  private String featureDescription;
  private long vendorItemId;

  /** 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"),
    CATALOG_ITEM_ID((short)2, "catalogItemId"),
    ITEM_INVENTORY((short)3, "itemInventory"),
    ADDED_ON((short)4, "addedOn"),
    START_DATE((short)5, "startDate"),
    /**
     * 
     * @see status
     */
    ITEM_STATUS((short)6, "itemStatus"),
    OTHER_INFO((short)7, "otherInfo"),
    PRICE((short)8, "price"),
    WEIGHT((short)9, "weight"),
    FEATURE_ID((short)10, "featureId"),
    FEATURE_DESCRIPTION((short)11, "featureDescription"),
    VENDOR_ITEM_ID((short)12, "vendorItemId");

    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 __CATALOGITEMID_ISSET_ID = 1;
  private static final int __ADDEDON_ISSET_ID = 2;
  private static final int __STARTDATE_ISSET_ID = 3;
  private static final int __WEIGHT_ISSET_ID = 4;
  private static final int __FEATUREID_ISSET_ID = 5;
  private static final int __VENDORITEMID_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.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.CATALOG_ITEM_ID, new FieldMetaData("catalogItemId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ITEM_INVENTORY, new FieldMetaData("itemInventory", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, ItemInventory.class)));
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.START_DATE, new FieldMetaData("startDate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ITEM_STATUS, new FieldMetaData("itemStatus", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, status.class)));
    put(_Fields.OTHER_INFO, new FieldMetaData("otherInfo", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.STRING), 
            new FieldValueMetaData(TType.STRING))));
    put(_Fields.PRICE, new FieldMetaData("price", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.I64), 
            new FieldValueMetaData(TType.DOUBLE))));
    put(_Fields.WEIGHT, new FieldMetaData("weight", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.FEATURE_ID, new FieldMetaData("featureId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.FEATURE_DESCRIPTION, new FieldMetaData("featureDescription", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.VENDOR_ITEM_ID, new FieldMetaData("vendorItemId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
  }});

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

  public Item() {
  }

  public Item(
    long id,
    long catalogItemId,
    ItemInventory itemInventory,
    long addedOn,
    long startDate,
    status itemStatus,
    Map<String,String> otherInfo,
    Map<Long,Double> price,
    double weight,
    long featureId,
    String featureDescription,
    long vendorItemId)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.catalogItemId = catalogItemId;
    setCatalogItemIdIsSet(true);
    this.itemInventory = itemInventory;
    this.addedOn = addedOn;
    setAddedOnIsSet(true);
    this.startDate = startDate;
    setStartDateIsSet(true);
    this.itemStatus = itemStatus;
    this.otherInfo = otherInfo;
    this.price = price;
    this.weight = weight;
    setWeightIsSet(true);
    this.featureId = featureId;
    setFeatureIdIsSet(true);
    this.featureDescription = featureDescription;
    this.vendorItemId = vendorItemId;
    setVendorItemIdIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Item(Item other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.catalogItemId = other.catalogItemId;
    if (other.isSetItemInventory()) {
      this.itemInventory = new ItemInventory(other.itemInventory);
    }
    this.addedOn = other.addedOn;
    this.startDate = other.startDate;
    if (other.isSetItemStatus()) {
      this.itemStatus = other.itemStatus;
    }
    if (other.isSetOtherInfo()) {
      Map<String,String> __this__otherInfo = new HashMap<String,String>();
      for (Map.Entry<String, String> other_element : other.otherInfo.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__otherInfo_copy_key = other_element_key;

        String __this__otherInfo_copy_value = other_element_value;

        __this__otherInfo.put(__this__otherInfo_copy_key, __this__otherInfo_copy_value);
      }
      this.otherInfo = __this__otherInfo;
    }
    if (other.isSetPrice()) {
      Map<Long,Double> __this__price = new HashMap<Long,Double>();
      for (Map.Entry<Long, Double> other_element : other.price.entrySet()) {

        Long other_element_key = other_element.getKey();
        Double other_element_value = other_element.getValue();

        Long __this__price_copy_key = other_element_key;

        Double __this__price_copy_value = other_element_value;

        __this__price.put(__this__price_copy_key, __this__price_copy_value);
      }
      this.price = __this__price;
    }
    this.weight = other.weight;
    this.featureId = other.featureId;
    if (other.isSetFeatureDescription()) {
      this.featureDescription = other.featureDescription;
    }
    this.vendorItemId = other.vendorItemId;
  }

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

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

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

  public Item 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 getCatalogItemId() {
    return this.catalogItemId;
  }

  public Item setCatalogItemId(long catalogItemId) {
    this.catalogItemId = catalogItemId;
    setCatalogItemIdIsSet(true);
    return this;
  }

  public void unsetCatalogItemId() {
    __isset_bit_vector.clear(__CATALOGITEMID_ISSET_ID);
  }

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

  public void setCatalogItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__CATALOGITEMID_ISSET_ID, value);
  }

  public ItemInventory getItemInventory() {
    return this.itemInventory;
  }

  public Item setItemInventory(ItemInventory itemInventory) {
    this.itemInventory = itemInventory;
    return this;
  }

  public void unsetItemInventory() {
    this.itemInventory = null;
  }

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

  public void setItemInventoryIsSet(boolean value) {
    if (!value) {
      this.itemInventory = null;
    }
  }

  public long getAddedOn() {
    return this.addedOn;
  }

  public Item setAddedOn(long addedOn) {
    this.addedOn = addedOn;
    setAddedOnIsSet(true);
    return this;
  }

  public void unsetAddedOn() {
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
  }

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

  public void setAddedOnIsSet(boolean value) {
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
  }

  public long getStartDate() {
    return this.startDate;
  }

  public Item setStartDate(long startDate) {
    this.startDate = startDate;
    setStartDateIsSet(true);
    return this;
  }

  public void unsetStartDate() {
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
  }

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

  public void setStartDateIsSet(boolean value) {
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
  }

  /**
   * 
   * @see status
   */
  public status getItemStatus() {
    return this.itemStatus;
  }

  /**
   * 
   * @see status
   */
  public Item setItemStatus(status itemStatus) {
    this.itemStatus = itemStatus;
    return this;
  }

  public void unsetItemStatus() {
    this.itemStatus = null;
  }

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

  public void setItemStatusIsSet(boolean value) {
    if (!value) {
      this.itemStatus = null;
    }
  }

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

  public void putToOtherInfo(String key, String val) {
    if (this.otherInfo == null) {
      this.otherInfo = new HashMap<String,String>();
    }
    this.otherInfo.put(key, val);
  }

  public Map<String,String> getOtherInfo() {
    return this.otherInfo;
  }

  public Item setOtherInfo(Map<String,String> otherInfo) {
    this.otherInfo = otherInfo;
    return this;
  }

  public void unsetOtherInfo() {
    this.otherInfo = null;
  }

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

  public void setOtherInfoIsSet(boolean value) {
    if (!value) {
      this.otherInfo = null;
    }
  }

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

  public void putToPrice(long key, double val) {
    if (this.price == null) {
      this.price = new HashMap<Long,Double>();
    }
    this.price.put(key, val);
  }

  public Map<Long,Double> getPrice() {
    return this.price;
  }

  public Item setPrice(Map<Long,Double> price) {
    this.price = price;
    return this;
  }

  public void unsetPrice() {
    this.price = null;
  }

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

  public void setPriceIsSet(boolean value) {
    if (!value) {
      this.price = null;
    }
  }

  public double getWeight() {
    return this.weight;
  }

  public Item setWeight(double weight) {
    this.weight = weight;
    setWeightIsSet(true);
    return this;
  }

  public void unsetWeight() {
    __isset_bit_vector.clear(__WEIGHT_ISSET_ID);
  }

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

  public void setWeightIsSet(boolean value) {
    __isset_bit_vector.set(__WEIGHT_ISSET_ID, value);
  }

  public long getFeatureId() {
    return this.featureId;
  }

  public Item setFeatureId(long featureId) {
    this.featureId = featureId;
    setFeatureIdIsSet(true);
    return this;
  }

  public void unsetFeatureId() {
    __isset_bit_vector.clear(__FEATUREID_ISSET_ID);
  }

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

  public void setFeatureIdIsSet(boolean value) {
    __isset_bit_vector.set(__FEATUREID_ISSET_ID, value);
  }

  public String getFeatureDescription() {
    return this.featureDescription;
  }

  public Item setFeatureDescription(String featureDescription) {
    this.featureDescription = featureDescription;
    return this;
  }

  public void unsetFeatureDescription() {
    this.featureDescription = null;
  }

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

  public void setFeatureDescriptionIsSet(boolean value) {
    if (!value) {
      this.featureDescription = null;
    }
  }

  public long getVendorItemId() {
    return this.vendorItemId;
  }

  public Item setVendorItemId(long vendorItemId) {
    this.vendorItemId = vendorItemId;
    setVendorItemIdIsSet(true);
    return this;
  }

  public void unsetVendorItemId() {
    __isset_bit_vector.clear(__VENDORITEMID_ISSET_ID);
  }

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

  public void setVendorItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__VENDORITEMID_ISSET_ID, value);
  }

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

    case CATALOG_ITEM_ID:
      if (value == null) {
        unsetCatalogItemId();
      } else {
        setCatalogItemId((Long)value);
      }
      break;

    case ITEM_INVENTORY:
      if (value == null) {
        unsetItemInventory();
      } else {
        setItemInventory((ItemInventory)value);
      }
      break;

    case ADDED_ON:
      if (value == null) {
        unsetAddedOn();
      } else {
        setAddedOn((Long)value);
      }
      break;

    case START_DATE:
      if (value == null) {
        unsetStartDate();
      } else {
        setStartDate((Long)value);
      }
      break;

    case ITEM_STATUS:
      if (value == null) {
        unsetItemStatus();
      } else {
        setItemStatus((status)value);
      }
      break;

    case OTHER_INFO:
      if (value == null) {
        unsetOtherInfo();
      } else {
        setOtherInfo((Map<String,String>)value);
      }
      break;

    case PRICE:
      if (value == null) {
        unsetPrice();
      } else {
        setPrice((Map<Long,Double>)value);
      }
      break;

    case WEIGHT:
      if (value == null) {
        unsetWeight();
      } else {
        setWeight((Double)value);
      }
      break;

    case FEATURE_ID:
      if (value == null) {
        unsetFeatureId();
      } else {
        setFeatureId((Long)value);
      }
      break;

    case FEATURE_DESCRIPTION:
      if (value == null) {
        unsetFeatureDescription();
      } else {
        setFeatureDescription((String)value);
      }
      break;

    case VENDOR_ITEM_ID:
      if (value == null) {
        unsetVendorItemId();
      } else {
        setVendorItemId((Long)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 CATALOG_ITEM_ID:
      return new Long(getCatalogItemId());

    case ITEM_INVENTORY:
      return getItemInventory();

    case ADDED_ON:
      return new Long(getAddedOn());

    case START_DATE:
      return new Long(getStartDate());

    case ITEM_STATUS:
      return getItemStatus();

    case OTHER_INFO:
      return getOtherInfo();

    case PRICE:
      return getPrice();

    case WEIGHT:
      return new Double(getWeight());

    case FEATURE_ID:
      return new Long(getFeatureId());

    case FEATURE_DESCRIPTION:
      return getFeatureDescription();

    case VENDOR_ITEM_ID:
      return new Long(getVendorItemId());

    }
    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 CATALOG_ITEM_ID:
      return isSetCatalogItemId();
    case ITEM_INVENTORY:
      return isSetItemInventory();
    case ADDED_ON:
      return isSetAddedOn();
    case START_DATE:
      return isSetStartDate();
    case ITEM_STATUS:
      return isSetItemStatus();
    case OTHER_INFO:
      return isSetOtherInfo();
    case PRICE:
      return isSetPrice();
    case WEIGHT:
      return isSetWeight();
    case FEATURE_ID:
      return isSetFeatureId();
    case FEATURE_DESCRIPTION:
      return isSetFeatureDescription();
    case VENDOR_ITEM_ID:
      return isSetVendorItemId();
    }
    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 Item)
      return this.equals((Item)that);
    return false;
  }

  public boolean equals(Item 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_catalogItemId = true;
    boolean that_present_catalogItemId = true;
    if (this_present_catalogItemId || that_present_catalogItemId) {
      if (!(this_present_catalogItemId && that_present_catalogItemId))
        return false;
      if (this.catalogItemId != that.catalogItemId)
        return false;
    }

    boolean this_present_itemInventory = true && this.isSetItemInventory();
    boolean that_present_itemInventory = true && that.isSetItemInventory();
    if (this_present_itemInventory || that_present_itemInventory) {
      if (!(this_present_itemInventory && that_present_itemInventory))
        return false;
      if (!this.itemInventory.equals(that.itemInventory))
        return false;
    }

    boolean this_present_addedOn = true;
    boolean that_present_addedOn = true;
    if (this_present_addedOn || that_present_addedOn) {
      if (!(this_present_addedOn && that_present_addedOn))
        return false;
      if (this.addedOn != that.addedOn)
        return false;
    }

    boolean this_present_startDate = true;
    boolean that_present_startDate = true;
    if (this_present_startDate || that_present_startDate) {
      if (!(this_present_startDate && that_present_startDate))
        return false;
      if (this.startDate != that.startDate)
        return false;
    }

    boolean this_present_itemStatus = true && this.isSetItemStatus();
    boolean that_present_itemStatus = true && that.isSetItemStatus();
    if (this_present_itemStatus || that_present_itemStatus) {
      if (!(this_present_itemStatus && that_present_itemStatus))
        return false;
      if (!this.itemStatus.equals(that.itemStatus))
        return false;
    }

    boolean this_present_otherInfo = true && this.isSetOtherInfo();
    boolean that_present_otherInfo = true && that.isSetOtherInfo();
    if (this_present_otherInfo || that_present_otherInfo) {
      if (!(this_present_otherInfo && that_present_otherInfo))
        return false;
      if (!this.otherInfo.equals(that.otherInfo))
        return false;
    }

    boolean this_present_price = true && this.isSetPrice();
    boolean that_present_price = true && that.isSetPrice();
    if (this_present_price || that_present_price) {
      if (!(this_present_price && that_present_price))
        return false;
      if (!this.price.equals(that.price))
        return false;
    }

    boolean this_present_weight = true;
    boolean that_present_weight = true;
    if (this_present_weight || that_present_weight) {
      if (!(this_present_weight && that_present_weight))
        return false;
      if (this.weight != that.weight)
        return false;
    }

    boolean this_present_featureId = true;
    boolean that_present_featureId = true;
    if (this_present_featureId || that_present_featureId) {
      if (!(this_present_featureId && that_present_featureId))
        return false;
      if (this.featureId != that.featureId)
        return false;
    }

    boolean this_present_featureDescription = true && this.isSetFeatureDescription();
    boolean that_present_featureDescription = true && that.isSetFeatureDescription();
    if (this_present_featureDescription || that_present_featureDescription) {
      if (!(this_present_featureDescription && that_present_featureDescription))
        return false;
      if (!this.featureDescription.equals(that.featureDescription))
        return false;
    }

    boolean this_present_vendorItemId = true;
    boolean that_present_vendorItemId = true;
    if (this_present_vendorItemId || that_present_vendorItemId) {
      if (!(this_present_vendorItemId && that_present_vendorItemId))
        return false;
      if (this.vendorItemId != that.vendorItemId)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    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 CATALOG_ITEM_ID:
            if (field.type == TType.I64) {
              this.catalogItemId = iprot.readI64();
              setCatalogItemIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_INVENTORY:
            if (field.type == TType.STRUCT) {
              this.itemInventory = new ItemInventory();
              this.itemInventory.read(iprot);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ADDED_ON:
            if (field.type == TType.I64) {
              this.addedOn = iprot.readI64();
              setAddedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case START_DATE:
            if (field.type == TType.I64) {
              this.startDate = iprot.readI64();
              setStartDateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_STATUS:
            if (field.type == TType.I32) {
              this.itemStatus = status.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case OTHER_INFO:
            if (field.type == TType.MAP) {
              {
                TMap _map5 = iprot.readMapBegin();
                this.otherInfo = new HashMap<String,String>(2*_map5.size);
                for (int _i6 = 0; _i6 < _map5.size; ++_i6)
                {
                  String _key7;
                  String _val8;
                  _key7 = iprot.readString();
                  _val8 = iprot.readString();
                  this.otherInfo.put(_key7, _val8);
                }
                iprot.readMapEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PRICE:
            if (field.type == TType.MAP) {
              {
                TMap _map9 = iprot.readMapBegin();
                this.price = new HashMap<Long,Double>(2*_map9.size);
                for (int _i10 = 0; _i10 < _map9.size; ++_i10)
                {
                  long _key11;
                  double _val12;
                  _key11 = iprot.readI64();
                  _val12 = iprot.readDouble();
                  this.price.put(_key11, _val12);
                }
                iprot.readMapEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case WEIGHT:
            if (field.type == TType.DOUBLE) {
              this.weight = iprot.readDouble();
              setWeightIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case FEATURE_ID:
            if (field.type == TType.I64) {
              this.featureId = iprot.readI64();
              setFeatureIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case FEATURE_DESCRIPTION:
            if (field.type == TType.STRING) {
              this.featureDescription = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case VENDOR_ITEM_ID:
            if (field.type == TType.I64) {
              this.vendorItemId = iprot.readI64();
              setVendorItemIdIsSet(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(CATALOG_ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.catalogItemId);
    oprot.writeFieldEnd();
    if (this.itemInventory != null) {
      oprot.writeFieldBegin(ITEM_INVENTORY_FIELD_DESC);
      this.itemInventory.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
    oprot.writeI64(this.addedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
    oprot.writeI64(this.startDate);
    oprot.writeFieldEnd();
    if (this.itemStatus != null) {
      oprot.writeFieldBegin(ITEM_STATUS_FIELD_DESC);
      oprot.writeI32(this.itemStatus.getValue());
      oprot.writeFieldEnd();
    }
    if (this.otherInfo != null) {
      oprot.writeFieldBegin(OTHER_INFO_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.otherInfo.size()));
        for (Map.Entry<String, String> _iter13 : this.otherInfo.entrySet())
        {
          oprot.writeString(_iter13.getKey());
          oprot.writeString(_iter13.getValue());
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.price != null) {
      oprot.writeFieldBegin(PRICE_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.I64, TType.DOUBLE, this.price.size()));
        for (Map.Entry<Long, Double> _iter14 : this.price.entrySet())
        {
          oprot.writeI64(_iter14.getKey());
          oprot.writeDouble(_iter14.getValue());
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(WEIGHT_FIELD_DESC);
    oprot.writeDouble(this.weight);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(FEATURE_ID_FIELD_DESC);
    oprot.writeI64(this.featureId);
    oprot.writeFieldEnd();
    if (this.featureDescription != null) {
      oprot.writeFieldBegin(FEATURE_DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.featureDescription);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(VENDOR_ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.vendorItemId);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("catalogItemId:");
    sb.append(this.catalogItemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemInventory:");
    if (this.itemInventory == null) {
      sb.append("null");
    } else {
      sb.append(this.itemInventory);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("addedOn:");
    sb.append(this.addedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startDate:");
    sb.append(this.startDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemStatus:");
    if (this.itemStatus == null) {
      sb.append("null");
    } else {
      String itemStatus_name = itemStatus.name();
      if (itemStatus_name != null) {
        sb.append(itemStatus_name);
        sb.append(" (");
      }
      sb.append(this.itemStatus);
      if (itemStatus_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("otherInfo:");
    if (this.otherInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.otherInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("price:");
    if (this.price == null) {
      sb.append("null");
    } else {
      sb.append(this.price);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("weight:");
    sb.append(this.weight);
    first = false;
    if (!first) sb.append(", ");
    sb.append("featureId:");
    sb.append(this.featureId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("featureDescription:");
    if (this.featureDescription == null) {
      sb.append("null");
    } else {
      sb.append(this.featureDescription);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("vendorItemId:");
    sb.append(this.vendorItemId);
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}