Rev 5945 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*** Autogenerated by Thrift Compiler (0.7.0)** DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING*/package in.shop2020.model.v1.inventory;import java.util.List;import java.util.ArrayList;import java.util.Map;import java.util.HashMap;import java.util.EnumMap;import java.util.Set;import java.util.HashSet;import java.util.EnumSet;import java.util.Collections;import java.util.BitSet;import java.nio.ByteBuffer;import java.util.Arrays;import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class ItemInventory implements org.apache.thrift.TBase<ItemInventory, ItemInventory._Fields>, java.io.Serializable, Cloneable {private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ItemInventory");private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);private static final org.apache.thrift.protocol.TField AVAILABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("availability", org.apache.thrift.protocol.TType.MAP, (short)2);private static final org.apache.thrift.protocol.TField RESERVED_FIELD_DESC = new org.apache.thrift.protocol.TField("reserved", org.apache.thrift.protocol.TType.MAP, (short)3);private static final org.apache.thrift.protocol.TField HELD_FIELD_DESC = new org.apache.thrift.protocol.TField("held", org.apache.thrift.protocol.TType.MAP, (short)4);private long id; // requiredprivate Map<Long,Long> availability; // requiredprivate Map<Long,Long> reserved; // requiredprivate Map<Long,Long> held; // required/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */public enum _Fields implements org.apache.thrift.TFieldIdEnum {ID((short)1, "id"),AVAILABILITY((short)2, "availability"),RESERVED((short)3, "reserved"),HELD((short)4, "held");private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();static {for (_Fields field : EnumSet.allOf(_Fields.class)) {byName.put(field.getFieldName(), field);}}/*** Find the _Fields constant that matches fieldId, or null if its not found.*/public static _Fields findByThriftId(int fieldId) {switch(fieldId) {case 1: // IDreturn ID;case 2: // AVAILABILITYreturn AVAILABILITY;case 3: // RESERVEDreturn RESERVED;case 4: // HELDreturn HELD;default:return null;}}/*** Find the _Fields constant that matches fieldId, throwing an exception* if it is not found.*/public static _Fields findByThriftIdOrThrow(int fieldId) {_Fields fields = findByThriftId(fieldId);if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");return fields;}/*** Find the _Fields constant that matches name, or null if its not found.*/public static _Fields findByName(String name) {return byName.get(name);}private final short _thriftId;private final String _fieldName;_Fields(short thriftId, String fieldName) {_thriftId = thriftId;_fieldName = fieldName;}public short getThriftFieldId() {return _thriftId;}public String getFieldName() {return _fieldName;}}// isset id assignmentsprivate static final int __ID_ISSET_ID = 0;private BitSet __isset_bit_vector = new BitSet(1);public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;static {Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));tmpMap.put(_Fields.AVAILABILITY, new org.apache.thrift.meta_data.FieldMetaData("availability", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64),new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));tmpMap.put(_Fields.RESERVED, new org.apache.thrift.meta_data.FieldMetaData("reserved", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64),new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));tmpMap.put(_Fields.HELD, new org.apache.thrift.meta_data.FieldMetaData("held", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64),new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));metaDataMap = Collections.unmodifiableMap(tmpMap);org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemInventory.class, metaDataMap);}public ItemInventory() {}public ItemInventory(long id,Map<Long,Long> availability,Map<Long,Long> reserved,Map<Long,Long> held){this();this.id = id;setIdIsSet(true);this.availability = availability;this.reserved = reserved;this.held = held;}/*** Performs a deep copy on <i>other</i>.*/public ItemInventory(ItemInventory other) {__isset_bit_vector.clear();__isset_bit_vector.or(other.__isset_bit_vector);this.id = other.id;if (other.isSetAvailability()) {Map<Long,Long> __this__availability = new HashMap<Long,Long>();for (Map.Entry<Long, Long> other_element : other.availability.entrySet()) {Long other_element_key = other_element.getKey();Long other_element_value = other_element.getValue();Long __this__availability_copy_key = other_element_key;Long __this__availability_copy_value = other_element_value;__this__availability.put(__this__availability_copy_key, __this__availability_copy_value);}this.availability = __this__availability;}if (other.isSetReserved()) {Map<Long,Long> __this__reserved = new HashMap<Long,Long>();for (Map.Entry<Long, Long> other_element : other.reserved.entrySet()) {Long other_element_key = other_element.getKey();Long other_element_value = other_element.getValue();Long __this__reserved_copy_key = other_element_key;Long __this__reserved_copy_value = other_element_value;__this__reserved.put(__this__reserved_copy_key, __this__reserved_copy_value);}this.reserved = __this__reserved;}if (other.isSetHeld()) {Map<Long,Long> __this__held = new HashMap<Long,Long>();for (Map.Entry<Long, Long> other_element : other.held.entrySet()) {Long other_element_key = other_element.getKey();Long other_element_value = other_element.getValue();Long __this__held_copy_key = other_element_key;Long __this__held_copy_value = other_element_value;__this__held.put(__this__held_copy_key, __this__held_copy_value);}this.held = __this__held;}}public ItemInventory deepCopy() {return new ItemInventory(this);}@Overridepublic void clear() {setIdIsSet(false);this.id = 0;this.availability = null;this.reserved = null;this.held = null;}public long getId() {return this.id;}public void setId(long id) {this.id = id;setIdIsSet(true);}public void unsetId() {__isset_bit_vector.clear(__ID_ISSET_ID);}/** Returns true if field id is set (has been assigned 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 getAvailabilitySize() {return (this.availability == null) ? 0 : this.availability.size();}public void putToAvailability(long key, long val) {if (this.availability == null) {this.availability = new HashMap<Long,Long>();}this.availability.put(key, val);}public Map<Long,Long> getAvailability() {return this.availability;}public void setAvailability(Map<Long,Long> availability) {this.availability = availability;}public void unsetAvailability() {this.availability = null;}/** Returns true if field availability is set (has been assigned a value) and false otherwise */public boolean isSetAvailability() {return this.availability != null;}public void setAvailabilityIsSet(boolean value) {if (!value) {this.availability = null;}}public int getReservedSize() {return (this.reserved == null) ? 0 : this.reserved.size();}public void putToReserved(long key, long val) {if (this.reserved == null) {this.reserved = new HashMap<Long,Long>();}this.reserved.put(key, val);}public Map<Long,Long> getReserved() {return this.reserved;}public void setReserved(Map<Long,Long> reserved) {this.reserved = reserved;}public void unsetReserved() {this.reserved = null;}/** Returns true if field reserved is set (has been assigned a value) and false otherwise */public boolean isSetReserved() {return this.reserved != null;}public void setReservedIsSet(boolean value) {if (!value) {this.reserved = null;}}public int getHeldSize() {return (this.held == null) ? 0 : this.held.size();}public void putToHeld(long key, long val) {if (this.held == null) {this.held = new HashMap<Long,Long>();}this.held.put(key, val);}public Map<Long,Long> getHeld() {return this.held;}public void setHeld(Map<Long,Long> held) {this.held = held;}public void unsetHeld() {this.held = null;}/** Returns true if field held is set (has been assigned a value) and false otherwise */public boolean isSetHeld() {return this.held != null;}public void setHeldIsSet(boolean value) {if (!value) {this.held = null;}}public void setFieldValue(_Fields field, Object value) {switch (field) {case ID:if (value == null) {unsetId();} else {setId((Long)value);}break;case AVAILABILITY:if (value == null) {unsetAvailability();} else {setAvailability((Map<Long,Long>)value);}break;case RESERVED:if (value == null) {unsetReserved();} else {setReserved((Map<Long,Long>)value);}break;case HELD:if (value == null) {unsetHeld();} else {setHeld((Map<Long,Long>)value);}break;}}public Object getFieldValue(_Fields field) {switch (field) {case ID:return Long.valueOf(getId());case AVAILABILITY:return getAvailability();case RESERVED:return getReserved();case HELD:return getHeld();}throw new IllegalStateException();}/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */public boolean isSet(_Fields field) {if (field == null) {throw new IllegalArgumentException();}switch (field) {case ID:return isSetId();case AVAILABILITY:return isSetAvailability();case RESERVED:return isSetReserved();case HELD:return isSetHeld();}throw new IllegalStateException();}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof ItemInventory)return this.equals((ItemInventory)that);return false;}public boolean equals(ItemInventory 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_availability = true && this.isSetAvailability();boolean that_present_availability = true && that.isSetAvailability();if (this_present_availability || that_present_availability) {if (!(this_present_availability && that_present_availability))return false;if (!this.availability.equals(that.availability))return false;}boolean this_present_reserved = true && this.isSetReserved();boolean that_present_reserved = true && that.isSetReserved();if (this_present_reserved || that_present_reserved) {if (!(this_present_reserved && that_present_reserved))return false;if (!this.reserved.equals(that.reserved))return false;}boolean this_present_held = true && this.isSetHeld();boolean that_present_held = true && that.isSetHeld();if (this_present_held || that_present_held) {if (!(this_present_held && that_present_held))return false;if (!this.held.equals(that.held))return false;}return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(ItemInventory other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;ItemInventory typedOther = (ItemInventory)other;lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());if (lastComparison != 0) {return lastComparison;}if (isSetId()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetAvailability()).compareTo(typedOther.isSetAvailability());if (lastComparison != 0) {return lastComparison;}if (isSetAvailability()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.availability, typedOther.availability);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetReserved()).compareTo(typedOther.isSetReserved());if (lastComparison != 0) {return lastComparison;}if (isSetReserved()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reserved, typedOther.reserved);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetHeld()).compareTo(typedOther.isSetHeld());if (lastComparison != 0) {return lastComparison;}if (isSetHeld()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.held, typedOther.held);if (lastComparison != 0) {return lastComparison;}}return 0;}public _Fields fieldForId(int fieldId) {return _Fields.findByThriftId(fieldId);}public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {org.apache.thrift.protocol.TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == org.apache.thrift.protocol.TType.STOP) {break;}switch (field.id) {case 1: // IDif (field.type == org.apache.thrift.protocol.TType.I64) {this.id = iprot.readI64();setIdIsSet(true);} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 2: // AVAILABILITYif (field.type == org.apache.thrift.protocol.TType.MAP) {{org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();this.availability = new HashMap<Long,Long>(2*_map0.size);for (int _i1 = 0; _i1 < _map0.size; ++_i1){long _key2; // requiredlong _val3; // required_key2 = iprot.readI64();_val3 = iprot.readI64();this.availability.put(_key2, _val3);}iprot.readMapEnd();}} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 3: // RESERVEDif (field.type == org.apache.thrift.protocol.TType.MAP) {{org.apache.thrift.protocol.TMap _map4 = iprot.readMapBegin();this.reserved = new HashMap<Long,Long>(2*_map4.size);for (int _i5 = 0; _i5 < _map4.size; ++_i5){long _key6; // requiredlong _val7; // required_key6 = iprot.readI64();_val7 = iprot.readI64();this.reserved.put(_key6, _val7);}iprot.readMapEnd();}} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 4: // HELDif (field.type == org.apache.thrift.protocol.TType.MAP) {{org.apache.thrift.protocol.TMap _map8 = iprot.readMapBegin();this.held = new HashMap<Long,Long>(2*_map8.size);for (int _i9 = 0; _i9 < _map8.size; ++_i9){long _key10; // requiredlong _val11; // required_key10 = iprot.readI64();_val11 = iprot.readI64();this.held.put(_key10, _val11);}iprot.readMapEnd();}} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;default:org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}iprot.readFieldEnd();}iprot.readStructEnd();validate();}public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {validate();oprot.writeStructBegin(STRUCT_DESC);oprot.writeFieldBegin(ID_FIELD_DESC);oprot.writeI64(this.id);oprot.writeFieldEnd();if (this.availability != null) {oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);{oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.availability.size()));for (Map.Entry<Long, Long> _iter12 : this.availability.entrySet()){oprot.writeI64(_iter12.getKey());oprot.writeI64(_iter12.getValue());}oprot.writeMapEnd();}oprot.writeFieldEnd();}if (this.reserved != null) {oprot.writeFieldBegin(RESERVED_FIELD_DESC);{oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.reserved.size()));for (Map.Entry<Long, Long> _iter13 : this.reserved.entrySet()){oprot.writeI64(_iter13.getKey());oprot.writeI64(_iter13.getValue());}oprot.writeMapEnd();}oprot.writeFieldEnd();}if (this.held != null) {oprot.writeFieldBegin(HELD_FIELD_DESC);{oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.I64, this.held.size()));for (Map.Entry<Long, Long> _iter14 : this.held.entrySet()){oprot.writeI64(_iter14.getKey());oprot.writeI64(_iter14.getValue());}oprot.writeMapEnd();}oprot.writeFieldEnd();}oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("ItemInventory(");boolean first = true;sb.append("id:");sb.append(this.id);first = false;if (!first) sb.append(", ");sb.append("availability:");if (this.availability == null) {sb.append("null");} else {sb.append(this.availability);}first = false;if (!first) sb.append(", ");sb.append("reserved:");if (this.reserved == null) {sb.append("null");} else {sb.append(this.reserved);}first = false;if (!first) sb.append(", ");sb.append("held:");if (this.held == null) {sb.append("null");} else {sb.append(this.held);}first = false;sb.append(")");return sb.toString();}public void validate() throws org.apache.thrift.TException {// check for required fields}private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {try {write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));} catch (org.apache.thrift.TException te) {throw new java.io.IOException(te);}}private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {try {// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.__isset_bit_vector = new BitSet(1);read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));} catch (org.apache.thrift.TException te) {throw new java.io.IOException(te);}}}