
tech.aroma.thrift.endpoint.Endpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aroma-thrift Show documentation
Show all versions of aroma-thrift Show documentation
Part of the Aroma Project.
This project contains the Service and Model Definitions.
From this the Server and Client interfaces are generated for the Aroma Service.
/**
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package tech.aroma.thrift.endpoint;
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"})
/**
* This union defines the multiple ways that an Endpoint can be defined
* and understood.
*/
public class Endpoint extends org.apache.thrift.TUnion {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Endpoint");
private static final org.apache.thrift.protocol.TField TCP_FIELD_DESC = new org.apache.thrift.protocol.TField("tcp", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField HTTP_THRIFT_FIELD_DESC = new org.apache.thrift.protocol.TField("httpThrift", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.protocol.TField HTTP_REST_FIELD_DESC = new org.apache.thrift.protocol.TField("httpRest", org.apache.thrift.protocol.TType.STRUCT, (short)3);
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TCP((short)1, "tcp"),
HTTP_THRIFT((short)2, "httpThrift"),
HTTP_REST((short)3, "httpRest");
private static final Map byName = new HashMap();
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: // TCP
return TCP;
case 2: // HTTP_THRIFT
return HTTP_THRIFT;
case 3: // HTTP_REST
return HTTP_REST;
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;
}
}
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.TCP, new org.apache.thrift.meta_data.FieldMetaData("tcp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TcpEndpoint.class)));
tmpMap.put(_Fields.HTTP_THRIFT, new org.apache.thrift.meta_data.FieldMetaData("httpThrift", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HttpThriftEndpoint.class)));
tmpMap.put(_Fields.HTTP_REST, new org.apache.thrift.meta_data.FieldMetaData("httpRest", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HttpRestEndpoint.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Endpoint.class, metaDataMap);
}
public Endpoint() {
super();
}
public Endpoint(_Fields setField, Object value) {
super(setField, value);
}
public Endpoint(Endpoint other) {
super(other);
}
public Endpoint deepCopy() {
return new Endpoint(this);
}
public static Endpoint tcp(TcpEndpoint value) {
Endpoint x = new Endpoint();
x.setTcp(value);
return x;
}
public static Endpoint httpThrift(HttpThriftEndpoint value) {
Endpoint x = new Endpoint();
x.setHttpThrift(value);
return x;
}
public static Endpoint httpRest(HttpRestEndpoint value) {
Endpoint x = new Endpoint();
x.setHttpRest(value);
return x;
}
@Override
protected void checkType(_Fields setField, Object value) throws ClassCastException {
switch (setField) {
case TCP:
if (value instanceof TcpEndpoint) {
break;
}
throw new ClassCastException("Was expecting value of type TcpEndpoint for field 'tcp', but got " + value.getClass().getSimpleName());
case HTTP_THRIFT:
if (value instanceof HttpThriftEndpoint) {
break;
}
throw new ClassCastException("Was expecting value of type HttpThriftEndpoint for field 'httpThrift', but got " + value.getClass().getSimpleName());
case HTTP_REST:
if (value instanceof HttpRestEndpoint) {
break;
}
throw new ClassCastException("Was expecting value of type HttpRestEndpoint for field 'httpRest', but got " + value.getClass().getSimpleName());
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(field.id);
if (setField != null) {
switch (setField) {
case TCP:
if (field.type == TCP_FIELD_DESC.type) {
TcpEndpoint tcp;
tcp = new TcpEndpoint();
tcp.read(iprot);
return tcp;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case HTTP_THRIFT:
if (field.type == HTTP_THRIFT_FIELD_DESC.type) {
HttpThriftEndpoint httpThrift;
httpThrift = new HttpThriftEndpoint();
httpThrift.read(iprot);
return httpThrift;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case HTTP_REST:
if (field.type == HTTP_REST_FIELD_DESC.type) {
HttpRestEndpoint httpRest;
httpRest = new HttpRestEndpoint();
httpRest.read(iprot);
return httpRest;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
}
@Override
protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case TCP:
TcpEndpoint tcp = (TcpEndpoint)value_;
tcp.write(oprot);
return;
case HTTP_THRIFT:
HttpThriftEndpoint httpThrift = (HttpThriftEndpoint)value_;
httpThrift.write(oprot);
return;
case HTTP_REST:
HttpRestEndpoint httpRest = (HttpRestEndpoint)value_;
httpRest.write(oprot);
return;
default:
throw new IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(fieldID);
if (setField != null) {
switch (setField) {
case TCP:
TcpEndpoint tcp;
tcp = new TcpEndpoint();
tcp.read(iprot);
return tcp;
case HTTP_THRIFT:
HttpThriftEndpoint httpThrift;
httpThrift = new HttpThriftEndpoint();
httpThrift.read(iprot);
return httpThrift;
case HTTP_REST:
HttpRestEndpoint httpRest;
httpRest = new HttpRestEndpoint();
httpRest.read(iprot);
return httpRest;
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
throw new TProtocolException("Couldn't find a field with field id " + fieldID);
}
}
@Override
protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case TCP:
TcpEndpoint tcp = (TcpEndpoint)value_;
tcp.write(oprot);
return;
case HTTP_THRIFT:
HttpThriftEndpoint httpThrift = (HttpThriftEndpoint)value_;
httpThrift.write(oprot);
return;
case HTTP_REST:
HttpRestEndpoint httpRest = (HttpRestEndpoint)value_;
httpRest.write(oprot);
return;
default:
throw new IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
switch (setField) {
case TCP:
return TCP_FIELD_DESC;
case HTTP_THRIFT:
return HTTP_THRIFT_FIELD_DESC;
case HTTP_REST:
return HTTP_REST_FIELD_DESC;
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected org.apache.thrift.protocol.TStruct getStructDesc() {
return STRUCT_DESC;
}
@Override
protected _Fields enumForId(short id) {
return _Fields.findByThriftIdOrThrow(id);
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public TcpEndpoint getTcp() {
if (getSetField() == _Fields.TCP) {
return (TcpEndpoint)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'tcp' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setTcp(TcpEndpoint value) {
if (value == null) throw new NullPointerException();
setField_ = _Fields.TCP;
value_ = value;
}
public HttpThriftEndpoint getHttpThrift() {
if (getSetField() == _Fields.HTTP_THRIFT) {
return (HttpThriftEndpoint)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'httpThrift' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setHttpThrift(HttpThriftEndpoint value) {
if (value == null) throw new NullPointerException();
setField_ = _Fields.HTTP_THRIFT;
value_ = value;
}
public HttpRestEndpoint getHttpRest() {
if (getSetField() == _Fields.HTTP_REST) {
return (HttpRestEndpoint)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'httpRest' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setHttpRest(HttpRestEndpoint value) {
if (value == null) throw new NullPointerException();
setField_ = _Fields.HTTP_REST;
value_ = value;
}
public boolean isSetTcp() {
return setField_ == _Fields.TCP;
}
public boolean isSetHttpThrift() {
return setField_ == _Fields.HTTP_THRIFT;
}
public boolean isSetHttpRest() {
return setField_ == _Fields.HTTP_REST;
}
public boolean equals(Object other) {
if (other instanceof Endpoint) {
return equals((Endpoint)other);
} else {
return false;
}
}
public boolean equals(Endpoint other) {
return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
}
@Override
public int compareTo(Endpoint other) {
int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
if (lastComparison == 0) {
return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
}
return lastComparison;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy