org.apache.distributedlog.thrift.service.ClientInfo Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.distributedlog.thrift.service;
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 ClientInfo implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("ClientInfo");
private static final TField STREAM_NAME_REGEX_FIELD_DESC = new TField("streamNameRegex", TType.STRING, (short)1);
private static final TField GET_OWNERSHIPS_FIELD_DESC = new TField("getOwnerships", TType.BOOL, (short)2);
public String streamNameRegex;
public boolean getOwnerships;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
STREAM_NAME_REGEX((short)1, "streamNameRegex"),
GET_OWNERSHIPS((short)2, "getOwnerships");
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: // STREAM_NAME_REGEX
return STREAM_NAME_REGEX;
case 2: // GET_OWNERSHIPS
return GET_OWNERSHIPS;
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 __GETOWNERSHIPS_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.STREAM_NAME_REGEX, new FieldMetaData("streamNameRegex", TFieldRequirementType.OPTIONAL,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.GET_OWNERSHIPS, new FieldMetaData("getOwnerships", TFieldRequirementType.OPTIONAL,
new FieldValueMetaData(TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(ClientInfo.class, metaDataMap);
}
public ClientInfo() {
}
/**
* Performs a deep copy on other.
*/
public ClientInfo(ClientInfo other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetStreamNameRegex()) {
this.streamNameRegex = other.streamNameRegex;
}
this.getOwnerships = other.getOwnerships;
}
public ClientInfo deepCopy() {
return new ClientInfo(this);
}
@Override
public void clear() {
this.streamNameRegex = null;
setGetOwnershipsIsSet(false);
this.getOwnerships = false;
}
public String getStreamNameRegex() {
return this.streamNameRegex;
}
public ClientInfo setStreamNameRegex(String streamNameRegex) {
this.streamNameRegex = streamNameRegex;
return this;
}
public void unsetStreamNameRegex() {
this.streamNameRegex = null;
}
/** Returns true if field streamNameRegex is set (has been asigned a value) and false otherwise */
public boolean isSetStreamNameRegex() {
return this.streamNameRegex != null;
}
public void setStreamNameRegexIsSet(boolean value) {
if (!value) {
this.streamNameRegex = null;
}
}
public boolean isGetOwnerships() {
return this.getOwnerships;
}
public ClientInfo setGetOwnerships(boolean getOwnerships) {
this.getOwnerships = getOwnerships;
setGetOwnershipsIsSet(true);
return this;
}
public void unsetGetOwnerships() {
__isset_bit_vector.clear(__GETOWNERSHIPS_ISSET_ID);
}
/** Returns true if field getOwnerships is set (has been asigned a value) and false otherwise */
public boolean isSetGetOwnerships() {
return __isset_bit_vector.get(__GETOWNERSHIPS_ISSET_ID);
}
public void setGetOwnershipsIsSet(boolean value) {
__isset_bit_vector.set(__GETOWNERSHIPS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case STREAM_NAME_REGEX:
if (value == null) {
unsetStreamNameRegex();
} else {
setStreamNameRegex((String)value);
}
break;
case GET_OWNERSHIPS:
if (value == null) {
unsetGetOwnerships();
} else {
setGetOwnerships((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case STREAM_NAME_REGEX:
return getStreamNameRegex();
case GET_OWNERSHIPS:
return new Boolean(isGetOwnerships());
}
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 STREAM_NAME_REGEX:
return isSetStreamNameRegex();
case GET_OWNERSHIPS:
return isSetGetOwnerships();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ClientInfo)
return this.equals((ClientInfo)that);
return false;
}
public boolean equals(ClientInfo that) {
if (that == null)
return false;
boolean this_present_streamNameRegex = true && this.isSetStreamNameRegex();
boolean that_present_streamNameRegex = true && that.isSetStreamNameRegex();
if (this_present_streamNameRegex || that_present_streamNameRegex) {
if (!(this_present_streamNameRegex && that_present_streamNameRegex))
return false;
if (!this.streamNameRegex.equals(that.streamNameRegex))
return false;
}
boolean this_present_getOwnerships = true && this.isSetGetOwnerships();
boolean that_present_getOwnerships = true && that.isSetGetOwnerships();
if (this_present_getOwnerships || that_present_getOwnerships) {
if (!(this_present_getOwnerships && that_present_getOwnerships))
return false;
if (this.getOwnerships != that.getOwnerships)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_streamNameRegex = true && (isSetStreamNameRegex());
builder.append(present_streamNameRegex);
if (present_streamNameRegex)
builder.append(streamNameRegex);
boolean present_getOwnerships = true && (isSetGetOwnerships());
builder.append(present_getOwnerships);
if (present_getOwnerships)
builder.append(getOwnerships);
return builder.toHashCode();
}
public int compareTo(ClientInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ClientInfo typedOther = (ClientInfo)other;
lastComparison = Boolean.valueOf(isSetStreamNameRegex()).compareTo(typedOther.isSetStreamNameRegex());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStreamNameRegex()) {
lastComparison = TBaseHelper.compareTo(this.streamNameRegex, typedOther.streamNameRegex);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetGetOwnerships()).compareTo(typedOther.isSetGetOwnerships());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetGetOwnerships()) {
lastComparison = TBaseHelper.compareTo(this.getOwnerships, typedOther.getOwnerships);
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: // STREAM_NAME_REGEX
if (field.type == TType.STRING) {
this.streamNameRegex = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // GET_OWNERSHIPS
if (field.type == TType.BOOL) {
this.getOwnerships = iprot.readBool();
setGetOwnershipsIsSet(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.streamNameRegex != null) {
if (isSetStreamNameRegex()) {
oprot.writeFieldBegin(STREAM_NAME_REGEX_FIELD_DESC);
oprot.writeString(this.streamNameRegex);
oprot.writeFieldEnd();
}
}
if (isSetGetOwnerships()) {
oprot.writeFieldBegin(GET_OWNERSHIPS_FIELD_DESC);
oprot.writeBool(this.getOwnerships);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ClientInfo(");
boolean first = true;
if (isSetStreamNameRegex()) {
sb.append("streamNameRegex:");
if (this.streamNameRegex == null) {
sb.append("null");
} else {
sb.append(this.streamNameRegex);
}
first = false;
}
if (isSetGetOwnerships()) {
if (!first) sb.append(", ");
sb.append("getOwnerships:");
sb.append(this.getOwnerships);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy