/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package test;
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.*;
import com.twitter.util.Future;
import com.twitter.util.Function;
import com.twitter.util.Function2;
import com.twitter.util.Try;
import com.twitter.util.Return;
import com.twitter.util.Throw;
import com.twitter.finagle.thrift.ThriftClientRequest;
public class DogBreedService {
public interface Iface {
public BreedInfoResponse breedInfo(String breedName) throws TException;
}
public interface AsyncIface {
public void breedInfo(String breedName, AsyncMethodCallback<AsyncClient.breedInfo_call> resultHandler) throws TException;
}
public interface ServiceIface {
public Future<BreedInfoResponse> breedInfo(String breedName);
}
public static class Client implements TServiceClient, Iface {
public static class Factory implements TServiceClientFactory<Client> {
public Factory() {}
public Client getClient(TProtocol prot) {
return new Client(prot);
}
public Client getClient(TProtocol iprot, TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(TProtocol prot)
{
this(prot, prot);
}
public Client(TProtocol iprot, TProtocol oprot)
{
iprot_ = iprot;
oprot_ = oprot;
}
protected TProtocol iprot_;
protected TProtocol oprot_;
protected int seqid_;
public TProtocol getInputProtocol()
{
return this.iprot_;
}
public TProtocol getOutputProtocol()
{
return this.oprot_;
}
public BreedInfoResponse breedInfo(String breedName) throws TException
{
send_breedInfo(breedName);
return recv_breedInfo();
}
public void send_breedInfo(String breedName) throws TException
{
oprot_.writeMessageBegin(new TMessage("breedInfo", TMessageType.CALL, ++seqid_));
breedInfo_args args = new breedInfo_args();
args.setBreedName(breedName);
args.write(oprot_);
oprot_.writeMessageEnd();
oprot_.getTransport().flush();
}
public BreedInfoResponse recv_breedInfo() throws TException
{
TMessage msg = iprot_.readMessageBegin();
if (msg.type == TMessageType.EXCEPTION) {
TApplicationException x = TApplicationException.read(iprot_);
iprot_.readMessageEnd();
throw x;
}
if (msg.seqid != seqid_) {
throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "breedInfo failed: out of sequence response");
}
breedInfo_result result = new breedInfo_result();
result.read(iprot_);
iprot_.readMessageEnd();
if (result.isSetSuccess()) {
return result.success;
}
throw new TApplicationException(TApplicationException.MISSING_RESULT, "breedInfo failed: unknown result");
}
}
public static class AsyncClient extends TAsyncClient implements AsyncIface {
public static class Factory implements TAsyncClientFactory<AsyncClient> {
private TAsyncClientManager clientManager;
private TProtocolFactory protocolFactory;
public Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void breedInfo(String breedName, AsyncMethodCallback<breedInfo_call> resultHandler) throws TException {
checkReady();
breedInfo_call method_call = new breedInfo_call(breedName, resultHandler, this, protocolFactory, transport);
manager.call(method_call);
}
public static class breedInfo_call extends TAsyncMethodCall {
private String breedName;
public breedInfo_call(String breedName, AsyncMethodCallback<breedInfo_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException {
super(client, protocolFactory, transport, resultHandler, false);
this.breedName = breedName;
}
public void write_args(TProtocol prot) throws TException {
prot.writeMessageBegin(new TMessage("breedInfo", TMessageType.CALL, 0));
breedInfo_args args = new breedInfo_args();
args.setBreedName(breedName);
args.write(prot);
prot.writeMessageEnd();
}
public BreedInfoResponse getResult() throws TException {
if (getState() != State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array());
TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_breedInfo();
}
}
}
public static class ServiceToClient implements ServiceIface {
private com.twitter.finagle.Service<ThriftClientRequest, byte[]> service;
private TProtocolFactory protocolFactory;
public ServiceToClient(com.twitter.finagle.Service<ThriftClientRequest, byte[]> service, TProtocolFactory protocolFactory) {
this.service = service;
this.protocolFactory = protocolFactory;
}
public Future<BreedInfoResponse> breedInfo(String breedName) {
try {
// TODO: size
TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
__prot__.writeMessageBegin(new TMessage("breedInfo", TMessageType.CALL, 0));
breedInfo_args __args__ = new breedInfo_args();
__args__.setBreedName(breedName);
__args__.write(__prot__);
__prot__.writeMessageEnd();
byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);
Future<byte[]> __done__ = this.service.apply(__request__);
return __done__.flatMap(new Function<byte[], Future<BreedInfoResponse>>() {
public Future<BreedInfoResponse> apply(byte[] __buffer__) {
TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
try {
return Future.value((new Client(__prot__)).recv_breedInfo());
} catch (Exception e) {
return Future.exception(e);
}
}
});
} catch (TException e) {
return Future.exception(e);
}
}
}
public static class Processor implements TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(Iface iface)
{
iface_ = iface;
processMap_.put("breedInfo", new breedInfo());
}
protected static interface ProcessFunction {
public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
}
private Iface iface_;
protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();
public boolean process(TProtocol iprot, TProtocol oprot) throws TException
{
TMessage msg = iprot.readMessageBegin();
ProcessFunction fn = processMap_.get(msg.name);
if (fn == null) {
TProtocolUtil.skip(iprot, TType.STRUCT);
iprot.readMessageEnd();
TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return true;
}
fn.process(msg.seqid, iprot, oprot);
return true;
}
private class breedInfo implements ProcessFunction {
public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
{
breedInfo_args args = new breedInfo_args();
try {
args.read(iprot);
} catch (TProtocolException e) {
iprot.readMessageEnd();
TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
oprot.writeMessageBegin(new TMessage("breedInfo", TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return;
}
iprot.readMessageEnd();
breedInfo_result result = new breedInfo_result();
result.success = iface_.breedInfo(args.breedName);
oprot.writeMessageBegin(new TMessage("breedInfo", TMessageType.REPLY, seqid));
result.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
}
}
public static class Service extends com.twitter.finagle.Service<byte[], byte[]> {
private final ServiceIface iface;
private final TProtocolFactory protocolFactory;
protected HashMap<String, Function2<TProtocol, Integer, Future<byte[]>>> functionMap = new HashMap<String, Function2<TProtocol, Integer, Future<byte[]>>>();
public Service(final ServiceIface iface, final TProtocolFactory protocolFactory) {
this.iface = iface;
this.protocolFactory = protocolFactory;
functionMap.put("breedInfo", new Function2<TProtocol, Integer, Future<byte[]>>() {
public Future<byte[]> apply(final TProtocol iprot, final Integer seqid) {
breedInfo_args args = new breedInfo_args();
try {
args.read(iprot);
} catch (TProtocolException e) {
try {
iprot.readMessageEnd();
TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
oprot.writeMessageBegin(new TMessage("breedInfo", TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
return Future.value(buffer);
} catch (Exception e1) {
return Future.exception(e1);
}
} catch (Exception e) {
return Future.exception(e);
}
try {
iprot.readMessageEnd();
} catch (Exception e) {
return Future.exception(e);
}
Future<BreedInfoResponse> future;
try {
future = iface.breedInfo(args.breedName);
} catch (Exception e) {
future = Future.exception(e);
}
try {
return future.flatMap(new Function<BreedInfoResponse, Future<byte[]>>() {
public Future<byte[]> apply(BreedInfoResponse value) {
breedInfo_result result = new breedInfo_result();
result.success = value;
result.setSuccessIsSet(true);
try {
TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
oprot.writeMessageBegin(new TMessage("breedInfo", TMessageType.REPLY, seqid));
result.write(oprot);
oprot.writeMessageEnd();
return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
} catch (Exception e) {
return Future.exception(e);
}
}
}).rescue(new Function<Throwable, Future<byte[]>>() {
public Future<byte[]> apply(Throwable t) {
return Future.exception(t);
}
});
} catch (Exception e) {
return Future.exception(e);
}
}
});
}
public Future<byte[]> apply(byte[] request) {
TTransport inputTransport = new TMemoryInputTransport(request);
TProtocol iprot = protocolFactory.getProtocol(inputTransport);
TMessage msg;
try {
msg = iprot.readMessageBegin();
} catch (Exception e) {
return Future.exception(e);
}
Function2<TProtocol, Integer, Future<byte[]>> fn = functionMap.get(msg.name);
if (fn == null) {
try {
TProtocolUtil.skip(iprot, TType.STRUCT);
iprot.readMessageEnd();
TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
} catch (Exception e) {
return Future.exception(e);
}
}
return fn.apply(iprot, msg.seqid);
}
}
public static class breedInfo_args implements TBase<breedInfo_args, breedInfo_args._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("breedInfo_args");
private static final TField BREED_NAME_FIELD_DESC = new TField("breedName", TType.STRING, (short)1);
public String breedName;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
BREED_NAME((short)1, "breedName");
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: // BREED_NAME
return BREED_NAME;
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
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.BREED_NAME, new FieldMetaData("breedName", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(breedInfo_args.class, metaDataMap);
}
public breedInfo_args() {
}
public breedInfo_args(
String breedName)
{
this();
this.breedName = breedName;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public breedInfo_args(breedInfo_args other) {
if (other.isSetBreedName()) {
this.breedName = other.breedName;
}
}
public breedInfo_args deepCopy() {
return new breedInfo_args(this);
}
@Override
public void clear() {
this.breedName = null;
}
public String getBreedName() {
return this.breedName;
}
public breedInfo_args setBreedName(String breedName) {
this.breedName = breedName;
return this;
}
public void unsetBreedName() {
this.breedName = null;
}
/** Returns true if field breedName is set (has been asigned a value) and false otherwise */
public boolean isSetBreedName() {
return this.breedName != null;
}
public void setBreedNameIsSet(boolean value) {
if (!value) {
this.breedName = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case BREED_NAME:
if (value == null) {
unsetBreedName();
} else {
setBreedName((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case BREED_NAME:
return getBreedName();
}
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 BREED_NAME:
return isSetBreedName();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof breedInfo_args)
return this.equals((breedInfo_args)that);
return false;
}
public boolean equals(breedInfo_args that) {
if (that == null)
return false;
boolean this_present_breedName = true && this.isSetBreedName();
boolean that_present_breedName = true && that.isSetBreedName();
if (this_present_breedName || that_present_breedName) {
if (!(this_present_breedName && that_present_breedName))
return false;
if (!this.breedName.equals(that.breedName))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_breedName = true && (isSetBreedName());
builder.append(present_breedName);
if (present_breedName)
builder.append(breedName);
return builder.toHashCode();
}
public int compareTo(breedInfo_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
breedInfo_args typedOther = (breedInfo_args)other;
lastComparison = Boolean.valueOf(isSetBreedName()).compareTo(typedOther.isSetBreedName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBreedName()) {
lastComparison = TBaseHelper.compareTo(this.breedName, typedOther.breedName);
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: // BREED_NAME
if (field.type == TType.STRING) {
this.breedName = iprot.readString();
} 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.breedName != null) {
oprot.writeFieldBegin(BREED_NAME_FIELD_DESC);
oprot.writeString(this.breedName);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("breedInfo_args(");
boolean first = true;
sb.append("breedName:");
if (this.breedName == null) {
sb.append("null");
} else {
sb.append(this.breedName);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}
public static class breedInfo_result implements TBase<breedInfo_result, breedInfo_result._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("breedInfo_result");
private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
public BreedInfoResponse success;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
SUCCESS((short)0, "success");
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 0: // SUCCESS
return SUCCESS;
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
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, BreedInfoResponse.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(breedInfo_result.class, metaDataMap);
}
public breedInfo_result() {
}
public breedInfo_result(
BreedInfoResponse success)
{
this();
this.success = success;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public breedInfo_result(breedInfo_result other) {
if (other.isSetSuccess()) {
this.success = new BreedInfoResponse(other.success);
}
}
public breedInfo_result deepCopy() {
return new breedInfo_result(this);
}
@Override
public void clear() {
this.success = null;
}
public BreedInfoResponse getSuccess() {
return this.success;
}
public breedInfo_result setSuccess(BreedInfoResponse success) {
this.success = success;
return this;
}
public void unsetSuccess() {
this.success = null;
}
/** Returns true if field success is set (has been asigned a value) and false otherwise */
public boolean isSetSuccess() {
return this.success != null;
}
public void setSuccessIsSet(boolean value) {
if (!value) {
this.success = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((BreedInfoResponse)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return getSuccess();
}
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 SUCCESS:
return isSetSuccess();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof breedInfo_result)
return this.equals((breedInfo_result)that);
return false;
}
public boolean equals(breedInfo_result that) {
if (that == null)
return false;
boolean this_present_success = true && this.isSetSuccess();
boolean that_present_success = true && that.isSetSuccess();
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (!this.success.equals(that.success))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_success = true && (isSetSuccess());
builder.append(present_success);
if (present_success)
builder.append(success);
return builder.toHashCode();
}
public int compareTo(breedInfo_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
breedInfo_result typedOther = (breedInfo_result)other;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
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 0: // SUCCESS
if (field.type == TType.STRUCT) {
this.success = new BreedInfoResponse();
this.success.read(iprot);
} 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 {
oprot.writeStructBegin(STRUCT_DESC);
if (this.isSetSuccess()) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
this.success.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("breedInfo_result(");
boolean first = true;
sb.append("success:");
if (this.success == null) {
sb.append("null");
} else {
sb.append(this.success);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}
}