Rev 100 | Rev 123 | 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 CATEGORIES_FIELD_DESC = new TField("categories", TType.LIST, (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.DOUBLE, (short)8);private long id;private List<Long> categories;private ItemInventory itemInventory;private long addedOn;private long startDate;private status itemStatus;private Map<String,String> otherInfo;private double price;/** 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"),CATEGORIES((short)2, "categories"),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");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 assignmentsprivate static final int __ID_ISSET_ID = 0;private static final int __ADDEDON_ISSET_ID = 1;private static final int __STARTDATE_ISSET_ID = 2;private static final int __PRICE_ISSET_ID = 3;private BitSet __isset_bit_vector = new BitSet(4);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.CATEGORIES, new FieldMetaData("categories", TFieldRequirementType.DEFAULT,new ListMetaData(TType.LIST,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 FieldValueMetaData(TType.DOUBLE)));}});static {FieldMetaData.addStructMetaDataMap(Item.class, metaDataMap);}public Item() {}public Item(long id,List<Long> categories,ItemInventory itemInventory,long addedOn,long startDate,status itemStatus,Map<String,String> otherInfo,double price){this();this.id = id;setIdIsSet(true);this.categories = categories;this.itemInventory = itemInventory;this.addedOn = addedOn;setAddedOnIsSet(true);this.startDate = startDate;setStartDateIsSet(true);this.itemStatus = itemStatus;this.otherInfo = otherInfo;this.price = price;setPriceIsSet(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;if (other.isSetCategories()) {List<Long> __this__categories = new ArrayList<Long>();for (Long other_element : other.categories) {__this__categories.add(other_element);}this.categories = __this__categories;}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;}this.price = other.price;}public Item deepCopy() {return new Item(this);}@Deprecatedpublic 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 int getCategoriesSize() {return (this.categories == null) ? 0 : this.categories.size();}public java.util.Iterator<Long> getCategoriesIterator() {return (this.categories == null) ? null : this.categories.iterator();}public void addToCategories(long elem) {if (this.categories == null) {this.categories = new ArrayList<Long>();}this.categories.add(elem);}public List<Long> getCategories() {return this.categories;}public Item setCategories(List<Long> categories) {this.categories = categories;return this;}public void unsetCategories() {this.categories = null;}/** Returns true if field categories is set (has been asigned a value) and false otherwise */public boolean isSetCategories() {return this.categories != null;}public void setCategoriesIsSet(boolean value) {if (!value) {this.categories = null;}}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 double getPrice() {return this.price;}public Item setPrice(double price) {this.price = price;setPriceIsSet(true);return this;}public void unsetPrice() {__isset_bit_vector.clear(__PRICE_ISSET_ID);}/** Returns true if field price is set (has been asigned a value) and false otherwise */public boolean isSetPrice() {return __isset_bit_vector.get(__PRICE_ISSET_ID);}public void setPriceIsSet(boolean value) {__isset_bit_vector.set(__PRICE_ISSET_ID, value);}public void setFieldValue(_Fields field, Object value) {switch (field) {case ID:if (value == null) {unsetId();} else {setId((Long)value);}break;case CATEGORIES:if (value == null) {unsetCategories();} else {setCategories((List<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((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 CATEGORIES:return getCategories();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 new Double(getPrice());}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 CATEGORIES:return isSetCategories();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();}throw new IllegalStateException();}public boolean isSet(int fieldID) {return isSet(_Fields.findByThriftIdOrThrow(fieldID));}@Overridepublic 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_categories = true && this.isSetCategories();boolean that_present_categories = true && that.isSetCategories();if (this_present_categories || that_present_categories) {if (!(this_present_categories && that_present_categories))return false;if (!this.categories.equals(that.categories))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;boolean that_present_price = true;if (this_present_price || that_present_price) {if (!(this_present_price && that_present_price))return false;if (this.price != that.price)return false;}return true;}@Overridepublic 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 CATEGORIES:if (field.type == TType.LIST) {{TList _list9 = iprot.readListBegin();this.categories = new ArrayList<Long>(_list9.size);for (int _i10 = 0; _i10 < _list9.size; ++_i10){long _elem11;_elem11 = iprot.readI64();this.categories.add(_elem11);}iprot.readListEnd();}} 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 _map12 = iprot.readMapBegin();this.otherInfo = new HashMap<String,String>(2*_map12.size);for (int _i13 = 0; _i13 < _map12.size; ++_i13){String _key14;String _val15;_key14 = iprot.readString();_val15 = iprot.readString();this.otherInfo.put(_key14, _val15);}iprot.readMapEnd();}} else {TProtocolUtil.skip(iprot, field.type);}break;case PRICE:if (field.type == TType.DOUBLE) {this.price = iprot.readDouble();setPriceIsSet(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();if (this.categories != null) {oprot.writeFieldBegin(CATEGORIES_FIELD_DESC);{oprot.writeListBegin(new TList(TType.I64, this.categories.size()));for (long _iter16 : this.categories){oprot.writeI64(_iter16);}oprot.writeListEnd();}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> _iter17 : this.otherInfo.entrySet()){oprot.writeString(_iter17.getKey());oprot.writeString(_iter17.getValue());}oprot.writeMapEnd();}oprot.writeFieldEnd();}oprot.writeFieldBegin(PRICE_FIELD_DESC);oprot.writeDouble(this.price);oprot.writeFieldEnd();oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic 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("categories:");if (this.categories == null) {sb.append("null");} else {sb.append(this.categories);}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:");sb.append(this.price);first = false;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}