Rev 553 | Blame | 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.user;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 Widget implements TBase<Widget._Fields>, java.io.Serializable, Cloneable, Comparable<Widget> {private static final TStruct STRUCT_DESC = new TStruct("Widget");private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);private static final TField TYPE_FIELD_DESC = new TField("type", TType.I32, (short)2);private static final TField CUSTOMER_ID_FIELD_DESC = new TField("customer_id", TType.I64, (short)3);private static final TField ITEMS_FIELD_DESC = new TField("items", TType.LIST, (short)4);private static final TField ENABLED_FIELD_DESC = new TField("enabled", TType.BOOL, (short)5);private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)6);private static final TField SESSION_ID_FIELD_DESC = new TField("session_id", TType.BOOL, (short)7);private long id;private WidgetType type;private long customer_id;private List<WidgetItem> items;private boolean enabled;private String name;private boolean session_id;/** 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"),/**** @see WidgetType*/TYPE((short)2, "type"),CUSTOMER_ID((short)3, "customer_id"),ITEMS((short)4, "items"),ENABLED((short)5, "enabled"),NAME((short)6, "name"),SESSION_ID((short)7, "session_id");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 __CUSTOMER_ID_ISSET_ID = 1;private static final int __ENABLED_ISSET_ID = 2;private static final int __SESSION_ID_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.TYPE, new FieldMetaData("type", TFieldRequirementType.DEFAULT,new EnumMetaData(TType.ENUM, WidgetType.class)));put(_Fields.CUSTOMER_ID, new FieldMetaData("customer_id", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.I64)));put(_Fields.ITEMS, new FieldMetaData("items", TFieldRequirementType.DEFAULT,new ListMetaData(TType.LIST,new StructMetaData(TType.STRUCT, WidgetItem.class))));put(_Fields.ENABLED, new FieldMetaData("enabled", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.BOOL)));put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.STRING)));put(_Fields.SESSION_ID, new FieldMetaData("session_id", TFieldRequirementType.DEFAULT,new FieldValueMetaData(TType.BOOL)));}});static {FieldMetaData.addStructMetaDataMap(Widget.class, metaDataMap);}public Widget() {}public Widget(long id,WidgetType type,long customer_id,List<WidgetItem> items,boolean enabled,String name,boolean session_id){this();this.id = id;setIdIsSet(true);this.type = type;this.customer_id = customer_id;setCustomer_idIsSet(true);this.items = items;this.enabled = enabled;setEnabledIsSet(true);this.name = name;this.session_id = session_id;setSession_idIsSet(true);}/*** Performs a deep copy on <i>other</i>.*/public Widget(Widget other) {__isset_bit_vector.clear();__isset_bit_vector.or(other.__isset_bit_vector);this.id = other.id;if (other.isSetType()) {this.type = other.type;}this.customer_id = other.customer_id;if (other.isSetItems()) {List<WidgetItem> __this__items = new ArrayList<WidgetItem>();for (WidgetItem other_element : other.items) {__this__items.add(new WidgetItem(other_element));}this.items = __this__items;}this.enabled = other.enabled;if (other.isSetName()) {this.name = other.name;}this.session_id = other.session_id;}public Widget deepCopy() {return new Widget(this);}@Deprecatedpublic Widget clone() {return new Widget(this);}public long getId() {return this.id;}public Widget 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);}/**** @see WidgetType*/public WidgetType getType() {return this.type;}/**** @see WidgetType*/public Widget setType(WidgetType type) {this.type = type;return this;}public void unsetType() {this.type = null;}/** Returns true if field type is set (has been asigned a value) and false otherwise */public boolean isSetType() {return this.type != null;}public void setTypeIsSet(boolean value) {if (!value) {this.type = null;}}public long getCustomer_id() {return this.customer_id;}public Widget setCustomer_id(long customer_id) {this.customer_id = customer_id;setCustomer_idIsSet(true);return this;}public void unsetCustomer_id() {__isset_bit_vector.clear(__CUSTOMER_ID_ISSET_ID);}/** Returns true if field customer_id is set (has been asigned a value) and false otherwise */public boolean isSetCustomer_id() {return __isset_bit_vector.get(__CUSTOMER_ID_ISSET_ID);}public void setCustomer_idIsSet(boolean value) {__isset_bit_vector.set(__CUSTOMER_ID_ISSET_ID, value);}public int getItemsSize() {return (this.items == null) ? 0 : this.items.size();}public java.util.Iterator<WidgetItem> getItemsIterator() {return (this.items == null) ? null : this.items.iterator();}public void addToItems(WidgetItem elem) {if (this.items == null) {this.items = new ArrayList<WidgetItem>();}this.items.add(elem);}public List<WidgetItem> getItems() {return this.items;}public Widget setItems(List<WidgetItem> items) {this.items = items;return this;}public void unsetItems() {this.items = null;}/** Returns true if field items is set (has been asigned a value) and false otherwise */public boolean isSetItems() {return this.items != null;}public void setItemsIsSet(boolean value) {if (!value) {this.items = null;}}public boolean isEnabled() {return this.enabled;}public Widget setEnabled(boolean enabled) {this.enabled = enabled;setEnabledIsSet(true);return this;}public void unsetEnabled() {__isset_bit_vector.clear(__ENABLED_ISSET_ID);}/** Returns true if field enabled is set (has been asigned a value) and false otherwise */public boolean isSetEnabled() {return __isset_bit_vector.get(__ENABLED_ISSET_ID);}public void setEnabledIsSet(boolean value) {__isset_bit_vector.set(__ENABLED_ISSET_ID, value);}public String getName() {return this.name;}public Widget setName(String name) {this.name = name;return this;}public void unsetName() {this.name = null;}/** Returns true if field name is set (has been asigned a value) and false otherwise */public boolean isSetName() {return this.name != null;}public void setNameIsSet(boolean value) {if (!value) {this.name = null;}}public boolean isSession_id() {return this.session_id;}public Widget setSession_id(boolean session_id) {this.session_id = session_id;setSession_idIsSet(true);return this;}public void unsetSession_id() {__isset_bit_vector.clear(__SESSION_ID_ISSET_ID);}/** Returns true if field session_id is set (has been asigned a value) and false otherwise */public boolean isSetSession_id() {return __isset_bit_vector.get(__SESSION_ID_ISSET_ID);}public void setSession_idIsSet(boolean value) {__isset_bit_vector.set(__SESSION_ID_ISSET_ID, value);}public void setFieldValue(_Fields field, Object value) {switch (field) {case ID:if (value == null) {unsetId();} else {setId((Long)value);}break;case TYPE:if (value == null) {unsetType();} else {setType((WidgetType)value);}break;case CUSTOMER_ID:if (value == null) {unsetCustomer_id();} else {setCustomer_id((Long)value);}break;case ITEMS:if (value == null) {unsetItems();} else {setItems((List<WidgetItem>)value);}break;case ENABLED:if (value == null) {unsetEnabled();} else {setEnabled((Boolean)value);}break;case NAME:if (value == null) {unsetName();} else {setName((String)value);}break;case SESSION_ID:if (value == null) {unsetSession_id();} else {setSession_id((Boolean)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 TYPE:return getType();case CUSTOMER_ID:return new Long(getCustomer_id());case ITEMS:return getItems();case ENABLED:return new Boolean(isEnabled());case NAME:return getName();case SESSION_ID:return new Boolean(isSession_id());}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 TYPE:return isSetType();case CUSTOMER_ID:return isSetCustomer_id();case ITEMS:return isSetItems();case ENABLED:return isSetEnabled();case NAME:return isSetName();case SESSION_ID:return isSetSession_id();}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 Widget)return this.equals((Widget)that);return false;}public boolean equals(Widget 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_type = true && this.isSetType();boolean that_present_type = true && that.isSetType();if (this_present_type || that_present_type) {if (!(this_present_type && that_present_type))return false;if (!this.type.equals(that.type))return false;}boolean this_present_customer_id = true;boolean that_present_customer_id = true;if (this_present_customer_id || that_present_customer_id) {if (!(this_present_customer_id && that_present_customer_id))return false;if (this.customer_id != that.customer_id)return false;}boolean this_present_items = true && this.isSetItems();boolean that_present_items = true && that.isSetItems();if (this_present_items || that_present_items) {if (!(this_present_items && that_present_items))return false;if (!this.items.equals(that.items))return false;}boolean this_present_enabled = true;boolean that_present_enabled = true;if (this_present_enabled || that_present_enabled) {if (!(this_present_enabled && that_present_enabled))return false;if (this.enabled != that.enabled)return false;}boolean this_present_name = true && this.isSetName();boolean that_present_name = true && that.isSetName();if (this_present_name || that_present_name) {if (!(this_present_name && that_present_name))return false;if (!this.name.equals(that.name))return false;}boolean this_present_session_id = true;boolean that_present_session_id = true;if (this_present_session_id || that_present_session_id) {if (!(this_present_session_id && that_present_session_id))return false;if (this.session_id != that.session_id)return false;}return true;}@Overridepublic int hashCode() {return 0;}public int compareTo(Widget other) {if (!getClass().equals(other.getClass())) {return getClass().getName().compareTo(other.getClass().getName());}int lastComparison = 0;Widget typedOther = (Widget)other;lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(id, typedOther.id);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetType()).compareTo(isSetType());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(type, typedOther.type);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetCustomer_id()).compareTo(isSetCustomer_id());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(customer_id, typedOther.customer_id);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetItems()).compareTo(isSetItems());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(items, typedOther.items);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetEnabled()).compareTo(isSetEnabled());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(enabled, typedOther.enabled);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(name, typedOther.name);if (lastComparison != 0) {return lastComparison;}lastComparison = Boolean.valueOf(isSetSession_id()).compareTo(isSetSession_id());if (lastComparison != 0) {return lastComparison;}lastComparison = TBaseHelper.compareTo(session_id, typedOther.session_id);if (lastComparison != 0) {return lastComparison;}return 0;}public void read(TProtocol iprot) throws TException {TField field;iprot.readStructBegin();while (true){field = iprot.readFieldBegin();if (field.type == TType.STOP) {break;}_Fields fieldId = _Fields.findByThriftId(field.id);if (fieldId == null) {TProtocolUtil.skip(iprot, field.type);} else {switch (fieldId) {case ID:if (field.type == TType.I64) {this.id = iprot.readI64();setIdIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case TYPE:if (field.type == TType.I32) {this.type = WidgetType.findByValue(iprot.readI32());} else {TProtocolUtil.skip(iprot, field.type);}break;case CUSTOMER_ID:if (field.type == TType.I64) {this.customer_id = iprot.readI64();setCustomer_idIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case ITEMS:if (field.type == TType.LIST) {{TList _list17 = iprot.readListBegin();this.items = new ArrayList<WidgetItem>(_list17.size);for (int _i18 = 0; _i18 < _list17.size; ++_i18){WidgetItem _elem19;_elem19 = new WidgetItem();_elem19.read(iprot);this.items.add(_elem19);}iprot.readListEnd();}} else {TProtocolUtil.skip(iprot, field.type);}break;case ENABLED:if (field.type == TType.BOOL) {this.enabled = iprot.readBool();setEnabledIsSet(true);} else {TProtocolUtil.skip(iprot, field.type);}break;case NAME:if (field.type == TType.STRING) {this.name = iprot.readString();} else {TProtocolUtil.skip(iprot, field.type);}break;case SESSION_ID:if (field.type == TType.BOOL) {this.session_id = iprot.readBool();setSession_idIsSet(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.type != null) {oprot.writeFieldBegin(TYPE_FIELD_DESC);oprot.writeI32(this.type.getValue());oprot.writeFieldEnd();}oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);oprot.writeI64(this.customer_id);oprot.writeFieldEnd();if (this.items != null) {oprot.writeFieldBegin(ITEMS_FIELD_DESC);{oprot.writeListBegin(new TList(TType.STRUCT, this.items.size()));for (WidgetItem _iter20 : this.items){_iter20.write(oprot);}oprot.writeListEnd();}oprot.writeFieldEnd();}oprot.writeFieldBegin(ENABLED_FIELD_DESC);oprot.writeBool(this.enabled);oprot.writeFieldEnd();if (this.name != null) {oprot.writeFieldBegin(NAME_FIELD_DESC);oprot.writeString(this.name);oprot.writeFieldEnd();}oprot.writeFieldBegin(SESSION_ID_FIELD_DESC);oprot.writeBool(this.session_id);oprot.writeFieldEnd();oprot.writeFieldStop();oprot.writeStructEnd();}@Overridepublic String toString() {StringBuilder sb = new StringBuilder("Widget(");boolean first = true;sb.append("id:");sb.append(this.id);first = false;if (!first) sb.append(", ");sb.append("type:");if (this.type == null) {sb.append("null");} else {String type_name = type.name();if (type_name != null) {sb.append(type_name);sb.append(" (");}sb.append(this.type);if (type_name != null) {sb.append(")");}}first = false;if (!first) sb.append(", ");sb.append("customer_id:");sb.append(this.customer_id);first = false;if (!first) sb.append(", ");sb.append("items:");if (this.items == null) {sb.append("null");} else {sb.append(this.items);}first = false;if (!first) sb.append(", ");sb.append("enabled:");sb.append(this.enabled);first = false;if (!first) sb.append(", ");sb.append("name:");if (this.name == null) {sb.append("null");} else {sb.append(this.name);}first = false;if (!first) sb.append(", ");sb.append("session_id:");sb.append(this.session_id);first = false;sb.append(")");return sb.toString();}public void validate() throws TException {// check for required fields}}