org.apache.iotdb.common.rpc.thrift.TSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iotdb-thrift-commons Show documentation
Show all versions of iotdb-thrift-commons Show documentation
RPC (Thrift) common framework.
The newest version!
/**
* Autogenerated by Thrift Compiler (0.14.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.iotdb.common.rpc.thrift;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2024-09-12")
public class TSender implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSender");
private static final org.apache.thrift.protocol.TField DATA_NODE_LOCATION_FIELD_DESC = new org.apache.thrift.protocol.TField("dataNodeLocation", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField CONFIG_NODE_LOCATION_FIELD_DESC = new org.apache.thrift.protocol.TField("configNodeLocation", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TSenderStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TSenderTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable TDataNodeLocation dataNodeLocation; // optional
public @org.apache.thrift.annotation.Nullable TConfigNodeLocation configNodeLocation; // 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 {
DATA_NODE_LOCATION((short)1, "dataNodeLocation"),
CONFIG_NODE_LOCATION((short)2, "configNodeLocation");
private static final java.util.Map byName = new java.util.HashMap();
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.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // DATA_NODE_LOCATION
return DATA_NODE_LOCATION;
case 2: // CONFIG_NODE_LOCATION
return CONFIG_NODE_LOCATION;
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.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
private static final _Fields optionals[] = {_Fields.DATA_NODE_LOCATION,_Fields.CONFIG_NODE_LOCATION};
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.DATA_NODE_LOCATION, new org.apache.thrift.meta_data.FieldMetaData("dataNodeLocation", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDataNodeLocation.class)));
tmpMap.put(_Fields.CONFIG_NODE_LOCATION, new org.apache.thrift.meta_data.FieldMetaData("configNodeLocation", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TConfigNodeLocation.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSender.class, metaDataMap);
}
public TSender() {
}
/**
* Performs a deep copy on other.
*/
public TSender(TSender other) {
if (other.isSetDataNodeLocation()) {
this.dataNodeLocation = new TDataNodeLocation(other.dataNodeLocation);
}
if (other.isSetConfigNodeLocation()) {
this.configNodeLocation = new TConfigNodeLocation(other.configNodeLocation);
}
}
public TSender deepCopy() {
return new TSender(this);
}
@Override
public void clear() {
this.dataNodeLocation = null;
this.configNodeLocation = null;
}
@org.apache.thrift.annotation.Nullable
public TDataNodeLocation getDataNodeLocation() {
return this.dataNodeLocation;
}
public TSender setDataNodeLocation(@org.apache.thrift.annotation.Nullable TDataNodeLocation dataNodeLocation) {
this.dataNodeLocation = dataNodeLocation;
return this;
}
public void unsetDataNodeLocation() {
this.dataNodeLocation = null;
}
/** Returns true if field dataNodeLocation is set (has been assigned a value) and false otherwise */
public boolean isSetDataNodeLocation() {
return this.dataNodeLocation != null;
}
public void setDataNodeLocationIsSet(boolean value) {
if (!value) {
this.dataNodeLocation = null;
}
}
@org.apache.thrift.annotation.Nullable
public TConfigNodeLocation getConfigNodeLocation() {
return this.configNodeLocation;
}
public TSender setConfigNodeLocation(@org.apache.thrift.annotation.Nullable TConfigNodeLocation configNodeLocation) {
this.configNodeLocation = configNodeLocation;
return this;
}
public void unsetConfigNodeLocation() {
this.configNodeLocation = null;
}
/** Returns true if field configNodeLocation is set (has been assigned a value) and false otherwise */
public boolean isSetConfigNodeLocation() {
return this.configNodeLocation != null;
}
public void setConfigNodeLocationIsSet(boolean value) {
if (!value) {
this.configNodeLocation = null;
}
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case DATA_NODE_LOCATION:
if (value == null) {
unsetDataNodeLocation();
} else {
setDataNodeLocation((TDataNodeLocation)value);
}
break;
case CONFIG_NODE_LOCATION:
if (value == null) {
unsetConfigNodeLocation();
} else {
setConfigNodeLocation((TConfigNodeLocation)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case DATA_NODE_LOCATION:
return getDataNodeLocation();
case CONFIG_NODE_LOCATION:
return getConfigNodeLocation();
}
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 DATA_NODE_LOCATION:
return isSetDataNodeLocation();
case CONFIG_NODE_LOCATION:
return isSetConfigNodeLocation();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof TSender)
return this.equals((TSender)that);
return false;
}
public boolean equals(TSender that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_dataNodeLocation = true && this.isSetDataNodeLocation();
boolean that_present_dataNodeLocation = true && that.isSetDataNodeLocation();
if (this_present_dataNodeLocation || that_present_dataNodeLocation) {
if (!(this_present_dataNodeLocation && that_present_dataNodeLocation))
return false;
if (!this.dataNodeLocation.equals(that.dataNodeLocation))
return false;
}
boolean this_present_configNodeLocation = true && this.isSetConfigNodeLocation();
boolean that_present_configNodeLocation = true && that.isSetConfigNodeLocation();
if (this_present_configNodeLocation || that_present_configNodeLocation) {
if (!(this_present_configNodeLocation && that_present_configNodeLocation))
return false;
if (!this.configNodeLocation.equals(that.configNodeLocation))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetDataNodeLocation()) ? 131071 : 524287);
if (isSetDataNodeLocation())
hashCode = hashCode * 8191 + dataNodeLocation.hashCode();
hashCode = hashCode * 8191 + ((isSetConfigNodeLocation()) ? 131071 : 524287);
if (isSetConfigNodeLocation())
hashCode = hashCode * 8191 + configNodeLocation.hashCode();
return hashCode;
}
@Override
public int compareTo(TSender other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetDataNodeLocation(), other.isSetDataNodeLocation());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDataNodeLocation()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataNodeLocation, other.dataNodeLocation);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetConfigNodeLocation(), other.isSetConfigNodeLocation());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetConfigNodeLocation()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.configNodeLocation, other.configNodeLocation);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@org.apache.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("TSender(");
boolean first = true;
if (isSetDataNodeLocation()) {
sb.append("dataNodeLocation:");
if (this.dataNodeLocation == null) {
sb.append("null");
} else {
sb.append(this.dataNodeLocation);
}
first = false;
}
if (isSetConfigNodeLocation()) {
if (!first) sb.append(", ");
sb.append("configNodeLocation:");
if (this.configNodeLocation == null) {
sb.append("null");
} else {
sb.append(this.configNodeLocation);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (dataNodeLocation != null) {
dataNodeLocation.validate();
}
if (configNodeLocation != null) {
configNodeLocation.validate();
}
}
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, java.lang.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 TSenderStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TSenderStandardScheme getScheme() {
return new TSenderStandardScheme();
}
}
private static class TSenderStandardScheme extends org.apache.thrift.scheme.StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, TSender 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: // DATA_NODE_LOCATION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.dataNodeLocation = new TDataNodeLocation();
struct.dataNodeLocation.read(iprot);
struct.setDataNodeLocationIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // CONFIG_NODE_LOCATION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.configNodeLocation = new TConfigNodeLocation();
struct.configNodeLocation.read(iprot);
struct.setConfigNodeLocationIsSet(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();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TSender struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.dataNodeLocation != null) {
if (struct.isSetDataNodeLocation()) {
oprot.writeFieldBegin(DATA_NODE_LOCATION_FIELD_DESC);
struct.dataNodeLocation.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.configNodeLocation != null) {
if (struct.isSetConfigNodeLocation()) {
oprot.writeFieldBegin(CONFIG_NODE_LOCATION_FIELD_DESC);
struct.configNodeLocation.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TSenderTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TSenderTupleScheme getScheme() {
return new TSenderTupleScheme();
}
}
private static class TSenderTupleScheme extends org.apache.thrift.scheme.TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TSender struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetDataNodeLocation()) {
optionals.set(0);
}
if (struct.isSetConfigNodeLocation()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetDataNodeLocation()) {
struct.dataNodeLocation.write(oprot);
}
if (struct.isSetConfigNodeLocation()) {
struct.configNodeLocation.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TSender struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.dataNodeLocation = new TDataNodeLocation();
struct.dataNodeLocation.read(iprot);
struct.setDataNodeLocationIsSet(true);
}
if (incoming.get(1)) {
struct.configNodeLocation = new TConfigNodeLocation();
struct.configNodeLocation.read(iprot);
struct.setConfigNodeLocationIsSet(true);
}
}
}
private static S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}