/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.sergilos.servicemanager.remote.test;
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 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;
public class MathTestServiceSubtraction {
public interface Iface {
public int testingSubtract(int val1, int val2) throws org.apache.thrift.TException;
}
public interface AsyncIface {
public void testingSubtract(int val1, int val2, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.testingSubtract_call> resultHandler) throws org.apache.thrift.TException;
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
public Factory() {}
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
return new Client(prot);
}
public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(org.apache.thrift.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
super(iprot, oprot);
}
public int testingSubtract(int val1, int val2) throws org.apache.thrift.TException
{
send_testingSubtract(val1, val2);
return recv_testingSubtract();
}
public void send_testingSubtract(int val1, int val2) throws org.apache.thrift.TException
{
testingSubtract_args args = new testingSubtract_args();
args.setVal1(val1);
args.setVal2(val2);
sendBase("testingSubtract", args);
}
public int recv_testingSubtract() throws org.apache.thrift.TException
{
testingSubtract_result result = new testingSubtract_result();
receiveBase(result, "testingSubtract");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "testingSubtract failed: unknown result");
}
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
private org.apache.thrift.async.TAsyncClientManager clientManager;
private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void testingSubtract(int val1, int val2, org.apache.thrift.async.AsyncMethodCallback<testingSubtract_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
testingSubtract_call method_call = new testingSubtract_call(val1, val2, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class testingSubtract_call extends org.apache.thrift.async.TAsyncMethodCall {
private int val1;
private int val2;
public testingSubtract_call(int val1, int val2, org.apache.thrift.async.AsyncMethodCallback<testingSubtract_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.val1 = val1;
this.val2 = val2;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("testingSubtract", org.apache.thrift.protocol.TMessageType.CALL, 0));
testingSubtract_args args = new testingSubtract_args();
args.setVal1(val1);
args.setVal2(val2);
args.write(prot);
prot.writeMessageEnd();
}
public int getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_testingSubtract();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("testingSubtract", new testingSubtract());
return processMap;
}
public static class testingSubtract<I extends Iface> extends org.apache.thrift.ProcessFunction<I, testingSubtract_args> {
public testingSubtract() {
super("testingSubtract");
}
public testingSubtract_args getEmptyArgsInstance() {
return new testingSubtract_args();
}
protected boolean isOneway() {
return false;
}
public testingSubtract_result getResult(I iface, testingSubtract_args args) throws org.apache.thrift.TException {
testingSubtract_result result = new testingSubtract_result();
result.success = iface.testingSubtract(args.val1, args.val2);
result.setSuccessIsSet(true);
return result;
}
}
}
public static class testingSubtract_args implements org.apache.thrift.TBase<testingSubtract_args, testingSubtract_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testingSubtract_args");
private static final org.apache.thrift.protocol.TField VAL1_FIELD_DESC = new org.apache.thrift.protocol.TField("val1", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField VAL2_FIELD_DESC = new org.apache.thrift.protocol.TField("val2", org.apache.thrift.protocol.TType.I32, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new testingSubtract_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new testingSubtract_argsTupleSchemeFactory());
}
public int val1; // required
public int val2; // 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 {
VAL1((short)1, "val1"),
VAL2((short)2, "val2");
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: // VAL1
return VAL1;
case 2: // VAL2
return VAL2;
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 __VAL1_ISSET_ID = 0;
private static final int __VAL2_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.VAL1, new org.apache.thrift.meta_data.FieldMetaData("val1", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.VAL2, new org.apache.thrift.meta_data.FieldMetaData("val2", 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(testingSubtract_args.class, metaDataMap);
}
public testingSubtract_args() {
}
public testingSubtract_args(
int val1,
int val2)
{
this();
this.val1 = val1;
setVal1IsSet(true);
this.val2 = val2;
setVal2IsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public testingSubtract_args(testingSubtract_args other) {
__isset_bitfield = other.__isset_bitfield;
this.val1 = other.val1;
this.val2 = other.val2;
}
public testingSubtract_args deepCopy() {
return new testingSubtract_args(this);
}
@Override
public void clear() {
setVal1IsSet(false);
this.val1 = 0;
setVal2IsSet(false);
this.val2 = 0;
}
public int getVal1() {
return this.val1;
}
public testingSubtract_args setVal1(int val1) {
this.val1 = val1;
setVal1IsSet(true);
return this;
}
public void unsetVal1() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VAL1_ISSET_ID);
}
/** Returns true if field val1 is set (has been assigned a value) and false otherwise */
public boolean isSetVal1() {
return EncodingUtils.testBit(__isset_bitfield, __VAL1_ISSET_ID);
}
public void setVal1IsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VAL1_ISSET_ID, value);
}
public int getVal2() {
return this.val2;
}
public testingSubtract_args setVal2(int val2) {
this.val2 = val2;
setVal2IsSet(true);
return this;
}
public void unsetVal2() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VAL2_ISSET_ID);
}
/** Returns true if field val2 is set (has been assigned a value) and false otherwise */
public boolean isSetVal2() {
return EncodingUtils.testBit(__isset_bitfield, __VAL2_ISSET_ID);
}
public void setVal2IsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VAL2_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case VAL1:
if (value == null) {
unsetVal1();
} else {
setVal1((Integer)value);
}
break;
case VAL2:
if (value == null) {
unsetVal2();
} else {
setVal2((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case VAL1:
return Integer.valueOf(getVal1());
case VAL2:
return Integer.valueOf(getVal2());
}
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 VAL1:
return isSetVal1();
case VAL2:
return isSetVal2();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof testingSubtract_args)
return this.equals((testingSubtract_args)that);
return false;
}
public boolean equals(testingSubtract_args that) {
if (that == null)
return false;
boolean this_present_val1 = true;
boolean that_present_val1 = true;
if (this_present_val1 || that_present_val1) {
if (!(this_present_val1 && that_present_val1))
return false;
if (this.val1 != that.val1)
return false;
}
boolean this_present_val2 = true;
boolean that_present_val2 = true;
if (this_present_val2 || that_present_val2) {
if (!(this_present_val2 && that_present_val2))
return false;
if (this.val2 != that.val2)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(testingSubtract_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
testingSubtract_args typedOther = (testingSubtract_args)other;
lastComparison = Boolean.valueOf(isSetVal1()).compareTo(typedOther.isSetVal1());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVal1()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.val1, typedOther.val1);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetVal2()).compareTo(typedOther.isSetVal2());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVal2()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.val2, typedOther.val2);
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("testingSubtract_args(");
boolean first = true;
sb.append("val1:");
sb.append(this.val1);
first = false;
if (!first) sb.append(", ");
sb.append("val2:");
sb.append(this.val2);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// 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 testingSubtract_argsStandardSchemeFactory implements SchemeFactory {
public testingSubtract_argsStandardScheme getScheme() {
return new testingSubtract_argsStandardScheme();
}
}
private static class testingSubtract_argsStandardScheme extends StandardScheme<testingSubtract_args> {
public void read(org.apache.thrift.protocol.TProtocol iprot, testingSubtract_args 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: // VAL1
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.val1 = iprot.readI32();
struct.setVal1IsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // VAL2
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.val2 = iprot.readI32();
struct.setVal2IsSet(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, testingSubtract_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(VAL1_FIELD_DESC);
oprot.writeI32(struct.val1);
oprot.writeFieldEnd();
oprot.writeFieldBegin(VAL2_FIELD_DESC);
oprot.writeI32(struct.val2);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class testingSubtract_argsTupleSchemeFactory implements SchemeFactory {
public testingSubtract_argsTupleScheme getScheme() {
return new testingSubtract_argsTupleScheme();
}
}
private static class testingSubtract_argsTupleScheme extends TupleScheme<testingSubtract_args> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, testingSubtract_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetVal1()) {
optionals.set(0);
}
if (struct.isSetVal2()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetVal1()) {
oprot.writeI32(struct.val1);
}
if (struct.isSetVal2()) {
oprot.writeI32(struct.val2);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, testingSubtract_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.val1 = iprot.readI32();
struct.setVal1IsSet(true);
}
if (incoming.get(1)) {
struct.val2 = iprot.readI32();
struct.setVal2IsSet(true);
}
}
}
}
public static class testingSubtract_result implements org.apache.thrift.TBase<testingSubtract_result, testingSubtract_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("testingSubtract_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new testingSubtract_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new testingSubtract_resultTupleSchemeFactory());
}
public int success; // 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 {
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
private static final int __SUCCESS_ISSET_ID = 0;
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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", 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(testingSubtract_result.class, metaDataMap);
}
public testingSubtract_result() {
}
public testingSubtract_result(
int success)
{
this();
this.success = success;
setSuccessIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public testingSubtract_result(testingSubtract_result other) {
__isset_bitfield = other.__isset_bitfield;
this.success = other.success;
}
public testingSubtract_result deepCopy() {
return new testingSubtract_result(this);
}
@Override
public void clear() {
setSuccessIsSet(false);
this.success = 0;
}
public int getSuccess() {
return this.success;
}
public testingSubtract_result setSuccess(int success) {
this.success = success;
setSuccessIsSet(true);
return this;
}
public void unsetSuccess() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
public void setSuccessIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return Integer.valueOf(getSuccess());
}
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 SUCCESS:
return isSetSuccess();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof testingSubtract_result)
return this.equals((testingSubtract_result)that);
return false;
}
public boolean equals(testingSubtract_result that) {
if (that == null)
return false;
boolean this_present_success = true;
boolean that_present_success = true;
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (this.success != that.success)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(testingSubtract_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
testingSubtract_result typedOther = (testingSubtract_result)other;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.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(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("testingSubtract_result(");
boolean first = true;
sb.append("success:");
sb.append(this.success);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// 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 testingSubtract_resultStandardSchemeFactory implements SchemeFactory {
public testingSubtract_resultStandardScheme getScheme() {
return new testingSubtract_resultStandardScheme();
}
}
private static class testingSubtract_resultStandardScheme extends StandardScheme<testingSubtract_result> {
public void read(org.apache.thrift.protocol.TProtocol iprot, testingSubtract_result 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 0: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.success = iprot.readI32();
struct.setSuccessIsSet(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, testingSubtract_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetSuccess()) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
oprot.writeI32(struct.success);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class testingSubtract_resultTupleSchemeFactory implements SchemeFactory {
public testingSubtract_resultTupleScheme getScheme() {
return new testingSubtract_resultTupleScheme();
}
}
private static class testingSubtract_resultTupleScheme extends TupleScheme<testingSubtract_result> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, testingSubtract_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
oprot.writeI32(struct.success);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, testingSubtract_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = iprot.readI32();
struct.setSuccessIsSet(true);
}
}
}
}
}