blob: 17899a968aab1192789cef153804d5bea28cc38e [file] [log] [blame]
/**
* 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.
*/
/**
* Autogenerated by Thrift Compiler (0.12.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.storm.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public class NodeInfo implements org.apache.storm.thrift.TBase<NodeInfo, NodeInfo._Fields>, java.io.Serializable, Cloneable, Comparable<NodeInfo> {
private static final org.apache.storm.thrift.protocol.TStruct STRUCT_DESC = new org.apache.storm.thrift.protocol.TStruct("NodeInfo");
private static final org.apache.storm.thrift.protocol.TField NODE_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("node", org.apache.storm.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.storm.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("port", org.apache.storm.thrift.protocol.TType.SET, (short)2);
private static final org.apache.storm.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new NodeInfoStandardSchemeFactory();
private static final org.apache.storm.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new NodeInfoTupleSchemeFactory();
private @org.apache.storm.thrift.annotation.Nullable java.lang.String node; // required
private @org.apache.storm.thrift.annotation.Nullable java.util.Set<java.lang.Long> port; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.storm.thrift.TFieldIdEnum {
NODE((short)1, "node"),
PORT((short)2, "port");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.storm.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NODE
return NODE;
case 2: // PORT
return PORT;
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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.storm.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final java.util.Map<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NODE, new org.apache.storm.thrift.meta_data.FieldMetaData("node", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.FieldValueMetaData(org.apache.storm.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PORT, new org.apache.storm.thrift.meta_data.FieldMetaData("port", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.SetMetaData(org.apache.storm.thrift.protocol.TType.SET,
new org.apache.storm.thrift.meta_data.FieldValueMetaData(org.apache.storm.thrift.protocol.TType.I64))));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.storm.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NodeInfo.class, metaDataMap);
}
public NodeInfo() {
}
public NodeInfo(
java.lang.String node,
java.util.Set<java.lang.Long> port)
{
this();
this.node = node;
this.port = port;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public NodeInfo(NodeInfo other) {
if (other.is_set_node()) {
this.node = other.node;
}
if (other.is_set_port()) {
java.util.Set<java.lang.Long> __this__port = new java.util.HashSet<java.lang.Long>(other.port);
this.port = __this__port;
}
}
public NodeInfo deepCopy() {
return new NodeInfo(this);
}
@Override
public void clear() {
this.node = null;
this.port = null;
}
@org.apache.storm.thrift.annotation.Nullable
public java.lang.String get_node() {
return this.node;
}
public void set_node(@org.apache.storm.thrift.annotation.Nullable java.lang.String node) {
this.node = node;
}
public void unset_node() {
this.node = null;
}
/** Returns true if field node is set (has been assigned a value) and false otherwise */
public boolean is_set_node() {
return this.node != null;
}
public void set_node_isSet(boolean value) {
if (!value) {
this.node = null;
}
}
public int get_port_size() {
return (this.port == null) ? 0 : this.port.size();
}
@org.apache.storm.thrift.annotation.Nullable
public java.util.Iterator<java.lang.Long> get_port_iterator() {
return (this.port == null) ? null : this.port.iterator();
}
public void add_to_port(long elem) {
if (this.port == null) {
this.port = new java.util.HashSet<java.lang.Long>();
}
this.port.add(elem);
}
@org.apache.storm.thrift.annotation.Nullable
public java.util.Set<java.lang.Long> get_port() {
return this.port;
}
public void set_port(@org.apache.storm.thrift.annotation.Nullable java.util.Set<java.lang.Long> port) {
this.port = port;
}
public void unset_port() {
this.port = null;
}
/** Returns true if field port is set (has been assigned a value) and false otherwise */
public boolean is_set_port() {
return this.port != null;
}
public void set_port_isSet(boolean value) {
if (!value) {
this.port = null;
}
}
public void setFieldValue(_Fields field, @org.apache.storm.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case NODE:
if (value == null) {
unset_node();
} else {
set_node((java.lang.String)value);
}
break;
case PORT:
if (value == null) {
unset_port();
} else {
set_port((java.util.Set<java.lang.Long>)value);
}
break;
}
}
@org.apache.storm.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case NODE:
return get_node();
case PORT:
return get_port();
}
throw new java.lang.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 java.lang.IllegalArgumentException();
}
switch (field) {
case NODE:
return is_set_node();
case PORT:
return is_set_port();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof NodeInfo)
return this.equals((NodeInfo)that);
return false;
}
public boolean equals(NodeInfo that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_node = true && this.is_set_node();
boolean that_present_node = true && that.is_set_node();
if (this_present_node || that_present_node) {
if (!(this_present_node && that_present_node))
return false;
if (!this.node.equals(that.node))
return false;
}
boolean this_present_port = true && this.is_set_port();
boolean that_present_port = true && that.is_set_port();
if (this_present_port || that_present_port) {
if (!(this_present_port && that_present_port))
return false;
if (!this.port.equals(that.port))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((is_set_node()) ? 131071 : 524287);
if (is_set_node())
hashCode = hashCode * 8191 + node.hashCode();
hashCode = hashCode * 8191 + ((is_set_port()) ? 131071 : 524287);
if (is_set_port())
hashCode = hashCode * 8191 + port.hashCode();
return hashCode;
}
@Override
public int compareTo(NodeInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(is_set_node()).compareTo(other.is_set_node());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_node()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.node, other.node);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(is_set_port()).compareTo(other.is_set_port());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_port()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.port, other.port);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@org.apache.storm.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.storm.thrift.protocol.TProtocol iprot) throws org.apache.storm.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.storm.thrift.protocol.TProtocol oprot) throws org.apache.storm.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("NodeInfo(");
boolean first = true;
sb.append("node:");
if (this.node == null) {
sb.append("null");
} else {
sb.append(this.node);
}
first = false;
if (!first) sb.append(", ");
sb.append("port:");
if (this.port == null) {
sb.append("null");
} else {
sb.append(this.port);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.storm.thrift.TException {
// check for required fields
if (!is_set_node()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'node' is unset! Struct:" + toString());
}
if (!is_set_port()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'port' 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.storm.thrift.protocol.TCompactProtocol(new org.apache.storm.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.storm.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try {
read(new org.apache.storm.thrift.protocol.TCompactProtocol(new org.apache.storm.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.storm.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class NodeInfoStandardSchemeFactory implements org.apache.storm.thrift.scheme.SchemeFactory {
public NodeInfoStandardScheme getScheme() {
return new NodeInfoStandardScheme();
}
}
private static class NodeInfoStandardScheme extends org.apache.storm.thrift.scheme.StandardScheme<NodeInfo> {
public void read(org.apache.storm.thrift.protocol.TProtocol iprot, NodeInfo struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NODE
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRING) {
struct.node = iprot.readString();
struct.set_node_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // PORT
if (schemeField.type == org.apache.storm.thrift.protocol.TType.SET) {
{
org.apache.storm.thrift.protocol.TSet _set708 = iprot.readSetBegin();
struct.port = new java.util.HashSet<java.lang.Long>(2*_set708.size);
long _elem709;
for (int _i710 = 0; _i710 < _set708.size; ++_i710)
{
_elem709 = iprot.readI64();
struct.port.add(_elem709);
}
iprot.readSetEnd();
}
struct.set_port_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.storm.thrift.protocol.TProtocol oprot, NodeInfo struct) throws org.apache.storm.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.node != null) {
oprot.writeFieldBegin(NODE_FIELD_DESC);
oprot.writeString(struct.node);
oprot.writeFieldEnd();
}
if (struct.port != null) {
oprot.writeFieldBegin(PORT_FIELD_DESC);
{
oprot.writeSetBegin(new org.apache.storm.thrift.protocol.TSet(org.apache.storm.thrift.protocol.TType.I64, struct.port.size()));
for (long _iter711 : struct.port)
{
oprot.writeI64(_iter711);
}
oprot.writeSetEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class NodeInfoTupleSchemeFactory implements org.apache.storm.thrift.scheme.SchemeFactory {
public NodeInfoTupleScheme getScheme() {
return new NodeInfoTupleScheme();
}
}
private static class NodeInfoTupleScheme extends org.apache.storm.thrift.scheme.TupleScheme<NodeInfo> {
@Override
public void write(org.apache.storm.thrift.protocol.TProtocol prot, NodeInfo struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol oprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
oprot.writeString(struct.node);
{
oprot.writeI32(struct.port.size());
for (long _iter712 : struct.port)
{
oprot.writeI64(_iter712);
}
}
}
@Override
public void read(org.apache.storm.thrift.protocol.TProtocol prot, NodeInfo struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
struct.node = iprot.readString();
struct.set_node_isSet(true);
{
org.apache.storm.thrift.protocol.TSet _set713 = new org.apache.storm.thrift.protocol.TSet(org.apache.storm.thrift.protocol.TType.I64, iprot.readI32());
struct.port = new java.util.HashSet<java.lang.Long>(2*_set713.size);
long _elem714;
for (int _i715 = 0; _i715 < _set713.size; ++_i715)
{
_elem714 = iprot.readI64();
struct.port.add(_elem714);
}
}
struct.set_port_isSet(true);
}
}
private static <S extends org.apache.storm.thrift.scheme.IScheme> S scheme(org.apache.storm.thrift.protocol.TProtocol proto) {
return (org.apache.storm.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}