http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java ---------------------------------------------------------------------- diff --git a/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java b/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java new file mode 100644 index 0000000..f4347b4 --- /dev/null +++ b/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java @@ -0,0 +1,664 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.blur.thrift.generated; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +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 AnalyzerType implements org.apache.thrift.TBase<AnalyzerType, AnalyzerType._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AnalyzerType"); + + private static final org.apache.thrift.protocol.TField FIELD_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fieldName", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CLASS_DEFINITION_FIELD_DESC = new org.apache.thrift.protocol.TField("classDefinition", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField ANALYZER_SUB_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("analyzerSubTypes", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new AnalyzerTypeStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AnalyzerTypeTupleSchemeFactory()); + } + + public String fieldName; // required + public ClassDefinition classDefinition; // required + public List<AnalyzerSubType> analyzerSubTypes; // 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 { + FIELD_NAME((short)1, "fieldName"), + CLASS_DEFINITION((short)2, "classDefinition"), + ANALYZER_SUB_TYPES((short)3, "analyzerSubTypes"); + + 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: // FIELD_NAME + return FIELD_NAME; + case 2: // CLASS_DEFINITION + return CLASS_DEFINITION; + case 3: // ANALYZER_SUB_TYPES + return ANALYZER_SUB_TYPES; + 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 + 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.FIELD_NAME, new org.apache.thrift.meta_data.FieldMetaData("fieldName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CLASS_DEFINITION, new org.apache.thrift.meta_data.FieldMetaData("classDefinition", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ClassDefinition.class))); + tmpMap.put(_Fields.ANALYZER_SUB_TYPES, new org.apache.thrift.meta_data.FieldMetaData("analyzerSubTypes", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AnalyzerSubType.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AnalyzerType.class, metaDataMap); + } + + public AnalyzerType() { + } + + public AnalyzerType( + String fieldName, + ClassDefinition classDefinition, + List<AnalyzerSubType> analyzerSubTypes) + { + this(); + this.fieldName = fieldName; + this.classDefinition = classDefinition; + this.analyzerSubTypes = analyzerSubTypes; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public AnalyzerType(AnalyzerType other) { + if (other.isSetFieldName()) { + this.fieldName = other.fieldName; + } + if (other.isSetClassDefinition()) { + this.classDefinition = new ClassDefinition(other.classDefinition); + } + if (other.isSetAnalyzerSubTypes()) { + List<AnalyzerSubType> __this__analyzerSubTypes = new ArrayList<AnalyzerSubType>(); + for (AnalyzerSubType other_element : other.analyzerSubTypes) { + __this__analyzerSubTypes.add(new AnalyzerSubType(other_element)); + } + this.analyzerSubTypes = __this__analyzerSubTypes; + } + } + + public AnalyzerType deepCopy() { + return new AnalyzerType(this); + } + + @Override + public void clear() { + this.fieldName = null; + this.classDefinition = null; + this.analyzerSubTypes = null; + } + + public String getFieldName() { + return this.fieldName; + } + + public AnalyzerType setFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public void unsetFieldName() { + this.fieldName = null; + } + + /** Returns true if field fieldName is set (has been assigned a value) and false otherwise */ + public boolean isSetFieldName() { + return this.fieldName != null; + } + + public void setFieldNameIsSet(boolean value) { + if (!value) { + this.fieldName = null; + } + } + + public ClassDefinition getClassDefinition() { + return this.classDefinition; + } + + public AnalyzerType setClassDefinition(ClassDefinition classDefinition) { + this.classDefinition = classDefinition; + return this; + } + + public void unsetClassDefinition() { + this.classDefinition = null; + } + + /** Returns true if field classDefinition is set (has been assigned a value) and false otherwise */ + public boolean isSetClassDefinition() { + return this.classDefinition != null; + } + + public void setClassDefinitionIsSet(boolean value) { + if (!value) { + this.classDefinition = null; + } + } + + public int getAnalyzerSubTypesSize() { + return (this.analyzerSubTypes == null) ? 0 : this.analyzerSubTypes.size(); + } + + public java.util.Iterator<AnalyzerSubType> getAnalyzerSubTypesIterator() { + return (this.analyzerSubTypes == null) ? null : this.analyzerSubTypes.iterator(); + } + + public void addToAnalyzerSubTypes(AnalyzerSubType elem) { + if (this.analyzerSubTypes == null) { + this.analyzerSubTypes = new ArrayList<AnalyzerSubType>(); + } + this.analyzerSubTypes.add(elem); + } + + public List<AnalyzerSubType> getAnalyzerSubTypes() { + return this.analyzerSubTypes; + } + + public AnalyzerType setAnalyzerSubTypes(List<AnalyzerSubType> analyzerSubTypes) { + this.analyzerSubTypes = analyzerSubTypes; + return this; + } + + public void unsetAnalyzerSubTypes() { + this.analyzerSubTypes = null; + } + + /** Returns true if field analyzerSubTypes is set (has been assigned a value) and false otherwise */ + public boolean isSetAnalyzerSubTypes() { + return this.analyzerSubTypes != null; + } + + public void setAnalyzerSubTypesIsSet(boolean value) { + if (!value) { + this.analyzerSubTypes = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case FIELD_NAME: + if (value == null) { + unsetFieldName(); + } else { + setFieldName((String)value); + } + break; + + case CLASS_DEFINITION: + if (value == null) { + unsetClassDefinition(); + } else { + setClassDefinition((ClassDefinition)value); + } + break; + + case ANALYZER_SUB_TYPES: + if (value == null) { + unsetAnalyzerSubTypes(); + } else { + setAnalyzerSubTypes((List<AnalyzerSubType>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case FIELD_NAME: + return getFieldName(); + + case CLASS_DEFINITION: + return getClassDefinition(); + + case ANALYZER_SUB_TYPES: + return getAnalyzerSubTypes(); + + } + 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 FIELD_NAME: + return isSetFieldName(); + case CLASS_DEFINITION: + return isSetClassDefinition(); + case ANALYZER_SUB_TYPES: + return isSetAnalyzerSubTypes(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof AnalyzerType) + return this.equals((AnalyzerType)that); + return false; + } + + public boolean equals(AnalyzerType that) { + if (that == null) + return false; + + boolean this_present_fieldName = true && this.isSetFieldName(); + boolean that_present_fieldName = true && that.isSetFieldName(); + if (this_present_fieldName || that_present_fieldName) { + if (!(this_present_fieldName && that_present_fieldName)) + return false; + if (!this.fieldName.equals(that.fieldName)) + return false; + } + + boolean this_present_classDefinition = true && this.isSetClassDefinition(); + boolean that_present_classDefinition = true && that.isSetClassDefinition(); + if (this_present_classDefinition || that_present_classDefinition) { + if (!(this_present_classDefinition && that_present_classDefinition)) + return false; + if (!this.classDefinition.equals(that.classDefinition)) + return false; + } + + boolean this_present_analyzerSubTypes = true && this.isSetAnalyzerSubTypes(); + boolean that_present_analyzerSubTypes = true && that.isSetAnalyzerSubTypes(); + if (this_present_analyzerSubTypes || that_present_analyzerSubTypes) { + if (!(this_present_analyzerSubTypes && that_present_analyzerSubTypes)) + return false; + if (!this.analyzerSubTypes.equals(that.analyzerSubTypes)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(AnalyzerType other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + AnalyzerType typedOther = (AnalyzerType)other; + + lastComparison = Boolean.valueOf(isSetFieldName()).compareTo(typedOther.isSetFieldName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFieldName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fieldName, typedOther.fieldName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetClassDefinition()).compareTo(typedOther.isSetClassDefinition()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetClassDefinition()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.classDefinition, typedOther.classDefinition); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAnalyzerSubTypes()).compareTo(typedOther.isSetAnalyzerSubTypes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAnalyzerSubTypes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.analyzerSubTypes, typedOther.analyzerSubTypes); + 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("AnalyzerType("); + boolean first = true; + + sb.append("fieldName:"); + if (this.fieldName == null) { + sb.append("null"); + } else { + sb.append(this.fieldName); + } + first = false; + if (!first) sb.append(", "); + sb.append("classDefinition:"); + if (this.classDefinition == null) { + sb.append("null"); + } else { + sb.append(this.classDefinition); + } + first = false; + if (!first) sb.append(", "); + sb.append("analyzerSubTypes:"); + if (this.analyzerSubTypes == null) { + sb.append("null"); + } else { + sb.append(this.analyzerSubTypes); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (classDefinition != null) { + classDefinition.validate(); + } + } + + 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 { + 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 AnalyzerTypeStandardSchemeFactory implements SchemeFactory { + public AnalyzerTypeStandardScheme getScheme() { + return new AnalyzerTypeStandardScheme(); + } + } + + private static class AnalyzerTypeStandardScheme extends StandardScheme<AnalyzerType> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, AnalyzerType 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: // FIELD_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.fieldName = iprot.readString(); + struct.setFieldNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CLASS_DEFINITION + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.classDefinition = new ClassDefinition(); + struct.classDefinition.read(iprot); + struct.setClassDefinitionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // ANALYZER_SUB_TYPES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list38 = iprot.readListBegin(); + struct.analyzerSubTypes = new ArrayList<AnalyzerSubType>(_list38.size); + for (int _i39 = 0; _i39 < _list38.size; ++_i39) + { + AnalyzerSubType _elem40; // required + _elem40 = new AnalyzerSubType(); + _elem40.read(iprot); + struct.analyzerSubTypes.add(_elem40); + } + iprot.readListEnd(); + } + struct.setAnalyzerSubTypesIsSet(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, AnalyzerType struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.fieldName != null) { + oprot.writeFieldBegin(FIELD_NAME_FIELD_DESC); + oprot.writeString(struct.fieldName); + oprot.writeFieldEnd(); + } + if (struct.classDefinition != null) { + oprot.writeFieldBegin(CLASS_DEFINITION_FIELD_DESC); + struct.classDefinition.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.analyzerSubTypes != null) { + oprot.writeFieldBegin(ANALYZER_SUB_TYPES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.analyzerSubTypes.size())); + for (AnalyzerSubType _iter41 : struct.analyzerSubTypes) + { + _iter41.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class AnalyzerTypeTupleSchemeFactory implements SchemeFactory { + public AnalyzerTypeTupleScheme getScheme() { + return new AnalyzerTypeTupleScheme(); + } + } + + private static class AnalyzerTypeTupleScheme extends TupleScheme<AnalyzerType> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, AnalyzerType struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetFieldName()) { + optionals.set(0); + } + if (struct.isSetClassDefinition()) { + optionals.set(1); + } + if (struct.isSetAnalyzerSubTypes()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetFieldName()) { + oprot.writeString(struct.fieldName); + } + if (struct.isSetClassDefinition()) { + struct.classDefinition.write(oprot); + } + if (struct.isSetAnalyzerSubTypes()) { + { + oprot.writeI32(struct.analyzerSubTypes.size()); + for (AnalyzerSubType _iter42 : struct.analyzerSubTypes) + { + _iter42.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, AnalyzerType struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.fieldName = iprot.readString(); + struct.setFieldNameIsSet(true); + } + if (incoming.get(1)) { + struct.classDefinition = new ClassDefinition(); + struct.classDefinition.read(iprot); + struct.setClassDefinitionIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list43 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.analyzerSubTypes = new ArrayList<AnalyzerSubType>(_list43.size); + for (int _i44 = 0; _i44 < _list43.size; ++_i44) + { + AnalyzerSubType _elem45; // required + _elem45 = new AnalyzerSubType(); + _elem45.read(iprot); + struct.analyzerSubTypes.add(_elem45); + } + } + struct.setAnalyzerSubTypesIsSet(true); + } + } + } + +} +
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/interface/gen-java/org/apache/blur/thrift/generated/Attribute.java ---------------------------------------------------------------------- diff --git a/interface/gen-java/org/apache/blur/thrift/generated/Attribute.java b/interface/gen-java/org/apache/blur/thrift/generated/Attribute.java deleted file mode 100644 index 715e283..0000000 --- a/interface/gen-java/org/apache/blur/thrift/generated/Attribute.java +++ /dev/null @@ -1,632 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package org.apache.blur.thrift.generated; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -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 Attribute implements org.apache.thrift.TBase<Attribute, Attribute._Fields>, java.io.Serializable, Cloneable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Attribute"); - - 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)1); - private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new AttributeStandardSchemeFactory()); - schemes.put(TupleScheme.class, new AttributeTupleSchemeFactory()); - } - - public String name; // required - public ByteBuffer value; // required - /** - * - * @see TYPE - */ - public TYPE type; // 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 { - NAME((short)1, "name"), - VALUE((short)2, "value"), - /** - * - * @see TYPE - */ - TYPE((short)3, "type"); - - 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: // NAME - return NAME; - case 2: // VALUE - return VALUE; - case 3: // TYPE - return TYPE; - 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 - 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.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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); - 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, TYPE.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Attribute.class, metaDataMap); - } - - public Attribute() { - } - - public Attribute( - String name, - ByteBuffer value, - TYPE type) - { - this(); - this.name = name; - this.value = value; - this.type = type; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public Attribute(Attribute other) { - if (other.isSetName()) { - this.name = other.name; - } - if (other.isSetValue()) { - this.value = org.apache.thrift.TBaseHelper.copyBinary(other.value); -; - } - if (other.isSetType()) { - this.type = other.type; - } - } - - public Attribute deepCopy() { - return new Attribute(this); - } - - @Override - public void clear() { - this.name = null; - this.value = null; - this.type = null; - } - - public String getName() { - return this.name; - } - - public Attribute 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; - } - } - - public byte[] getValue() { - setValue(org.apache.thrift.TBaseHelper.rightSize(value)); - return value == null ? null : value.array(); - } - - public ByteBuffer bufferForValue() { - return value; - } - - public Attribute setValue(byte[] value) { - setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value)); - return this; - } - - public Attribute setValue(ByteBuffer value) { - this.value = value; - return this; - } - - public void unsetValue() { - this.value = null; - } - - /** Returns true if field value is set (has been assigned a value) and false otherwise */ - public boolean isSetValue() { - return this.value != null; - } - - public void setValueIsSet(boolean value) { - if (!value) { - this.value = null; - } - } - - /** - * - * @see TYPE - */ - public TYPE getType() { - return this.type; - } - - /** - * - * @see TYPE - */ - public Attribute setType(TYPE 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 void setFieldValue(_Fields field, Object value) { - switch (field) { - case NAME: - if (value == null) { - unsetName(); - } else { - setName((String)value); - } - break; - - case VALUE: - if (value == null) { - unsetValue(); - } else { - setValue((ByteBuffer)value); - } - break; - - case TYPE: - if (value == null) { - unsetType(); - } else { - setType((TYPE)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case NAME: - return getName(); - - case VALUE: - return getValue(); - - case TYPE: - return getType(); - - } - 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 NAME: - return isSetName(); - case VALUE: - return isSetValue(); - case TYPE: - return isSetType(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof Attribute) - return this.equals((Attribute)that); - return false; - } - - public boolean equals(Attribute that) { - if (that == null) - 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_value = true && this.isSetValue(); - boolean that_present_value = true && that.isSetValue(); - if (this_present_value || that_present_value) { - if (!(this_present_value && that_present_value)) - return false; - if (!this.value.equals(that.value)) - 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; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(Attribute other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - Attribute typedOther = (Attribute)other; - - 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(isSetValue()).compareTo(typedOther.isSetValue()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetValue()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value); - 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; - } - } - 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("Attribute("); - boolean first = true; - - sb.append("name:"); - if (this.name == null) { - sb.append("null"); - } else { - sb.append(this.name); - } - first = false; - if (!first) sb.append(", "); - sb.append("value:"); - if (this.value == null) { - sb.append("null"); - } else { - org.apache.thrift.TBaseHelper.toString(this.value, sb); - } - first = false; - if (!first) sb.append(", "); - sb.append("type:"); - if (this.type == null) { - sb.append("null"); - } else { - sb.append(this.type); - } - 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 { - 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 AttributeStandardSchemeFactory implements SchemeFactory { - public AttributeStandardScheme getScheme() { - return new AttributeStandardScheme(); - } - } - - private static class AttributeStandardScheme extends StandardScheme<Attribute> { - - public void read(org.apache.thrift.protocol.TProtocol iprot, Attribute 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: // 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 2: // VALUE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.value = iprot.readBinary(); - struct.setValueIsSet(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 = TYPE.findByValue(iprot.readI32()); - struct.setTypeIsSet(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, Attribute struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(struct.name); - oprot.writeFieldEnd(); - } - if (struct.value != null) { - oprot.writeFieldBegin(VALUE_FIELD_DESC); - oprot.writeBinary(struct.value); - oprot.writeFieldEnd(); - } - if (struct.type != null) { - oprot.writeFieldBegin(TYPE_FIELD_DESC); - oprot.writeI32(struct.type.getValue()); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AttributeTupleSchemeFactory implements SchemeFactory { - public AttributeTupleScheme getScheme() { - return new AttributeTupleScheme(); - } - } - - private static class AttributeTupleScheme extends TupleScheme<Attribute> { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, Attribute struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetName()) { - optionals.set(0); - } - if (struct.isSetValue()) { - optionals.set(1); - } - if (struct.isSetType()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetName()) { - oprot.writeString(struct.name); - } - if (struct.isSetValue()) { - oprot.writeBinary(struct.value); - } - if (struct.isSetType()) { - oprot.writeI32(struct.type.getValue()); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, Attribute struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); - } - if (incoming.get(1)) { - struct.value = iprot.readBinary(); - struct.setValueIsSet(true); - } - if (incoming.get(2)) { - struct.type = TYPE.findByValue(iprot.readI32()); - struct.setTypeIsSet(true); - } - } - } - -} -
