Rev 5336 | 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.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.nio.ByteBuffer;import java.util.Arrays;import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class Category implements org.apache.thrift.TBase<Category, Category._Fields>, java.io.Serializable, Cloneable {private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Category");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 LABEL_FIELD_DESC = new org.apache.thrift.protocol.TField("label", org.apache.thrift.protocol.TType.STRING, (short)2);private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)3);private static final org.apache.thrift.protocol.TField PARENT_CATEGORY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("parent_category_id", org.apache.thrift.protocol.TType.I64, (short)4);private static final org.apache.thrift.protocol.TField CHILDREN_CATEGORY_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("children_category_ids", org.apache.thrift.protocol.TType.LIST, (short)5);private static final org.apache.thrift.protocol.TField DISPLAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("display_name", org.apache.thrift.protocol.TType.STRING, (short)6);private long id; // requiredprivate String label; // requiredprivate String description; // requiredprivate long parent_category_id; // requiredprivate List<Long> children_category_ids; // requiredprivate String display_name; // 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"),LABEL((short)2, "label"),DESCRIPTION((short)3, "description"),PARENT_CATEGORY_ID((short)4, "parent_category_id"),/*** This field should not be used.*/CHILDREN_CATEGORY_IDS((short)5, "children_category_ids"),DISPLAY_NAME((short)6, "display_name");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: // LABELreturn LABEL;case 3: // DESCRIPTIONreturn DESCRIPTION;case 4: // PARENT_CATEGORY_IDreturn PARENT_CATEGORY_ID;case 5: // CHILDREN_CATEGORY_IDSreturn CHILDREN_CATEGORY_IDS;case 6: // DISPLAY_NAMEreturn DISPLAY_NAME;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 static final int __PARENT_CATEGORY_ID_ISSET_ID = 1;private BitSet __isset_bit_vector = new BitSet(2);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.LABEL, new org.apache.thrift.meta_data.FieldMetaData("label", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));tmpMap.put(_Fields.PARENT_CATEGORY_ID, new org.apache.thrift.meta_data.FieldMetaData("parent_category_id", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));tmpMap.put(_Fields.CHILDREN_CATEGORY_IDS, new org.apache.thrift.meta_data.FieldMetaData("children_category_ids", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));tmpMap.put(_Fields.DISPLAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("display_name", org.apache.thrift.TFieldRequirementType.DEFAULT,new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));metaDataMap = Collections.unmodifiableMap(tmpMap);org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Category.class, metaDataMap);}public Category() {}public Category(long id,String label,String description,long parent_category_id,List<Long> children_category_ids,String display_name){this();this.id = id;setIdIsSet(true);this.label = label;this.description = description;this.parent_category_id = parent_category_id;setParent_category_idIsSet(true);this.children_category_ids = children_category_ids;this.display_name = display_name;}/*** Performs a deep copy on <i>other</i>.*/public Category(Category other) {__isset_bit_vector.clear();__isset_bit_vector.or(other.__isset_bit_vector);this.id = other.id;if (other.isSetLabel()) {this.label = other.label;}if (other.isSetDescription()) {this.description = other.description;}this.parent_category_id = other.parent_category_id;if (other.isSetChildren_category_ids()) {List<Long> __this__children_category_ids = new ArrayList<Long>();for (Long other_element : other.children_category_ids) {__this__children_category_ids.add(other_element);}this.children_category_ids = __this__children_category_ids;}if (other.isSetDisplay_name()) {this.display_name = other.display_name;}}public Category deepCopy() {return new Category(this);}@Overridepublic void clear() {setIdIsSet(false);this.id = 0;this.label = null;this.description = null;setParent_category_idIsSet(false);this.parent_category_id = 0;this.children_category_ids = null;this.display_name = 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 String getLabel() {return this.label;}public void setLabel(String label) {this.label = label;}public void unsetLabel() {this.label = null;}/** Returns true if field label is set (has been assigned a value) and false otherwise */public boolean isSetLabel() {return this.label != null;}public void setLabelIsSet(boolean value) {if (!value) {this.label = null;}}public String getDescription() {return this.description;}public void setDescription(String description) {this.description = description;}public void unsetDescription() {this.description = null;}/** Returns true if field description is set (has been assigned a value) and false otherwise */public boolean isSetDescription() {return this.description != null;}public void setDescriptionIsSet(boolean value) {if (!value) {this.description = null;}}public long getParent_category_id() {return this.parent_category_id;}public void setParent_category_id(long parent_category_id) {this.parent_category_id = parent_category_id;setParent_category_idIsSet(true);}public void unsetParent_category_id() {__isset_bit_vector.clear(__PARENT_CATEGORY_ID_ISSET_ID);}/** Returns true if field parent_category_id is set (has been assigned a value) and false otherwise */public boolean isSetParent_category_id() {return __isset_bit_vector.get(__PARENT_CATEGORY_ID_ISSET_ID);}public void setParent_category_idIsSet(boolean value) {__isset_bit_vector.set(__PARENT_CATEGORY_ID_ISSET_ID, value);}public int getChildren_category_idsSize() {return (this.children_category_ids == null) ? 0 : this.children_category_ids.size();}public java.util.Iterator<Long> getChildren_category_idsIterator() {return (this.children_category_ids == null) ? null : this.children_category_ids.iterator();}public void addToChildren_category_ids(long elem) {if (this.children_category_ids == null) {this.children_category_ids = new ArrayList<Long>();}this.children_category_ids.add(elem);}/*** This field should not be used.*/public List<Long> getChildren_category_ids() {return this.children_category_ids;}/*** This field should not be used.*/public void setChildren_category_ids(List<Long> children_category_ids) {this.children_category_ids = children_category_ids;}public void unsetChildren_category_ids() {this.children_category_ids = null;}/** Returns true if field children_category_ids is set (has been assigned a value) and false otherwise */public boolean isSetChildren_category_ids() {return this.children_category_ids != null;}public void setChildren_category_idsIsSet(boolean value) {if (!value) {this.children_category_ids = null;}}public String getDisplay_name() {return this.display_name;}public void setDisplay_name(String display_name) {this.display_name = display_name;}public void unsetDisplay_name() {this.display_name = null;}/** Returns true if field display_name is set (has been assigned a value) and false otherwise */public boolean isSetDisplay_name() {return this.display_name != null;}public void setDisplay_nameIsSet(boolean value) {if (!value) {this.display_name = null;}}public void setFieldValue(_Fields field, Object value) {switch (field) {case ID:if (value == null) {unsetId();} else {setId((Long)value);}break;case LABEL:if (value == null) {unsetLabel();} else {setLabel((String)value);}break;case DESCRIPTION:if (value == null) {unsetDescription();} else {setDescription((String)value);}break;case PARENT_CATEGORY_ID:if (value == null) {unsetParent_category_id();} else {setParent_category_id((Long)value);}break;case CHILDREN_CATEGORY_IDS:if (value == null) {unsetChildren_category_ids();} else {setChildren_category_ids((List<Long>)value);}break;case DISPLAY_NAME:if (value == null) {unsetDisplay_name();} else {setDisplay_name((String)value);}break;}}public Object getFieldValue(_Fields field) {switch (field) {case ID:return Long.valueOf(getId());case LABEL:return getLabel();case DESCRIPTION:return getDescription();case PARENT_CATEGORY_ID:return Long.valueOf(getParent_category_id());case CHILDREN_CATEGORY_IDS:return getChildren_category_ids();case DISPLAY_NAME:return getDisplay_name();}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 LABEL:return isSetLabel();case DESCRIPTION:return isSetDescription();case PARENT_CATEGORY_ID:return isSetParent_category_id();case CHILDREN_CATEGORY_IDS:return isSetChildren_category_ids();case DISPLAY_NAME:return isSetDisplay_name();}throw new IllegalStateException();}@Overridepublic boolean equals(Object that) {if (that == null)return false;if (that instanceof Category)return this.equals((Category)that);return false;}public boolean equals(Category 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_label = true && this.isSetLabel();boolean that_present_label = true && that.isSetLabel();if (this_present_label || that_present_label) {if (!(this_present_label && that_present_label))return false;if (!this.label.equals(that.label))return false;}boolean this_present_description = true && this.isSetDescription();boolean that_present_description = true && that.isSetDescription();if (this_present_description || that_present_description) {if (!(this_present_description && that_present_description))return false;if (!this.description.equals(that.description))return false;}boolean this_present_parent_category_id = true;boolean that_present_parent_category_id = true;if (this_present_parent_category_id || that_present_parent_category_id) {if (!(this_present_parent_category_id && that_present_parent_category_id))return false;if (this.parent_category_id != that.parent_category_id)return false;}boolean this_present_children_category_ids = true && this.isSetChildren_category_ids();boolean that_present_children_category_ids = true && that.isSetChildren_category_ids();if (this_present_children_category_ids || that_present_children_category_ids) {if (!(this_present_children_category_ids && that_present_children_category_ids))return false;if (!this.children_category_ids.equals(that.children_category_ids))return false;}boolean this_present_display_name = true && this.isSetDisplay_name();boolean that_present_display_name = true && that.isSetDisplay_name();if (this_present_display_name || that_present_display_name) {if (!(this_present_display_name && that_present_display_name))return false;if (!this.display_name.equals(that.display_name))return false;}return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(Category other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;Category typedOther = (Category)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(isSetLabel()).compareTo(typedOther.isSetLabel());if (lastComparison != 0) {return lastComparison;}if (isSetLabel()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.label, typedOther.label);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetDescription()).compareTo(typedOther.isSetDescription());if (lastComparison != 0) {return lastComparison;}if (isSetDescription()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, typedOther.description);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetParent_category_id()).compareTo(typedOther.isSetParent_category_id());if (lastComparison != 0) {return lastComparison;}if (isSetParent_category_id()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parent_category_id, typedOther.parent_category_id);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetChildren_category_ids()).compareTo(typedOther.isSetChildren_category_ids());if (lastComparison != 0) {return lastComparison;}if (isSetChildren_category_ids()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.children_category_ids, typedOther.children_category_ids);if (lastComparison != 0) {return lastComparison;}}lastComparison = Boolean.valueOf(isSetDisplay_name()).compareTo(typedOther.isSetDisplay_name());if (lastComparison != 0) {return lastComparison;}if (isSetDisplay_name()) {lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.display_name, typedOther.display_name);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: // LABELif (field.type == org.apache.thrift.protocol.TType.STRING) {this.label = iprot.readString();} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 3: // DESCRIPTIONif (field.type == org.apache.thrift.protocol.TType.STRING) {this.description = iprot.readString();} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 4: // PARENT_CATEGORY_IDif (field.type == org.apache.thrift.protocol.TType.I64) {this.parent_category_id = iprot.readI64();setParent_category_idIsSet(true);} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 5: // CHILDREN_CATEGORY_IDSif (field.type == org.apache.thrift.protocol.TType.LIST) {{org.apache.thrift.protocol.TList _list5 = iprot.readListBegin();this.children_category_ids = new ArrayList<Long>(_list5.size);for (int _i6 = 0; _i6 < _list5.size; ++_i6){long _elem7; // required_elem7 = iprot.readI64();this.children_category_ids.add(_elem7);}iprot.readListEnd();}} else {org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);}break;case 6: // DISPLAY_NAMEif (field.type == org.apache.thrift.protocol.TType.STRING) {this.display_name = iprot.readString();} 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.label != null) {oprot.writeFieldBegin(LABEL_FIELD_DESC);oprot.writeString(this.label);oprot.writeFieldEnd();}if (this.description != null) {oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);oprot.writeString(this.description);oprot.writeFieldEnd();}oprot.writeFieldBegin(PARENT_CATEGORY_ID_FIELD_DESC);oprot.writeI64(this.parent_category_id);oprot.writeFieldEnd();if (this.children_category_ids != null) {oprot.writeFieldBegin(CHILDREN_CATEGORY_IDS_FIELD_DESC);{oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, this.children_category_ids.size()));for (long _iter8 : this.children_category_ids){oprot.writeI64(_iter8);}oprot.writeListEnd();}oprot.writeFieldEnd();}if (this.display_name != null) {oprot.writeFieldBegin(DISPLAY_NAME_FIELD_DESC);oprot.writeString(this.display_name);oprot.writeFieldEnd();}oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("Category(");boolean first = true;sb.append("id:");sb.append(this.id);first = false;if (!first) sb.append(", ");sb.append("label:");if (this.label == null) {sb.append("null");} else {sb.append(this.label);}first = false;if (!first) sb.append(", ");sb.append("description:");if (this.description == null) {sb.append("null");} else {sb.append(this.description);}first = false;if (!first) sb.append(", ");sb.append("parent_category_id:");sb.append(this.parent_category_id);first = false;if (!first) sb.append(", ");sb.append("children_category_ids:");if (this.children_category_ids == null) {sb.append("null");} else {sb.append(this.children_category_ids);}first = false;if (!first) sb.append(", ");sb.append("display_name:");if (this.display_name == null) {sb.append("null");} else {sb.append(this.display_name);}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);}}}