/**
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.leansoft.luxun.api.generated;
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"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-09-24")
public class ConsumeRequest implements org.apache.thrift.TBase<ConsumeRequest, ConsumeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<ConsumeRequest> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConsumeRequest");
private static final org.apache.thrift.protocol.TField TOPIC_FIELD_DESC = new org.apache.thrift.protocol.TField("topic", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField FANOUT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("fanoutId", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField START_INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("startIndex", org.apache.thrift.protocol.TType.I64, (short)3);
private static final org.apache.thrift.protocol.TField MAX_FETCH_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("maxFetchSize", org.apache.thrift.protocol.TType.I32, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ConsumeRequestStandardSchemeFactory());
schemes.put(TupleScheme.class, new ConsumeRequestTupleSchemeFactory());
}
private String topic; // required
private String fanoutId; // required
private long startIndex; // required
private int maxFetchSize; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TOPIC((short)1, "topic"),
FANOUT_ID((short)2, "fanoutId"),
START_INDEX((short)3, "startIndex"),
MAX_FETCH_SIZE((short)4, "maxFetchSize");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // TOPIC
return TOPIC;
case 2: // FANOUT_ID
return FANOUT_ID;
case 3: // START_INDEX
return START_INDEX;
case 4: // MAX_FETCH_SIZE
return MAX_FETCH_SIZE;
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 __STARTINDEX_ISSET_ID = 0;
private static final int __MAXFETCHSIZE_ISSET_ID = 1;
private byte __isset_bitfield = 0;
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.TOPIC, new org.apache.thrift.meta_data.FieldMetaData("topic", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.FANOUT_ID, new org.apache.thrift.meta_data.FieldMetaData("fanoutId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.START_INDEX, new org.apache.thrift.meta_data.FieldMetaData("startIndex", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.MAX_FETCH_SIZE, new org.apache.thrift.meta_data.FieldMetaData("maxFetchSize", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConsumeRequest.class, metaDataMap);
}
public ConsumeRequest() {
}
public ConsumeRequest(
String topic,
String fanoutId,
long startIndex,
int maxFetchSize)
{
this();
this.topic = topic;
this.fanoutId = fanoutId;
this.startIndex = startIndex;
setStartIndexIsSet(true);
this.maxFetchSize = maxFetchSize;
setMaxFetchSizeIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ConsumeRequest(ConsumeRequest other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetTopic()) {
this.topic = other.topic;
}
if (other.isSetFanoutId()) {
this.fanoutId = other.fanoutId;
}
this.startIndex = other.startIndex;
this.maxFetchSize = other.maxFetchSize;
}
public ConsumeRequest deepCopy() {
return new ConsumeRequest(this);
}
@Override
public void clear() {
this.topic = null;
this.fanoutId = null;
setStartIndexIsSet(false);
this.startIndex = 0;
setMaxFetchSizeIsSet(false);
this.maxFetchSize = 0;
}
public String getTopic() {
return this.topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public void unsetTopic() {
this.topic = null;
}
/** Returns true if field topic is set (has been assigned a value) and false otherwise */
public boolean isSetTopic() {
return this.topic != null;
}
public void setTopicIsSet(boolean value) {
if (!value) {
this.topic = null;
}
}
public String getFanoutId() {
return this.fanoutId;
}
public void setFanoutId(String fanoutId) {
this.fanoutId = fanoutId;
}
public void unsetFanoutId() {
this.fanoutId = null;
}
/** Returns true if field fanoutId is set (has been assigned a value) and false otherwise */
public boolean isSetFanoutId() {
return this.fanoutId != null;
}
public void setFanoutIdIsSet(boolean value) {
if (!value) {
this.fanoutId = null;
}
}
public long getStartIndex() {
return this.startIndex;
}
public void setStartIndex(long startIndex) {
this.startIndex = startIndex;
setStartIndexIsSet(true);
}
public void unsetStartIndex() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STARTINDEX_ISSET_ID);
}
/** Returns true if field startIndex is set (has been assigned a value) and false otherwise */
public boolean isSetStartIndex() {
return EncodingUtils.testBit(__isset_bitfield, __STARTINDEX_ISSET_ID);
}
public void setStartIndexIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STARTINDEX_ISSET_ID, value);
}
public int getMaxFetchSize() {
return this.maxFetchSize;
}
public void setMaxFetchSize(int maxFetchSize) {
this.maxFetchSize = maxFetchSize;
setMaxFetchSizeIsSet(true);
}
public void unsetMaxFetchSize() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXFETCHSIZE_ISSET_ID);
}
/** Returns true if field maxFetchSize is set (has been assigned a value) and false otherwise */
public boolean isSetMaxFetchSize() {
return EncodingUtils.testBit(__isset_bitfield, __MAXFETCHSIZE_ISSET_ID);
}
public void setMaxFetchSizeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXFETCHSIZE_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TOPIC:
if (value == null) {
unsetTopic();
} else {
setTopic((String)value);
}
break;
case FANOUT_ID:
if (value == null) {
unsetFanoutId();
} else {
setFanoutId((String)value);
}
break;
case START_INDEX:
if (value == null) {
unsetStartIndex();
} else {
setStartIndex((Long)value);
}
break;
case MAX_FETCH_SIZE:
if (value == null) {
unsetMaxFetchSize();
} else {
setMaxFetchSize((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TOPIC:
return getTopic();
case FANOUT_ID:
return getFanoutId();
case START_INDEX:
return getStartIndex();
case MAX_FETCH_SIZE:
return getMaxFetchSize();
}
throw new 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 IllegalArgumentException();
}
switch (field) {
case TOPIC:
return isSetTopic();
case FANOUT_ID:
return isSetFanoutId();
case START_INDEX:
return isSetStartIndex();
case MAX_FETCH_SIZE:
return isSetMaxFetchSize();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ConsumeRequest)
return this.equals((ConsumeRequest)that);
return false;
}
public boolean equals(ConsumeRequest that) {
if (that == null)
return false;
boolean this_present_topic = true && this.isSetTopic();
boolean that_present_topic = true && that.isSetTopic();
if (this_present_topic || that_present_topic) {
if (!(this_present_topic && that_present_topic))
return false;
if (!this.topic.equals(that.topic))
return false;
}
boolean this_present_fanoutId = true && this.isSetFanoutId();
boolean that_present_fanoutId = true && that.isSetFanoutId();
if (this_present_fanoutId || that_present_fanoutId) {
if (!(this_present_fanoutId && that_present_fanoutId))
return false;
if (!this.fanoutId.equals(that.fanoutId))
return false;
}
boolean this_present_startIndex = true;
boolean that_present_startIndex = true;
if (this_present_startIndex || that_present_startIndex) {
if (!(this_present_startIndex && that_present_startIndex))
return false;
if (this.startIndex != that.startIndex)
return false;
}
boolean this_present_maxFetchSize = true;
boolean that_present_maxFetchSize = true;
if (this_present_maxFetchSize || that_present_maxFetchSize) {
if (!(this_present_maxFetchSize && that_present_maxFetchSize))
return false;
if (this.maxFetchSize != that.maxFetchSize)
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_topic = true && (isSetTopic());
list.add(present_topic);
if (present_topic)
list.add(topic);
boolean present_fanoutId = true && (isSetFanoutId());
list.add(present_fanoutId);
if (present_fanoutId)
list.add(fanoutId);
boolean present_startIndex = true;
list.add(present_startIndex);
if (present_startIndex)
list.add(startIndex);
boolean present_maxFetchSize = true;
list.add(present_maxFetchSize);
if (present_maxFetchSize)
list.add(maxFetchSize);
return list.hashCode();
}
@Override
public int compareTo(ConsumeRequest other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetTopic()).compareTo(other.isSetTopic());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTopic()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.topic, other.topic);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFanoutId()).compareTo(other.isSetFanoutId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFanoutId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fanoutId, other.fanoutId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStartIndex()).compareTo(other.isSetStartIndex());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStartIndex()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startIndex, other.startIndex);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMaxFetchSize()).compareTo(other.isSetMaxFetchSize());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMaxFetchSize()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxFetchSize, other.maxFetchSize);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ConsumeRequest(");
boolean first = true;
sb.append("topic:");
if (this.topic == null) {
sb.append("null");
} else {
sb.append(this.topic);
}
first = false;
if (!first) sb.append(", ");
sb.append("fanoutId:");
if (this.fanoutId == null) {
sb.append("null");
} else {
sb.append(this.fanoutId);
}
first = false;
if (!first) sb.append(", ");
sb.append("startIndex:");
sb.append(this.startIndex);
first = false;
if (!first) sb.append(", ");
sb.append("maxFetchSize:");
sb.append(this.maxFetchSize);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (!isSetTopic()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'topic' 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.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, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
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 ConsumeRequestStandardSchemeFactory implements SchemeFactory {
public ConsumeRequestStandardScheme getScheme() {
return new ConsumeRequestStandardScheme();
}
}
private static class ConsumeRequestStandardScheme extends StandardScheme<ConsumeRequest> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ConsumeRequest 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: // TOPIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.topic = iprot.readString();
struct.setTopicIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // FANOUT_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.fanoutId = iprot.readString();
struct.setFanoutIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // START_INDEX
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.startIndex = iprot.readI64();
struct.setStartIndexIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // MAX_FETCH_SIZE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.maxFetchSize = iprot.readI32();
struct.setMaxFetchSizeIsSet(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();
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ConsumeRequest struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.topic != null) {
oprot.writeFieldBegin(TOPIC_FIELD_DESC);
oprot.writeString(struct.topic);
oprot.writeFieldEnd();
}
if (struct.fanoutId != null) {
oprot.writeFieldBegin(FANOUT_ID_FIELD_DESC);
oprot.writeString(struct.fanoutId);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(START_INDEX_FIELD_DESC);
oprot.writeI64(struct.startIndex);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAX_FETCH_SIZE_FIELD_DESC);
oprot.writeI32(struct.maxFetchSize);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ConsumeRequestTupleSchemeFactory implements SchemeFactory {
public ConsumeRequestTupleScheme getScheme() {
return new ConsumeRequestTupleScheme();
}
}
private static class ConsumeRequestTupleScheme extends TupleScheme<ConsumeRequest> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ConsumeRequest struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.topic);
BitSet optionals = new BitSet();
if (struct.isSetFanoutId()) {
optionals.set(0);
}
if (struct.isSetStartIndex()) {
optionals.set(1);
}
if (struct.isSetMaxFetchSize()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetFanoutId()) {
oprot.writeString(struct.fanoutId);
}
if (struct.isSetStartIndex()) {
oprot.writeI64(struct.startIndex);
}
if (struct.isSetMaxFetchSize()) {
oprot.writeI32(struct.maxFetchSize);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ConsumeRequest struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.topic = iprot.readString();
struct.setTopicIsSet(true);
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.fanoutId = iprot.readString();
struct.setFanoutIdIsSet(true);
}
if (incoming.get(1)) {
struct.startIndex = iprot.readI64();
struct.setStartIndexIsSet(true);
}
if (incoming.get(2)) {
struct.maxFetchSize = iprot.readI32();
struct.setMaxFetchSizeIsSet(true);
}
}
}
}