/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package mythrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
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 DataPackage implements org.apache.thrift.TBase<DataPackage, DataPackage._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DataPackage");
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 NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)4);
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)5);
private static final org.apache.thrift.protocol.TField KEYWORDS_FIELD_DESC = new org.apache.thrift.protocol.TField("keywords", org.apache.thrift.protocol.TType.SET, (short)6);
private static final org.apache.thrift.protocol.TField WORDS_FIELD_DESC = new org.apache.thrift.protocol.TField("words", org.apache.thrift.protocol.TType.LIST, (short)7);
private static final org.apache.thrift.protocol.TField PROPS_FIELD_DESC = new org.apache.thrift.protocol.TField("props", org.apache.thrift.protocol.TType.MAP, (short)8);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new DataPackageStandardSchemeFactory());
schemes.put(TupleScheme.class, new DataPackageTupleSchemeFactory());
}
public long id; // required
public String name; // required
/**
*
* @see DataType
*/
public DataType type; // required
public int version; // required
public long timestamp; // required
public Set<String> keywords; // required
public List<String> words; // required
public Map<String,String> props; // 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"),
NAME((short)2, "name"),
/**
*
* @see DataType
*/
TYPE((short)3, "type"),
VERSION((short)4, "version"),
TIMESTAMP((short)5, "timestamp"),
KEYWORDS((short)6, "keywords"),
WORDS((short)7, "words"),
PROPS((short)8, "props");
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: // ID
return ID;
case 2: // NAME
return NAME;
case 3: // TYPE
return TYPE;
case 4: // VERSION
return VERSION;
case 5: // TIMESTAMP
return TIMESTAMP;
case 6: // KEYWORDS
return KEYWORDS;
case 7: // WORDS
return WORDS;
case 8: // PROPS
return PROPS;
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 assignments
private static final int __ID_ISSET_ID = 0;
private static final int __VERSION_ISSET_ID = 1;
private static final int __TIMESTAMP_ISSET_ID = 2;
private byte __isset_bitfield = 0;
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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DataType.class)));
tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.KEYWORDS, new org.apache.thrift.meta_data.FieldMetaData("keywords", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.WORDS, new org.apache.thrift.meta_data.FieldMetaData("words", 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.STRING))));
tmpMap.put(_Fields.PROPS, new org.apache.thrift.meta_data.FieldMetaData("props", 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.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DataPackage.class, metaDataMap);
}
public DataPackage() {
}
public DataPackage(
long id,
String name,
DataType type,
int version,
long timestamp,
Set<String> keywords,
List<String> words,
Map<String,String> props)
{
this();
this.id = id;
setIdIsSet(true);
this.name = name;
this.type = type;
this.version = version;
setVersionIsSet(true);
this.timestamp = timestamp;
setTimestampIsSet(true);
this.keywords = keywords;
this.words = words;
this.props = props;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public DataPackage(DataPackage other) {
__isset_bitfield = other.__isset_bitfield;
this.id = other.id;
if (other.isSetName()) {
this.name = other.name;
}
if (other.isSetType()) {
this.type = other.type;
}
this.version = other.version;
this.timestamp = other.timestamp;
if (other.isSetKeywords()) {
Set<String> __this__keywords = new HashSet<String>();
for (String other_element : other.keywords) {
__this__keywords.add(other_element);
}
this.keywords = __this__keywords;
}
if (other.isSetWords()) {
List<String> __this__words = new ArrayList<String>();
for (String other_element : other.words) {
__this__words.add(other_element);
}
this.words = __this__words;
}
if (other.isSetProps()) {
Map<String,String> __this__props = new HashMap<String,String>();
for (Map.Entry<String, String> other_element : other.props.entrySet()) {
String other_element_key = other_element.getKey();
String other_element_value = other_element.getValue();
String __this__props_copy_key = other_element_key;
String __this__props_copy_value = other_element_value;
__this__props.put(__this__props_copy_key, __this__props_copy_value);
}
this.props = __this__props;
}
}
public DataPackage deepCopy() {
return new DataPackage(this);
}
@Override
public void clear() {
setIdIsSet(false);
this.id = 0;
this.name = null;
this.type = null;
setVersionIsSet(false);
this.version = 0;
setTimestampIsSet(false);
this.timestamp = 0;
this.keywords = null;
this.words = null;
this.props = null;
}
public long getId() {
return this.id;
}
public DataPackage setId(long id) {
this.id = id;
setIdIsSet(true);
return this;
}
public void unsetId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
}
/** Returns true if field id is set (has been assigned a value) and false otherwise */
public boolean isSetId() {
return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
}
public void setIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
}
public String getName() {
return this.name;
}
public DataPackage setName(String name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
/**
*
* @see DataType
*/
public DataType getType() {
return this.type;
}
/**
*
* @see DataType
*/
public DataPackage setType(DataType type) {
this.type = type;
return this;
}
public void unsetType() {
this.type = null;
}
/** Returns true if field type is set (has been assigned a value) and false otherwise */
public boolean isSetType() {
return this.type != null;
}
public void setTypeIsSet(boolean value) {
if (!value) {
this.type = null;
}
}
public int getVersion() {
return this.version;
}
public DataPackage setVersion(int version) {
this.version = version;
setVersionIsSet(true);
return this;
}
public void unsetVersion() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
}
public void setVersionIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
}
public long getTimestamp() {
return this.timestamp;
}
public DataPackage setTimestamp(long timestamp) {
this.timestamp = timestamp;
setTimestampIsSet(true);
return this;
}
public void unsetTimestamp() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
public int getKeywordsSize() {
return (this.keywords == null) ? 0 : this.keywords.size();
}
public java.util.Iterator<String> getKeywordsIterator() {
return (this.keywords == null) ? null : this.keywords.iterator();
}
public void addToKeywords(String elem) {
if (this.keywords == null) {
this.keywords = new HashSet<String>();
}
this.keywords.add(elem);
}
public Set<String> getKeywords() {
return this.keywords;
}
public DataPackage setKeywords(Set<String> keywords) {
this.keywords = keywords;
return this;
}
public void unsetKeywords() {
this.keywords = null;
}
/** Returns true if field keywords is set (has been assigned a value) and false otherwise */
public boolean isSetKeywords() {
return this.keywords != null;
}
public void setKeywordsIsSet(boolean value) {
if (!value) {
this.keywords = null;
}
}
public int getWordsSize() {
return (this.words == null) ? 0 : this.words.size();
}
public java.util.Iterator<String> getWordsIterator() {
return (this.words == null) ? null : this.words.iterator();
}
public void addToWords(String elem) {
if (this.words == null) {
this.words = new ArrayList<String>();
}
this.words.add(elem);
}
public List<String> getWords() {
return this.words;
}
public DataPackage setWords(List<String> words) {
this.words = words;
return this;
}
public void unsetWords() {
this.words = null;
}
/** Returns true if field words is set (has been assigned a value) and false otherwise */
public boolean isSetWords() {
return this.words != null;
}
public void setWordsIsSet(boolean value) {
if (!value) {
this.words = null;
}
}
public int getPropsSize() {
return (this.props == null) ? 0 : this.props.size();
}
public void putToProps(String key, String val) {
if (this.props == null) {
this.props = new HashMap<String,String>();
}
this.props.put(key, val);
}
public Map<String,String> getProps() {
return this.props;
}
public DataPackage setProps(Map<String,String> props) {
this.props = props;
return this;
}
public void unsetProps() {
this.props = null;
}
/** Returns true if field props is set (has been assigned a value) and false otherwise */
public boolean isSetProps() {
return this.props != null;
}
public void setPropsIsSet(boolean value) {
if (!value) {
this.props = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ID:
if (value == null) {
unsetId();
} else {
setId((Long)value);
}
break;
case NAME:
if (value == null) {
unsetName();
} else {
setName((String)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((DataType)value);
}
break;
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((Integer)value);
}
break;
case TIMESTAMP:
if (value == null) {
unsetTimestamp();
} else {
setTimestamp((Long)value);
}
break;
case KEYWORDS:
if (value == null) {
unsetKeywords();
} else {
setKeywords((Set<String>)value);
}
break;
case WORDS:
if (value == null) {
unsetWords();
} else {
setWords((List<String>)value);
}
break;
case PROPS:
if (value == null) {
unsetProps();
} else {
setProps((Map<String,String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ID:
return Long.valueOf(getId());
case NAME:
return getName();
case TYPE:
return getType();
case VERSION:
return Integer.valueOf(getVersion());
case TIMESTAMP:
return Long.valueOf(getTimestamp());
case KEYWORDS:
return getKeywords();
case WORDS:
return getWords();
case PROPS:
return getProps();
}
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 NAME:
return isSetName();
case TYPE:
return isSetType();
case VERSION:
return isSetVersion();
case TIMESTAMP:
return isSetTimestamp();
case KEYWORDS:
return isSetKeywords();
case WORDS:
return isSetWords();
case PROPS:
return isSetProps();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof DataPackage)
return this.equals((DataPackage)that);
return false;
}
public boolean equals(DataPackage 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_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_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_version = true;
boolean that_present_version = true;
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (this.version != that.version)
return false;
}
boolean this_present_timestamp = true;
boolean that_present_timestamp = true;
if (this_present_timestamp || that_present_timestamp) {
if (!(this_present_timestamp && that_present_timestamp))
return false;
if (this.timestamp != that.timestamp)
return false;
}
boolean this_present_keywords = true && this.isSetKeywords();
boolean that_present_keywords = true && that.isSetKeywords();
if (this_present_keywords || that_present_keywords) {
if (!(this_present_keywords && that_present_keywords))
return false;
if (!this.keywords.equals(that.keywords))
return false;
}
boolean this_present_words = true && this.isSetWords();
boolean that_present_words = true && that.isSetWords();
if (this_present_words || that_present_words) {
if (!(this_present_words && that_present_words))
return false;
if (!this.words.equals(that.words))
return false;
}
boolean this_present_props = true && this.isSetProps();
boolean that_present_props = true && that.isSetProps();
if (this_present_props || that_present_props) {
if (!(this_present_props && that_present_props))
return false;
if (!this.props.equals(that.props))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(DataPackage other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
DataPackage typedOther = (DataPackage)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(isSetName()).compareTo(typedOther.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetVersion()).compareTo(typedOther.isSetVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, typedOther.version);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetKeywords()).compareTo(typedOther.isSetKeywords());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetKeywords()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.keywords, typedOther.keywords);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetWords()).compareTo(typedOther.isSetWords());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWords()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.words, typedOther.words);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetProps()).compareTo(typedOther.isSetProps());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetProps()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.props, typedOther.props);
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 {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("DataPackage(");
boolean first = true;
sb.append("id:");
sb.append(this.id);
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("type:");
if (this.type == null) {
sb.append("null");
} else {
sb.append(this.type);
}
first = false;
if (!first) sb.append(", ");
sb.append("version:");
sb.append(this.version);
first = false;
if (!first) sb.append(", ");
sb.append("timestamp:");
sb.append(this.timestamp);
first = false;
if (!first) sb.append(", ");
sb.append("keywords:");
if (this.keywords == null) {
sb.append("null");
} else {
sb.append(this.keywords);
}
first = false;
if (!first) sb.append(", ");
sb.append("words:");
if (this.words == null) {
sb.append("null");
} else {
sb.append(this.words);
}
first = false;
if (!first) sb.append(", ");
sb.append("props:");
if (this.props == null) {
sb.append("null");
} else {
sb.append(this.props);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
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_bitfield = 0;
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);
}
}
private static class DataPackageStandardSchemeFactory implements SchemeFactory {
public DataPackageStandardScheme getScheme() {
return new DataPackageStandardScheme();
}
}
private static class DataPackageStandardScheme extends StandardScheme<DataPackage> {
public void read(org.apache.thrift.protocol.TProtocol iprot, DataPackage struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = DataType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.version = iprot.readI32();
struct.setVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // TIMESTAMP
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // KEYWORDS
if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
{
org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin();
struct.keywords = new HashSet<String>(2*_set0.size);
for (int _i1 = 0; _i1 < _set0.size; ++_i1)
{
String _elem2; // required
_elem2 = iprot.readString();
struct.keywords.add(_elem2);
}
iprot.readSetEnd();
}
struct.setKeywordsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // WORDS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
struct.words = new ArrayList<String>(_list3.size);
for (int _i4 = 0; _i4 < _list3.size; ++_i4)
{
String _elem5; // required
_elem5 = iprot.readString();
struct.words.add(_elem5);
}
iprot.readListEnd();
}
struct.setWordsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // PROPS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map6 = iprot.readMapBegin();
struct.props = new HashMap<String,String>(2*_map6.size);
for (int _i7 = 0; _i7 < _map6.size; ++_i7)
{
String _key8; // required
String _val9; // required
_key8 = iprot.readString();
_val9 = iprot.readString();
struct.props.put(_key8, _val9);
}
iprot.readMapEnd();
}
struct.setPropsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, DataPackage struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(ID_FIELD_DESC);
oprot.writeI64(struct.id);
oprot.writeFieldEnd();
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
if (struct.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(struct.type.getValue());
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeI32(struct.version);
oprot.writeFieldEnd();
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
if (struct.keywords != null) {
oprot.writeFieldBegin(KEYWORDS_FIELD_DESC);
{
oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.keywords.size()));
for (String _iter10 : struct.keywords)
{
oprot.writeString(_iter10);
}
oprot.writeSetEnd();
}
oprot.writeFieldEnd();
}
if (struct.words != null) {
oprot.writeFieldBegin(WORDS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.words.size()));
for (String _iter11 : struct.words)
{
oprot.writeString(_iter11);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.props != null) {
oprot.writeFieldBegin(PROPS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.props.size()));
for (Map.Entry<String, String> _iter12 : struct.props.entrySet())
{
oprot.writeString(_iter12.getKey());
oprot.writeString(_iter12.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class DataPackageTupleSchemeFactory implements SchemeFactory {
public DataPackageTupleScheme getScheme() {
return new DataPackageTupleScheme();
}
}
private static class DataPackageTupleScheme extends TupleScheme<DataPackage> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, DataPackage struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetId()) {
optionals.set(0);
}
if (struct.isSetName()) {
optionals.set(1);
}
if (struct.isSetType()) {
optionals.set(2);
}
if (struct.isSetVersion()) {
optionals.set(3);
}
if (struct.isSetTimestamp()) {
optionals.set(4);
}
if (struct.isSetKeywords()) {
optionals.set(5);
}
if (struct.isSetWords()) {
optionals.set(6);
}
if (struct.isSetProps()) {
optionals.set(7);
}
oprot.writeBitSet(optionals, 8);
if (struct.isSetId()) {
oprot.writeI64(struct.id);
}
if (struct.isSetName()) {
oprot.writeString(struct.name);
}
if (struct.isSetType()) {
oprot.writeI32(struct.type.getValue());
}
if (struct.isSetVersion()) {
oprot.writeI32(struct.version);
}
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
if (struct.isSetKeywords()) {
{
oprot.writeI32(struct.keywords.size());
for (String _iter13 : struct.keywords)
{
oprot.writeString(_iter13);
}
}
}
if (struct.isSetWords()) {
{
oprot.writeI32(struct.words.size());
for (String _iter14 : struct.words)
{
oprot.writeString(_iter14);
}
}
}
if (struct.isSetProps()) {
{
oprot.writeI32(struct.props.size());
for (Map.Entry<String, String> _iter15 : struct.props.entrySet())
{
oprot.writeString(_iter15.getKey());
oprot.writeString(_iter15.getValue());
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, DataPackage struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(8);
if (incoming.get(0)) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
}
if (incoming.get(1)) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
}
if (incoming.get(2)) {
struct.type = DataType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
}
if (incoming.get(3)) {
struct.version = iprot.readI32();
struct.setVersionIsSet(true);
}
if (incoming.get(4)) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
}
if (incoming.get(5)) {
{
org.apache.thrift.protocol.TSet _set16 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.keywords = new HashSet<String>(2*_set16.size);
for (int _i17 = 0; _i17 < _set16.size; ++_i17)
{
String _elem18; // required
_elem18 = iprot.readString();
struct.keywords.add(_elem18);
}
}
struct.setKeywordsIsSet(true);
}
if (incoming.get(6)) {
{
org.apache.thrift.protocol.TList _list19 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.words = new ArrayList<String>(_list19.size);
for (int _i20 = 0; _i20 < _list19.size; ++_i20)
{
String _elem21; // required
_elem21 = iprot.readString();
struct.words.add(_elem21);
}
}
struct.setWordsIsSet(true);
}
if (incoming.get(7)) {
{
org.apache.thrift.protocol.TMap _map22 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.props = new HashMap<String,String>(2*_map22.size);
for (int _i23 = 0; _i23 < _map22.size; ++_i23)
{
String _key24; // required
String _val25; // required
_key24 = iprot.readString();
_val25 = iprot.readString();
struct.props.put(_key24, _val25);
}
}
struct.setPropsIsSet(true);
}
}
}
}