/** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package edu.usc.pgroup.floe.thriftgen; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.thrift.protocol.TTupleProtocol; 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 java.util.BitSet; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; public class TChannel implements org.apache.thrift.TBase<TChannel, TChannel._Fields>, java.io.Serializable, Cloneable, Comparable<TChannel> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TChannel"); private static final org.apache.thrift.protocol.TField CHANNEL_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("channelType", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField DISPERSION_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("dispersionClass", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField LOCAL_DISPERSION_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("localDispersionClass", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField CHANNEL_ARGS_FIELD_DESC = new org.apache.thrift.protocol.TField("channelArgs", org.apache.thrift.protocol.TType.STRING, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new TChannelStandardSchemeFactory()); schemes.put(TupleScheme.class, new TChannelTupleSchemeFactory()); } private TChannelType channelType; // required private String dispersionClass; // required private String localDispersionClass; // required private String channelArgs; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { /** * * @see TChannelType */ CHANNEL_TYPE((short)1, "channelType"), DISPERSION_CLASS((short)2, "dispersionClass"), LOCAL_DISPERSION_CLASS((short)3, "localDispersionClass"), CHANNEL_ARGS((short)4, "channelArgs"); 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: // CHANNEL_TYPE return CHANNEL_TYPE; case 2: // DISPERSION_CLASS return DISPERSION_CLASS; case 3: // LOCAL_DISPERSION_CLASS return LOCAL_DISPERSION_CLASS; case 4: // CHANNEL_ARGS return CHANNEL_ARGS; 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 _Fields optionals[] = {_Fields.CHANNEL_ARGS}; 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.CHANNEL_TYPE, new org.apache.thrift.meta_data.FieldMetaData("channelType", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TChannelType.class))); tmpMap.put(_Fields.DISPERSION_CLASS, new org.apache.thrift.meta_data.FieldMetaData("dispersionClass", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.LOCAL_DISPERSION_CLASS, new org.apache.thrift.meta_data.FieldMetaData("localDispersionClass", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.CHANNEL_ARGS, new org.apache.thrift.meta_data.FieldMetaData("channelArgs", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TChannel.class, metaDataMap); } public TChannel() { } public TChannel( TChannelType channelType, String dispersionClass, String localDispersionClass) { this(); this.channelType = channelType; this.dispersionClass = dispersionClass; this.localDispersionClass = localDispersionClass; } /** * Performs a deep copy on <i>other</i>. */ public TChannel(TChannel other) { if (other.is_set_channelType()) { this.channelType = other.channelType; } if (other.is_set_dispersionClass()) { this.dispersionClass = other.dispersionClass; } if (other.is_set_localDispersionClass()) { this.localDispersionClass = other.localDispersionClass; } if (other.is_set_channelArgs()) { this.channelArgs = other.channelArgs; } } public TChannel deepCopy() { return new TChannel(this); } @Override public void clear() { this.channelType = null; this.dispersionClass = null; this.localDispersionClass = null; this.channelArgs = null; } /** * * @see TChannelType */ public TChannelType get_channelType() { return this.channelType; } /** * * @see TChannelType */ public void set_channelType(TChannelType channelType) { this.channelType = channelType; } public void unset_channelType() { this.channelType = null; } /** Returns true if field channelType is set (has been assigned a value) and false otherwise */ public boolean is_set_channelType() { return this.channelType != null; } public void set_channelType_isSet(boolean value) { if (!value) { this.channelType = null; } } public String get_dispersionClass() { return this.dispersionClass; } public void set_dispersionClass(String dispersionClass) { this.dispersionClass = dispersionClass; } public void unset_dispersionClass() { this.dispersionClass = null; } /** Returns true if field dispersionClass is set (has been assigned a value) and false otherwise */ public boolean is_set_dispersionClass() { return this.dispersionClass != null; } public void set_dispersionClass_isSet(boolean value) { if (!value) { this.dispersionClass = null; } } public String get_localDispersionClass() { return this.localDispersionClass; } public void set_localDispersionClass(String localDispersionClass) { this.localDispersionClass = localDispersionClass; } public void unset_localDispersionClass() { this.localDispersionClass = null; } /** Returns true if field localDispersionClass is set (has been assigned a value) and false otherwise */ public boolean is_set_localDispersionClass() { return this.localDispersionClass != null; } public void set_localDispersionClass_isSet(boolean value) { if (!value) { this.localDispersionClass = null; } } public String get_channelArgs() { return this.channelArgs; } public void set_channelArgs(String channelArgs) { this.channelArgs = channelArgs; } public void unset_channelArgs() { this.channelArgs = null; } /** Returns true if field channelArgs is set (has been assigned a value) and false otherwise */ public boolean is_set_channelArgs() { return this.channelArgs != null; } public void set_channelArgs_isSet(boolean value) { if (!value) { this.channelArgs = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case CHANNEL_TYPE: if (value == null) { unset_channelType(); } else { set_channelType((TChannelType)value); } break; case DISPERSION_CLASS: if (value == null) { unset_dispersionClass(); } else { set_dispersionClass((String)value); } break; case LOCAL_DISPERSION_CLASS: if (value == null) { unset_localDispersionClass(); } else { set_localDispersionClass((String)value); } break; case CHANNEL_ARGS: if (value == null) { unset_channelArgs(); } else { set_channelArgs((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case CHANNEL_TYPE: return get_channelType(); case DISPERSION_CLASS: return get_dispersionClass(); case LOCAL_DISPERSION_CLASS: return get_localDispersionClass(); case CHANNEL_ARGS: return get_channelArgs(); } 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 CHANNEL_TYPE: return is_set_channelType(); case DISPERSION_CLASS: return is_set_dispersionClass(); case LOCAL_DISPERSION_CLASS: return is_set_localDispersionClass(); case CHANNEL_ARGS: return is_set_channelArgs(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TChannel) return this.equals((TChannel)that); return false; } public boolean equals(TChannel that) { if (that == null) return false; boolean this_present_channelType = true && this.is_set_channelType(); boolean that_present_channelType = true && that.is_set_channelType(); if (this_present_channelType || that_present_channelType) { if (!(this_present_channelType && that_present_channelType)) return false; if (!this.channelType.equals(that.channelType)) return false; } boolean this_present_dispersionClass = true && this.is_set_dispersionClass(); boolean that_present_dispersionClass = true && that.is_set_dispersionClass(); if (this_present_dispersionClass || that_present_dispersionClass) { if (!(this_present_dispersionClass && that_present_dispersionClass)) return false; if (!this.dispersionClass.equals(that.dispersionClass)) return false; } boolean this_present_localDispersionClass = true && this.is_set_localDispersionClass(); boolean that_present_localDispersionClass = true && that.is_set_localDispersionClass(); if (this_present_localDispersionClass || that_present_localDispersionClass) { if (!(this_present_localDispersionClass && that_present_localDispersionClass)) return false; if (!this.localDispersionClass.equals(that.localDispersionClass)) return false; } boolean this_present_channelArgs = true && this.is_set_channelArgs(); boolean that_present_channelArgs = true && that.is_set_channelArgs(); if (this_present_channelArgs || that_present_channelArgs) { if (!(this_present_channelArgs && that_present_channelArgs)) return false; if (!this.channelArgs.equals(that.channelArgs)) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_channelType = true && (is_set_channelType()); builder.append(present_channelType); if (present_channelType) builder.append(channelType.getValue()); boolean present_dispersionClass = true && (is_set_dispersionClass()); builder.append(present_dispersionClass); if (present_dispersionClass) builder.append(dispersionClass); boolean present_localDispersionClass = true && (is_set_localDispersionClass()); builder.append(present_localDispersionClass); if (present_localDispersionClass) builder.append(localDispersionClass); boolean present_channelArgs = true && (is_set_channelArgs()); builder.append(present_channelArgs); if (present_channelArgs) builder.append(channelArgs); return builder.toHashCode(); } @Override public int compareTo(TChannel other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(is_set_channelType()).compareTo(other.is_set_channelType()); if (lastComparison != 0) { return lastComparison; } if (is_set_channelType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.channelType, other.channelType); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_dispersionClass()).compareTo(other.is_set_dispersionClass()); if (lastComparison != 0) { return lastComparison; } if (is_set_dispersionClass()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dispersionClass, other.dispersionClass); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_localDispersionClass()).compareTo(other.is_set_localDispersionClass()); if (lastComparison != 0) { return lastComparison; } if (is_set_localDispersionClass()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.localDispersionClass, other.localDispersionClass); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_channelArgs()).compareTo(other.is_set_channelArgs()); if (lastComparison != 0) { return lastComparison; } if (is_set_channelArgs()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.channelArgs, other.channelArgs); 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("TChannel("); boolean first = true; sb.append("channelType:"); if (this.channelType == null) { sb.append("null"); } else { sb.append(this.channelType); } first = false; if (!first) sb.append(", "); sb.append("dispersionClass:"); if (this.dispersionClass == null) { sb.append("null"); } else { sb.append(this.dispersionClass); } first = false; if (!first) sb.append(", "); sb.append("localDispersionClass:"); if (this.localDispersionClass == null) { sb.append("null"); } else { sb.append(this.localDispersionClass); } first = false; if (is_set_channelArgs()) { if (!first) sb.append(", "); sb.append("channelArgs:"); if (this.channelArgs == null) { sb.append("null"); } else { sb.append(this.channelArgs); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (!is_set_channelType()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'channelType' is unset! Struct:" + toString()); } if (!is_set_dispersionClass()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'dispersionClass' is unset! Struct:" + toString()); } if (!is_set_localDispersionClass()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'localDispersionClass' is unset! Struct:" + toString()); } // 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 TChannelStandardSchemeFactory implements SchemeFactory { public TChannelStandardScheme getScheme() { return new TChannelStandardScheme(); } } private static class TChannelStandardScheme extends StandardScheme<TChannel> { public void read(org.apache.thrift.protocol.TProtocol iprot, TChannel 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: // CHANNEL_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.channelType = TChannelType.findByValue(iprot.readI32()); struct.set_channelType_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // DISPERSION_CLASS if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.dispersionClass = iprot.readString(); struct.set_dispersionClass_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // LOCAL_DISPERSION_CLASS if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.localDispersionClass = iprot.readString(); struct.set_localDispersionClass_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // CHANNEL_ARGS if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.channelArgs = iprot.readString(); struct.set_channelArgs_isSet(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(); struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, TChannel struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.channelType != null) { oprot.writeFieldBegin(CHANNEL_TYPE_FIELD_DESC); oprot.writeI32(struct.channelType.getValue()); oprot.writeFieldEnd(); } if (struct.dispersionClass != null) { oprot.writeFieldBegin(DISPERSION_CLASS_FIELD_DESC); oprot.writeString(struct.dispersionClass); oprot.writeFieldEnd(); } if (struct.localDispersionClass != null) { oprot.writeFieldBegin(LOCAL_DISPERSION_CLASS_FIELD_DESC); oprot.writeString(struct.localDispersionClass); oprot.writeFieldEnd(); } if (struct.channelArgs != null) { if (struct.is_set_channelArgs()) { oprot.writeFieldBegin(CHANNEL_ARGS_FIELD_DESC); oprot.writeString(struct.channelArgs); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class TChannelTupleSchemeFactory implements SchemeFactory { public TChannelTupleScheme getScheme() { return new TChannelTupleScheme(); } } private static class TChannelTupleScheme extends TupleScheme<TChannel> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TChannel struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.channelType.getValue()); oprot.writeString(struct.dispersionClass); oprot.writeString(struct.localDispersionClass); BitSet optionals = new BitSet(); if (struct.is_set_channelArgs()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.is_set_channelArgs()) { oprot.writeString(struct.channelArgs); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TChannel struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.channelType = TChannelType.findByValue(iprot.readI32()); struct.set_channelType_isSet(true); struct.dispersionClass = iprot.readString(); struct.set_dispersionClass_isSet(true); struct.localDispersionClass = iprot.readString(); struct.set_localDispersionClass_isSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.channelArgs = iprot.readString(); struct.set_channelArgs_isSet(true); } } } }