scray.service.qservice.thriftjava.ScrayTServiceEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scray-client-jdbc Show documentation
Show all versions of scray-client-jdbc Show documentation
scray java code, which can be used from java and scala
The newest version!
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package scray.service.qservice.thriftjava;
import org.apache.commons.lang.builder.HashCodeBuilder;
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;
import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;
// No additional import required for struct/union.
public class ScrayTServiceEndpoint implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("ScrayTServiceEndpoint");
private static final TField HOST_FIELD_DESC = new TField("host", TType.STRING, (short)1);
private static final TField PORT_FIELD_DESC = new TField("port", TType.I32, (short)2);
private static final TField ENDPOINT_ID_FIELD_DESC = new TField("endpointId", TType.STRUCT, (short)3);
private static final TField EXPIRES_FIELD_DESC = new TField("expires", TType.I64, (short)4);
public String host;
public int port;
public scray.service.qmodel.thriftjava.ScrayUUID endpointId;
public long expires;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
HOST((short)1, "host"),
PORT((short)2, "port"),
ENDPOINT_ID((short)3, "endpointId"),
EXPIRES((short)4, "expires");
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: // HOST
return HOST;
case 2: // PORT
return PORT;
case 3: // ENDPOINT_ID
return ENDPOINT_ID;
case 4: // EXPIRES
return EXPIRES;
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 static final int __PORT_ISSET_ID = 0;
private static final int __EXPIRES_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.HOST, new FieldMetaData("host", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.PORT, new FieldMetaData("port", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I32)));
tmpMap.put(_Fields.ENDPOINT_ID, new FieldMetaData("endpointId", TFieldRequirementType.OPTIONAL,
new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayUUID.class)));
tmpMap.put(_Fields.EXPIRES, new FieldMetaData("expires", TFieldRequirementType.OPTIONAL,
new FieldValueMetaData(TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(ScrayTServiceEndpoint.class, metaDataMap);
}
public ScrayTServiceEndpoint() {
}
public ScrayTServiceEndpoint(
String host,
int port)
{
this();
this.host = host;
this.port = port;
setPortIsSet(true);
}
/**
* Performs a deep copy on other.
*/
public ScrayTServiceEndpoint(ScrayTServiceEndpoint other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetHost()) {
this.host = other.host;
}
this.port = other.port;
if (other.isSetEndpointId()) {
this.endpointId = new scray.service.qmodel.thriftjava.ScrayUUID(other.endpointId);
}
this.expires = other.expires;
}
public ScrayTServiceEndpoint deepCopy() {
return new ScrayTServiceEndpoint(this);
}
@java.lang.Override
public void clear() {
this.host = null;
setPortIsSet(false);
this.port = 0;
this.endpointId = null;
setExpiresIsSet(false);
this.expires = 0;
}
public String getHost() {
return this.host;
}
public ScrayTServiceEndpoint setHost(String host) {
this.host = host;
return this;
}
public void unsetHost() {
this.host = null;
}
/** Returns true if field host is set (has been asigned a value) and false otherwise */
public boolean isSetHost() {
return this.host != null;
}
public void setHostIsSet(boolean value) {
if (!value) {
this.host = null;
}
}
public int getPort() {
return this.port;
}
public ScrayTServiceEndpoint setPort(int port) {
this.port = port;
setPortIsSet(true);
return this;
}
public void unsetPort() {
__isset_bit_vector.clear(__PORT_ISSET_ID);
}
/** Returns true if field port is set (has been asigned a value) and false otherwise */
public boolean isSetPort() {
return __isset_bit_vector.get(__PORT_ISSET_ID);
}
public void setPortIsSet(boolean value) {
__isset_bit_vector.set(__PORT_ISSET_ID, value);
}
public scray.service.qmodel.thriftjava.ScrayUUID getEndpointId() {
return this.endpointId;
}
public ScrayTServiceEndpoint setEndpointId(scray.service.qmodel.thriftjava.ScrayUUID endpointId) {
this.endpointId = endpointId;
return this;
}
public void unsetEndpointId() {
this.endpointId = null;
}
/** Returns true if field endpointId is set (has been asigned a value) and false otherwise */
public boolean isSetEndpointId() {
return this.endpointId != null;
}
public void setEndpointIdIsSet(boolean value) {
if (!value) {
this.endpointId = null;
}
}
public long getExpires() {
return this.expires;
}
public ScrayTServiceEndpoint setExpires(long expires) {
this.expires = expires;
setExpiresIsSet(true);
return this;
}
public void unsetExpires() {
__isset_bit_vector.clear(__EXPIRES_ISSET_ID);
}
/** Returns true if field expires is set (has been asigned a value) and false otherwise */
public boolean isSetExpires() {
return __isset_bit_vector.get(__EXPIRES_ISSET_ID);
}
public void setExpiresIsSet(boolean value) {
__isset_bit_vector.set(__EXPIRES_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case HOST:
if (value == null) {
unsetHost();
} else {
setHost((String)value);
}
break;
case PORT:
if (value == null) {
unsetPort();
} else {
setPort((Integer)value);
}
break;
case ENDPOINT_ID:
if (value == null) {
unsetEndpointId();
} else {
setEndpointId((scray.service.qmodel.thriftjava.ScrayUUID)value);
}
break;
case EXPIRES:
if (value == null) {
unsetExpires();
} else {
setExpires((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case HOST:
return getHost();
case PORT:
return new Integer(getPort());
case ENDPOINT_ID:
return getEndpointId();
case EXPIRES:
return new Long(getExpires());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case HOST:
return isSetHost();
case PORT:
return isSetPort();
case ENDPOINT_ID:
return isSetEndpointId();
case EXPIRES:
return isSetExpires();
}
throw new IllegalStateException();
}
@java.lang.Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ScrayTServiceEndpoint)
return this.equals((ScrayTServiceEndpoint)that);
return false;
}
public boolean equals(ScrayTServiceEndpoint that) {
if (that == null)
return false;
boolean this_present_host = true && this.isSetHost();
boolean that_present_host = true && that.isSetHost();
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_port = true;
boolean that_present_port = true;
if (this_present_port || that_present_port) {
if (!(this_present_port && that_present_port))
return false;
if (this.port != that.port)
return false;
}
boolean this_present_endpointId = true && this.isSetEndpointId();
boolean that_present_endpointId = true && that.isSetEndpointId();
if (this_present_endpointId || that_present_endpointId) {
if (!(this_present_endpointId && that_present_endpointId))
return false;
if (!this.endpointId.equals(that.endpointId))
return false;
}
boolean this_present_expires = true && this.isSetExpires();
boolean that_present_expires = true && that.isSetExpires();
if (this_present_expires || that_present_expires) {
if (!(this_present_expires && that_present_expires))
return false;
if (this.expires != that.expires)
return false;
}
return true;
}
@java.lang.Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_host = true && (isSetHost());
builder.append(present_host);
if (present_host)
builder.append(host);
boolean present_port = true;
builder.append(present_port);
if (present_port)
builder.append(port);
boolean present_endpointId = true && (isSetEndpointId());
builder.append(present_endpointId);
if (present_endpointId)
builder.append(endpointId);
boolean present_expires = true && (isSetExpires());
builder.append(present_expires);
if (present_expires)
builder.append(expires);
return builder.toHashCode();
}
public int compareTo(ScrayTServiceEndpoint other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ScrayTServiceEndpoint typedOther = (ScrayTServiceEndpoint)other;
lastComparison = Boolean.valueOf(isSetHost()).compareTo(typedOther.isSetHost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHost()) {
lastComparison = TBaseHelper.compareTo(this.host, typedOther.host);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPort()).compareTo(typedOther.isSetPort());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPort()) {
lastComparison = TBaseHelper.compareTo(this.port, typedOther.port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEndpointId()).compareTo(typedOther.isSetEndpointId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEndpointId()) {
lastComparison = TBaseHelper.compareTo(this.endpointId, typedOther.endpointId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetExpires()).compareTo(typedOther.isSetExpires());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetExpires()) {
lastComparison = TBaseHelper.compareTo(this.expires, typedOther.expires);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
switch (field.id) {
case 1: // HOST
if (field.type == TType.STRING) {
this.host = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // PORT
if (field.type == TType.I32) {
this.port = iprot.readI32();
setPortIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // ENDPOINT_ID
if (field.type == TType.STRUCT) {
this.endpointId = new scray.service.qmodel.thriftjava.ScrayUUID();
this.endpointId.read(iprot);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // EXPIRES
if (field.type == TType.I64) {
this.expires = iprot.readI64();
setExpiresIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.host != null) {
oprot.writeFieldBegin(HOST_FIELD_DESC);
oprot.writeString(this.host);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(PORT_FIELD_DESC);
oprot.writeI32(this.port);
oprot.writeFieldEnd();
if (this.endpointId != null) {
if (isSetEndpointId()) {
oprot.writeFieldBegin(ENDPOINT_ID_FIELD_DESC);
this.endpointId.write(oprot);
oprot.writeFieldEnd();
}
}
if (isSetExpires()) {
oprot.writeFieldBegin(EXPIRES_FIELD_DESC);
oprot.writeI64(this.expires);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@java.lang.Override
public String toString() {
StringBuilder sb = new StringBuilder("ScrayTServiceEndpoint(");
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("port:");
sb.append(this.port);
first = false;
if (isSetEndpointId()) {
if (!first) sb.append(", ");
sb.append("endpointId:");
if (this.endpointId == null) {
sb.append("null");
} else {
sb.append(this.endpointId);
}
first = false;
}
if (isSetExpires()) {
if (!first) sb.append(", ");
sb.append("expires:");
sb.append(this.expires);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}