| /** |
| * Autogenerated by Thrift Compiler (0.9.2) |
| * |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| * @generated |
| */ |
| package backtype.storm.generated; |
| |
| 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 org.apache.thrift.async.AsyncMethodCallback; |
| import org.apache.thrift.server.AbstractNonblockingServer.*; |
| 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 javax.annotation.Generated; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) |
| @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-20") |
| public class NimbusStat implements org.apache.thrift.TBase<NimbusStat, NimbusStat._Fields>, java.io.Serializable, Cloneable, Comparable<NimbusStat> { |
| private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NimbusStat"); |
| |
| private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1); |
| private static final org.apache.thrift.protocol.TField UPTIME_SECS_FIELD_DESC = new org.apache.thrift.protocol.TField("uptimeSecs", org.apache.thrift.protocol.TType.STRING, (short)2); |
| |
| private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); |
| static { |
| schemes.put(StandardScheme.class, new NimbusStatStandardSchemeFactory()); |
| schemes.put(TupleScheme.class, new NimbusStatTupleSchemeFactory()); |
| } |
| |
| private String host; // required |
| private String uptimeSecs; // 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 { |
| HOST((short)1, "host"), |
| UPTIME_SECS((short)2, "uptimeSecs"); |
| |
| 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: // HOST |
| return HOST; |
| case 2: // UPTIME_SECS |
| return UPTIME_SECS; |
| 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.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.REQUIRED, |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); |
| tmpMap.put(_Fields.UPTIME_SECS, new org.apache.thrift.meta_data.FieldMetaData("uptimeSecs", org.apache.thrift.TFieldRequirementType.REQUIRED, |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); |
| metaDataMap = Collections.unmodifiableMap(tmpMap); |
| org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NimbusStat.class, metaDataMap); |
| } |
| |
| public NimbusStat() { |
| } |
| |
| public NimbusStat( |
| String host, |
| String uptimeSecs) |
| { |
| this(); |
| this.host = host; |
| this.uptimeSecs = uptimeSecs; |
| } |
| |
| /** |
| * Performs a deep copy on <i>other</i>. |
| */ |
| public NimbusStat(NimbusStat other) { |
| if (other.is_set_host()) { |
| this.host = other.host; |
| } |
| if (other.is_set_uptimeSecs()) { |
| this.uptimeSecs = other.uptimeSecs; |
| } |
| } |
| |
| public NimbusStat deepCopy() { |
| return new NimbusStat(this); |
| } |
| |
| @Override |
| public void clear() { |
| this.host = null; |
| this.uptimeSecs = null; |
| } |
| |
| public String get_host() { |
| return this.host; |
| } |
| |
| public void set_host(String host) { |
| this.host = host; |
| } |
| |
| public void unset_host() { |
| this.host = null; |
| } |
| |
| /** Returns true if field host is set (has been assigned a value) and false otherwise */ |
| public boolean is_set_host() { |
| return this.host != null; |
| } |
| |
| public void set_host_isSet(boolean value) { |
| if (!value) { |
| this.host = null; |
| } |
| } |
| |
| public String get_uptimeSecs() { |
| return this.uptimeSecs; |
| } |
| |
| public void set_uptimeSecs(String uptimeSecs) { |
| this.uptimeSecs = uptimeSecs; |
| } |
| |
| public void unset_uptimeSecs() { |
| this.uptimeSecs = null; |
| } |
| |
| /** Returns true if field uptimeSecs is set (has been assigned a value) and false otherwise */ |
| public boolean is_set_uptimeSecs() { |
| return this.uptimeSecs != null; |
| } |
| |
| public void set_uptimeSecs_isSet(boolean value) { |
| if (!value) { |
| this.uptimeSecs = null; |
| } |
| } |
| |
| public void setFieldValue(_Fields field, Object value) { |
| switch (field) { |
| case HOST: |
| if (value == null) { |
| unset_host(); |
| } else { |
| set_host((String)value); |
| } |
| break; |
| |
| case UPTIME_SECS: |
| if (value == null) { |
| unset_uptimeSecs(); |
| } else { |
| set_uptimeSecs((String)value); |
| } |
| break; |
| |
| } |
| } |
| |
| public Object getFieldValue(_Fields field) { |
| switch (field) { |
| case HOST: |
| return get_host(); |
| |
| case UPTIME_SECS: |
| return get_uptimeSecs(); |
| |
| } |
| 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 HOST: |
| return is_set_host(); |
| case UPTIME_SECS: |
| return is_set_uptimeSecs(); |
| } |
| throw new IllegalStateException(); |
| } |
| |
| @Override |
| public boolean equals(Object that) { |
| if (that == null) |
| return false; |
| if (that instanceof NimbusStat) |
| return this.equals((NimbusStat)that); |
| return false; |
| } |
| |
| public boolean equals(NimbusStat that) { |
| if (that == null) |
| return false; |
| |
| boolean this_present_host = true && this.is_set_host(); |
| boolean that_present_host = true && that.is_set_host(); |
| if (this_present_host || that_present_host) { |
| if (!(this_present_host && that_present_host)) |
| return false; |
| if (!this.host.equals(that.host)) |
| return false; |
| } |
| |
| boolean this_present_uptimeSecs = true && this.is_set_uptimeSecs(); |
| boolean that_present_uptimeSecs = true && that.is_set_uptimeSecs(); |
| if (this_present_uptimeSecs || that_present_uptimeSecs) { |
| if (!(this_present_uptimeSecs && that_present_uptimeSecs)) |
| return false; |
| if (!this.uptimeSecs.equals(that.uptimeSecs)) |
| return false; |
| } |
| |
| return true; |
| } |
| |
| @Override |
| public int hashCode() { |
| List<Object> list = new ArrayList<Object>(); |
| |
| boolean present_host = true && (is_set_host()); |
| list.add(present_host); |
| if (present_host) |
| list.add(host); |
| |
| boolean present_uptimeSecs = true && (is_set_uptimeSecs()); |
| list.add(present_uptimeSecs); |
| if (present_uptimeSecs) |
| list.add(uptimeSecs); |
| |
| return list.hashCode(); |
| } |
| |
| @Override |
| public int compareTo(NimbusStat other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| |
| lastComparison = Boolean.valueOf(is_set_host()).compareTo(other.is_set_host()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_host()) { |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| lastComparison = Boolean.valueOf(is_set_uptimeSecs()).compareTo(other.is_set_uptimeSecs()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_uptimeSecs()) { |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uptimeSecs, other.uptimeSecs); |
| 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 TException { |
| schemes.get(iprot.getScheme()).getScheme().read(iprot, this); |
| } |
| |
| public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { |
| schemes.get(oprot.getScheme()).getScheme().write(oprot, this); |
| } |
| |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder("NimbusStat("); |
| boolean first = true; |
| |
| sb.append("host:"); |
| if (this.host == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.host); |
| } |
| first = false; |
| if (!first) sb.append(", "); |
| sb.append("uptimeSecs:"); |
| if (this.uptimeSecs == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.uptimeSecs); |
| } |
| first = false; |
| sb.append(")"); |
| return sb.toString(); |
| } |
| |
| public void validate() throws TException { |
| // check for required fields |
| if (!is_set_host()) { |
| throw new TProtocolException("Required field 'host' is unset! Struct:" + toString()); |
| } |
| |
| if (!is_set_uptimeSecs()) { |
| throw new TProtocolException("Required field 'uptimeSecs' 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 (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 (TException te) { |
| throw new java.io.IOException(te); |
| } |
| } |
| |
| private static class NimbusStatStandardSchemeFactory implements SchemeFactory { |
| public NimbusStatStandardScheme getScheme() { |
| return new NimbusStatStandardScheme(); |
| } |
| } |
| |
| private static class NimbusStatStandardScheme extends StandardScheme<NimbusStat> { |
| |
| public void read(org.apache.thrift.protocol.TProtocol iprot, NimbusStat struct) throws 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: // HOST |
| if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { |
| struct.host = iprot.readString(); |
| struct.set_host_isSet(true); |
| } else { |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); |
| } |
| break; |
| case 2: // UPTIME_SECS |
| if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { |
| struct.uptimeSecs = iprot.readString(); |
| struct.set_uptimeSecs_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, NimbusStat struct) throws TException { |
| struct.validate(); |
| |
| oprot.writeStructBegin(STRUCT_DESC); |
| if (struct.host != null) { |
| oprot.writeFieldBegin(HOST_FIELD_DESC); |
| oprot.writeString(struct.host); |
| oprot.writeFieldEnd(); |
| } |
| if (struct.uptimeSecs != null) { |
| oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC); |
| oprot.writeString(struct.uptimeSecs); |
| oprot.writeFieldEnd(); |
| } |
| oprot.writeFieldStop(); |
| oprot.writeStructEnd(); |
| } |
| |
| } |
| |
| private static class NimbusStatTupleSchemeFactory implements SchemeFactory { |
| public NimbusStatTupleScheme getScheme() { |
| return new NimbusStatTupleScheme(); |
| } |
| } |
| |
| private static class NimbusStatTupleScheme extends TupleScheme<NimbusStat> { |
| |
| @Override |
| public void write(org.apache.thrift.protocol.TProtocol prot, NimbusStat struct) throws TException { |
| TTupleProtocol oprot = (TTupleProtocol) prot; |
| oprot.writeString(struct.host); |
| oprot.writeString(struct.uptimeSecs); |
| } |
| |
| @Override |
| public void read(org.apache.thrift.protocol.TProtocol prot, NimbusStat struct) throws TException { |
| TTupleProtocol iprot = (TTupleProtocol) prot; |
| struct.host = iprot.readString(); |
| struct.set_host_isSet(true); |
| struct.uptimeSecs = iprot.readString(); |
| struct.set_uptimeSecs_isSet(true); |
| } |
| } |
| |
| } |
| |