mirror of
https://gitee.com/nutz/nutzboot.git
synced 2024-11-29 18:28:01 +08:00
remove: 移除编译失败的test代码
This commit is contained in:
parent
cd0077fafe
commit
8a0060f094
@ -1,974 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package shared;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-02")
|
||||
public class SharedService {
|
||||
|
||||
public interface Iface {
|
||||
|
||||
public SharedStruct getStruct(int key) throws org.apache.thrift.TException;
|
||||
|
||||
}
|
||||
|
||||
public interface AsyncIface {
|
||||
|
||||
public void getStruct(int key, org.apache.thrift.async.AsyncMethodCallback<SharedStruct> 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 SharedStruct getStruct(int key) throws org.apache.thrift.TException
|
||||
{
|
||||
send_getStruct(key);
|
||||
return recv_getStruct();
|
||||
}
|
||||
|
||||
public void send_getStruct(int key) throws org.apache.thrift.TException
|
||||
{
|
||||
getStruct_args args = new getStruct_args();
|
||||
args.setKey(key);
|
||||
sendBase("getStruct", args);
|
||||
}
|
||||
|
||||
public SharedStruct recv_getStruct() throws org.apache.thrift.TException
|
||||
{
|
||||
getStruct_result result = new getStruct_result();
|
||||
receiveBase(result, "getStruct");
|
||||
if (result.isSetSuccess()) {
|
||||
return result.success;
|
||||
}
|
||||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getStruct 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 getStruct(int key, org.apache.thrift.async.AsyncMethodCallback<SharedStruct> resultHandler) throws org.apache.thrift.TException {
|
||||
checkReady();
|
||||
getStruct_call method_call = new getStruct_call(key, resultHandler, this, ___protocolFactory, ___transport);
|
||||
this.___currentMethod = method_call;
|
||||
___manager.call(method_call);
|
||||
}
|
||||
|
||||
public static class getStruct_call extends org.apache.thrift.async.TAsyncMethodCall<SharedStruct> {
|
||||
private int key;
|
||||
public getStruct_call(int key, org.apache.thrift.async.AsyncMethodCallback<SharedStruct> 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.key = key;
|
||||
}
|
||||
|
||||
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
|
||||
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getStruct", org.apache.thrift.protocol.TMessageType.CALL, 0));
|
||||
getStruct_args args = new getStruct_args();
|
||||
args.setKey(key);
|
||||
args.write(prot);
|
||||
prot.writeMessageEnd();
|
||||
}
|
||||
|
||||
public SharedStruct getResult() throws org.apache.thrift.TException {
|
||||
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
|
||||
throw new java.lang.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_getStruct();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
|
||||
private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
|
||||
public Processor(I iface) {
|
||||
super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
|
||||
}
|
||||
|
||||
protected Processor(I iface, java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
|
||||
super(iface, getProcessMap(processMap));
|
||||
}
|
||||
|
||||
private static <I extends Iface> java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
|
||||
processMap.put("getStruct", new getStruct());
|
||||
return processMap;
|
||||
}
|
||||
|
||||
public static class getStruct<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getStruct_args> {
|
||||
public getStruct() {
|
||||
super("getStruct");
|
||||
}
|
||||
|
||||
public getStruct_args getEmptyArgsInstance() {
|
||||
return new getStruct_args();
|
||||
}
|
||||
|
||||
protected boolean isOneway() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean rethrowUnhandledExceptions() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getStruct_result getResult(I iface, getStruct_args args) throws org.apache.thrift.TException {
|
||||
getStruct_result result = new getStruct_result();
|
||||
result.success = iface.getStruct(args.key);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
|
||||
private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
|
||||
public AsyncProcessor(I iface) {
|
||||
super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
|
||||
}
|
||||
|
||||
protected AsyncProcessor(I iface, java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
|
||||
super(iface, getProcessMap(processMap));
|
||||
}
|
||||
|
||||
private static <I extends AsyncIface> java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
|
||||
processMap.put("getStruct", new getStruct());
|
||||
return processMap;
|
||||
}
|
||||
|
||||
public static class getStruct<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getStruct_args, SharedStruct> {
|
||||
public getStruct() {
|
||||
super("getStruct");
|
||||
}
|
||||
|
||||
public getStruct_args getEmptyArgsInstance() {
|
||||
return new getStruct_args();
|
||||
}
|
||||
|
||||
public org.apache.thrift.async.AsyncMethodCallback<SharedStruct> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
|
||||
final org.apache.thrift.AsyncProcessFunction fcall = this;
|
||||
return new org.apache.thrift.async.AsyncMethodCallback<SharedStruct>() {
|
||||
public void onComplete(SharedStruct o) {
|
||||
getStruct_result result = new getStruct_result();
|
||||
result.success = o;
|
||||
try {
|
||||
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
|
||||
} catch (org.apache.thrift.transport.TTransportException e) {
|
||||
_LOGGER.error("TTransportException writing to internal frame buffer", e);
|
||||
fb.close();
|
||||
} catch (java.lang.Exception e) {
|
||||
_LOGGER.error("Exception writing to internal frame buffer", e);
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
public void onError(java.lang.Exception e) {
|
||||
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
|
||||
org.apache.thrift.TSerializable msg;
|
||||
getStruct_result result = new getStruct_result();
|
||||
if (e instanceof org.apache.thrift.transport.TTransportException) {
|
||||
_LOGGER.error("TTransportException inside handler", e);
|
||||
fb.close();
|
||||
return;
|
||||
} else if (e instanceof org.apache.thrift.TApplicationException) {
|
||||
_LOGGER.error("TApplicationException inside handler", e);
|
||||
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
|
||||
msg = (org.apache.thrift.TApplicationException)e;
|
||||
} else {
|
||||
_LOGGER.error("Exception inside handler", e);
|
||||
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
|
||||
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
try {
|
||||
fcall.sendResponse(fb,msg,msgType,seqid);
|
||||
} catch (java.lang.Exception ex) {
|
||||
_LOGGER.error("Exception writing to internal frame buffer", ex);
|
||||
fb.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected boolean isOneway() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void start(I iface, getStruct_args args, org.apache.thrift.async.AsyncMethodCallback<SharedStruct> resultHandler) throws org.apache.thrift.TException {
|
||||
iface.getStruct(args.key,resultHandler);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class getStruct_args implements org.apache.thrift.TBase<getStruct_args, getStruct_args._Fields>, java.io.Serializable, Cloneable, Comparable<getStruct_args> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStruct_args");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.I32, (short)1);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getStruct_argsStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getStruct_argsTupleSchemeFactory();
|
||||
|
||||
public int key; // 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 {
|
||||
KEY((short)1, "key");
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
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: // KEY
|
||||
return KEY;
|
||||
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 int __KEY_ISSET_ID = 0;
|
||||
private byte __isset_bitfield = 0;
|
||||
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.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStruct_args.class, metaDataMap);
|
||||
}
|
||||
|
||||
public getStruct_args() {
|
||||
}
|
||||
|
||||
public getStruct_args(
|
||||
int key)
|
||||
{
|
||||
this();
|
||||
this.key = key;
|
||||
setKeyIsSet(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public getStruct_args(getStruct_args other) {
|
||||
__isset_bitfield = other.__isset_bitfield;
|
||||
this.key = other.key;
|
||||
}
|
||||
|
||||
public getStruct_args deepCopy() {
|
||||
return new getStruct_args(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
setKeyIsSet(false);
|
||||
this.key = 0;
|
||||
}
|
||||
|
||||
public int getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public getStruct_args setKey(int key) {
|
||||
this.key = key;
|
||||
setKeyIsSet(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetKey() {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __KEY_ISSET_ID);
|
||||
}
|
||||
|
||||
/** Returns true if field key is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetKey() {
|
||||
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __KEY_ISSET_ID);
|
||||
}
|
||||
|
||||
public void setKeyIsSet(boolean value) {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __KEY_ISSET_ID, value);
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
if (value == null) {
|
||||
unsetKey();
|
||||
} else {
|
||||
setKey((java.lang.Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
return getKey();
|
||||
|
||||
}
|
||||
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 KEY:
|
||||
return isSetKey();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof getStruct_args)
|
||||
return this.equals((getStruct_args)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(getStruct_args that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
boolean this_present_key = true;
|
||||
boolean that_present_key = true;
|
||||
if (this_present_key || that_present_key) {
|
||||
if (!(this_present_key && that_present_key))
|
||||
return false;
|
||||
if (this.key != that.key)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + key;
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(getStruct_args other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
|
||||
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("getStruct_args(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("key:");
|
||||
sb.append(this.key);
|
||||
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, java.lang.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 getStruct_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public getStruct_argsStandardScheme getScheme() {
|
||||
return new getStruct_argsStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class getStruct_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getStruct_args> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, getStruct_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: // KEY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.key = iprot.readI32();
|
||||
struct.setKeyIsSet(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, getStruct_args struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldBegin(KEY_FIELD_DESC);
|
||||
oprot.writeI32(struct.key);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class getStruct_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public getStruct_argsTupleScheme getScheme() {
|
||||
return new getStruct_argsTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class getStruct_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getStruct_args> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, getStruct_args 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.isSetKey()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetKey()) {
|
||||
oprot.writeI32(struct.key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, getStruct_args struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
struct.key = iprot.readI32();
|
||||
struct.setKeyIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> 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();
|
||||
}
|
||||
}
|
||||
|
||||
public static class getStruct_result implements org.apache.thrift.TBase<getStruct_result, getStruct_result._Fields>, java.io.Serializable, Cloneable, Comparable<getStruct_result> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStruct_result");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getStruct_resultStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getStruct_resultTupleSchemeFactory();
|
||||
|
||||
public @org.apache.thrift.annotation.Nullable SharedStruct 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 java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
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 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 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
|
||||
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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SharedStruct.class)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStruct_result.class, metaDataMap);
|
||||
}
|
||||
|
||||
public getStruct_result() {
|
||||
}
|
||||
|
||||
public getStruct_result(
|
||||
SharedStruct success)
|
||||
{
|
||||
this();
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public getStruct_result(getStruct_result other) {
|
||||
if (other.isSetSuccess()) {
|
||||
this.success = new SharedStruct(other.success);
|
||||
}
|
||||
}
|
||||
|
||||
public getStruct_result deepCopy() {
|
||||
return new getStruct_result(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.success = null;
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public SharedStruct getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public getStruct_result setSuccess(@org.apache.thrift.annotation.Nullable SharedStruct success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetSuccess() {
|
||||
this.success = null;
|
||||
}
|
||||
|
||||
/** Returns true if field success is set (has been assigned 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, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case SUCCESS:
|
||||
if (value == null) {
|
||||
unsetSuccess();
|
||||
} else {
|
||||
setSuccess((SharedStruct)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case SUCCESS:
|
||||
return getSuccess();
|
||||
|
||||
}
|
||||
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 SUCCESS:
|
||||
return isSetSuccess();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof getStruct_result)
|
||||
return this.equals((getStruct_result)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(getStruct_result that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
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() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
|
||||
if (isSetSuccess())
|
||||
hashCode = hashCode * 8191 + success.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(getStruct_result other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetSuccess()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
|
||||
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("getStruct_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 org.apache.thrift.TException {
|
||||
// check for required fields
|
||||
// check for sub-struct validity
|
||||
if (success != null) {
|
||||
success.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 getStruct_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public getStruct_resultStandardScheme getScheme() {
|
||||
return new getStruct_resultStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class getStruct_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getStruct_result> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, getStruct_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.STRUCT) {
|
||||
struct.success = new SharedStruct();
|
||||
struct.success.read(iprot);
|
||||
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, getStruct_result struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.success != null) {
|
||||
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
|
||||
struct.success.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class getStruct_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public getStruct_resultTupleScheme getScheme() {
|
||||
return new getStruct_resultTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class getStruct_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getStruct_result> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, getStruct_result 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.isSetSuccess()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetSuccess()) {
|
||||
struct.success.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, getStruct_result struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
struct.success = new SharedStruct();
|
||||
struct.success.read(iprot);
|
||||
struct.setSuccessIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,477 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package shared;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-02")
|
||||
public class SharedStruct implements org.apache.thrift.TBase<SharedStruct, SharedStruct._Fields>, java.io.Serializable, Cloneable, Comparable<SharedStruct> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SharedStruct");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.I32, (short)1);
|
||||
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SharedStructStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new SharedStructTupleSchemeFactory();
|
||||
|
||||
public int key; // required
|
||||
public @org.apache.thrift.annotation.Nullable java.lang.String value; // 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 {
|
||||
KEY((short)1, "key"),
|
||||
VALUE((short)2, "value");
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
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: // KEY
|
||||
return KEY;
|
||||
case 2: // VALUE
|
||||
return VALUE;
|
||||
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 int __KEY_ISSET_ID = 0;
|
||||
private byte __isset_bitfield = 0;
|
||||
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.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SharedStruct.class, metaDataMap);
|
||||
}
|
||||
|
||||
public SharedStruct() {
|
||||
}
|
||||
|
||||
public SharedStruct(
|
||||
int key,
|
||||
java.lang.String value)
|
||||
{
|
||||
this();
|
||||
this.key = key;
|
||||
setKeyIsSet(true);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public SharedStruct(SharedStruct other) {
|
||||
__isset_bitfield = other.__isset_bitfield;
|
||||
this.key = other.key;
|
||||
if (other.isSetValue()) {
|
||||
this.value = other.value;
|
||||
}
|
||||
}
|
||||
|
||||
public SharedStruct deepCopy() {
|
||||
return new SharedStruct(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
setKeyIsSet(false);
|
||||
this.key = 0;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public int getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public SharedStruct setKey(int key) {
|
||||
this.key = key;
|
||||
setKeyIsSet(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetKey() {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __KEY_ISSET_ID);
|
||||
}
|
||||
|
||||
/** Returns true if field key is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetKey() {
|
||||
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __KEY_ISSET_ID);
|
||||
}
|
||||
|
||||
public void setKeyIsSet(boolean value) {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __KEY_ISSET_ID, value);
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public SharedStruct setValue(@org.apache.thrift.annotation.Nullable java.lang.String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetValue() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
/** Returns true if field value is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetValue() {
|
||||
return this.value != null;
|
||||
}
|
||||
|
||||
public void setValueIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
if (value == null) {
|
||||
unsetKey();
|
||||
} else {
|
||||
setKey((java.lang.Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((java.lang.String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case KEY:
|
||||
return getKey();
|
||||
|
||||
case VALUE:
|
||||
return getValue();
|
||||
|
||||
}
|
||||
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 KEY:
|
||||
return isSetKey();
|
||||
case VALUE:
|
||||
return isSetValue();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof SharedStruct)
|
||||
return this.equals((SharedStruct)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(SharedStruct that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
boolean this_present_key = true;
|
||||
boolean that_present_key = true;
|
||||
if (this_present_key || that_present_key) {
|
||||
if (!(this_present_key && that_present_key))
|
||||
return false;
|
||||
if (this.key != that.key)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_value = true && this.isSetValue();
|
||||
boolean that_present_value = true && that.isSetValue();
|
||||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + key;
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetValue()) ? 131071 : 524287);
|
||||
if (isSetValue())
|
||||
hashCode = hashCode * 8191 + value.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SharedStruct other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetKey()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetValue()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
|
||||
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("SharedStruct(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("key:");
|
||||
sb.append(this.key);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("value:");
|
||||
if (this.value == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.value);
|
||||
}
|
||||
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, java.lang.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 SharedStructStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public SharedStructStandardScheme getScheme() {
|
||||
return new SharedStructStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class SharedStructStandardScheme extends org.apache.thrift.scheme.StandardScheme<SharedStruct> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, SharedStruct 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: // KEY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.key = iprot.readI32();
|
||||
struct.setKeyIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 2: // VALUE
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.value = iprot.readString();
|
||||
struct.setValueIsSet(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, SharedStruct struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldBegin(KEY_FIELD_DESC);
|
||||
oprot.writeI32(struct.key);
|
||||
oprot.writeFieldEnd();
|
||||
if (struct.value != null) {
|
||||
oprot.writeFieldBegin(VALUE_FIELD_DESC);
|
||||
oprot.writeString(struct.value);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class SharedStructTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public SharedStructTupleScheme getScheme() {
|
||||
return new SharedStructTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class SharedStructTupleScheme extends org.apache.thrift.scheme.TupleScheme<SharedStruct> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, SharedStruct 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.isSetKey()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
if (struct.isSetValue()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetKey()) {
|
||||
oprot.writeI32(struct.key);
|
||||
}
|
||||
if (struct.isSetValue()) {
|
||||
oprot.writeString(struct.value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, SharedStruct 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.key = iprot.readI32();
|
||||
struct.setKeyIsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
struct.value = iprot.readString();
|
||||
struct.setValueIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> 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();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +0,0 @@
|
||||
package tutorial;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.thrift.TProcessor;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
// Generated code
|
||||
import shared.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@IocBean // 增加Ioc配置
|
||||
public class CalculatorHandler implements Calculator.Iface {
|
||||
|
||||
// 声明一个IocBean工厂方法,返回TProcessor实例,就这么简单
|
||||
@IocBean
|
||||
public TProcessor createCalculatorTProcessor() {
|
||||
return new Calculator.Processor(this);
|
||||
}
|
||||
|
||||
private HashMap<Integer,SharedStruct> log;
|
||||
|
||||
public CalculatorHandler() {
|
||||
log = new HashMap<Integer, SharedStruct>();
|
||||
}
|
||||
|
||||
public void ping() {
|
||||
System.out.println("ping()");
|
||||
}
|
||||
|
||||
public int add(int n1, int n2) {
|
||||
System.out.println("add(" + n1 + "," + n2 + ")");
|
||||
return n1 + n2;
|
||||
}
|
||||
|
||||
public int calculate(int logid, Work work) throws InvalidOperation {
|
||||
System.out.println("calculate(" + logid + ", {" + work.op + "," + work.num1 + "," + work.num2 + "})");
|
||||
int val = 0;
|
||||
switch (work.op) {
|
||||
case ADD:
|
||||
val = work.num1 + work.num2;
|
||||
break;
|
||||
case SUBTRACT:
|
||||
val = work.num1 - work.num2;
|
||||
break;
|
||||
case MULTIPLY:
|
||||
val = work.num1 * work.num2;
|
||||
break;
|
||||
case DIVIDE:
|
||||
if (work.num2 == 0) {
|
||||
InvalidOperation io = new InvalidOperation();
|
||||
io.whatOp = work.op.getValue();
|
||||
io.why = "Cannot divide by 0";
|
||||
throw io;
|
||||
}
|
||||
val = work.num1 / work.num2;
|
||||
break;
|
||||
default:
|
||||
InvalidOperation io = new InvalidOperation();
|
||||
io.whatOp = work.op.getValue();
|
||||
io.why = "Unknown operation";
|
||||
throw io;
|
||||
}
|
||||
|
||||
SharedStruct entry = new SharedStruct();
|
||||
entry.key = logid;
|
||||
entry.value = Integer.toString(val);
|
||||
log.put(logid, entry);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public SharedStruct getStruct(int key) {
|
||||
System.out.println("getStruct(" + key + ")");
|
||||
return log.get(key);
|
||||
}
|
||||
|
||||
public void zip() {
|
||||
System.out.println("zip()");
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package tutorial;
|
||||
|
||||
import org.nutz.boot.NbApp;
|
||||
|
||||
public class CalculatorLauncher {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new NbApp().run();
|
||||
}
|
||||
|
||||
}
|
@ -1,480 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package tutorial;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
/**
|
||||
* Structs can also be exceptions, if they are nasty.
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-01")
|
||||
public class InvalidOperation extends org.apache.thrift.TException implements org.apache.thrift.TBase<InvalidOperation, InvalidOperation._Fields>, java.io.Serializable, Cloneable, Comparable<InvalidOperation> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidOperation");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField WHAT_OP_FIELD_DESC = new org.apache.thrift.protocol.TField("whatOp", org.apache.thrift.protocol.TType.I32, (short)1);
|
||||
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", org.apache.thrift.protocol.TType.STRING, (short)2);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new InvalidOperationStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new InvalidOperationTupleSchemeFactory();
|
||||
|
||||
public int whatOp; // required
|
||||
public @org.apache.thrift.annotation.Nullable java.lang.String why; // 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 {
|
||||
WHAT_OP((short)1, "whatOp"),
|
||||
WHY((short)2, "why");
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
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: // WHAT_OP
|
||||
return WHAT_OP;
|
||||
case 2: // WHY
|
||||
return WHY;
|
||||
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 int __WHATOP_ISSET_ID = 0;
|
||||
private byte __isset_bitfield = 0;
|
||||
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.WHAT_OP, new org.apache.thrift.meta_data.FieldMetaData("whatOp", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
tmpMap.put(_Fields.WHY, new org.apache.thrift.meta_data.FieldMetaData("why", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidOperation.class, metaDataMap);
|
||||
}
|
||||
|
||||
public InvalidOperation() {
|
||||
}
|
||||
|
||||
public InvalidOperation(
|
||||
int whatOp,
|
||||
java.lang.String why)
|
||||
{
|
||||
this();
|
||||
this.whatOp = whatOp;
|
||||
setWhatOpIsSet(true);
|
||||
this.why = why;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public InvalidOperation(InvalidOperation other) {
|
||||
__isset_bitfield = other.__isset_bitfield;
|
||||
this.whatOp = other.whatOp;
|
||||
if (other.isSetWhy()) {
|
||||
this.why = other.why;
|
||||
}
|
||||
}
|
||||
|
||||
public InvalidOperation deepCopy() {
|
||||
return new InvalidOperation(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
setWhatOpIsSet(false);
|
||||
this.whatOp = 0;
|
||||
this.why = null;
|
||||
}
|
||||
|
||||
public int getWhatOp() {
|
||||
return this.whatOp;
|
||||
}
|
||||
|
||||
public InvalidOperation setWhatOp(int whatOp) {
|
||||
this.whatOp = whatOp;
|
||||
setWhatOpIsSet(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetWhatOp() {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __WHATOP_ISSET_ID);
|
||||
}
|
||||
|
||||
/** Returns true if field whatOp is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetWhatOp() {
|
||||
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __WHATOP_ISSET_ID);
|
||||
}
|
||||
|
||||
public void setWhatOpIsSet(boolean value) {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __WHATOP_ISSET_ID, value);
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.String getWhy() {
|
||||
return this.why;
|
||||
}
|
||||
|
||||
public InvalidOperation setWhy(@org.apache.thrift.annotation.Nullable java.lang.String why) {
|
||||
this.why = why;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetWhy() {
|
||||
this.why = null;
|
||||
}
|
||||
|
||||
/** Returns true if field why is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetWhy() {
|
||||
return this.why != null;
|
||||
}
|
||||
|
||||
public void setWhyIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.why = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case WHAT_OP:
|
||||
if (value == null) {
|
||||
unsetWhatOp();
|
||||
} else {
|
||||
setWhatOp((java.lang.Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case WHY:
|
||||
if (value == null) {
|
||||
unsetWhy();
|
||||
} else {
|
||||
setWhy((java.lang.String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case WHAT_OP:
|
||||
return getWhatOp();
|
||||
|
||||
case WHY:
|
||||
return getWhy();
|
||||
|
||||
}
|
||||
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 WHAT_OP:
|
||||
return isSetWhatOp();
|
||||
case WHY:
|
||||
return isSetWhy();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof InvalidOperation)
|
||||
return this.equals((InvalidOperation)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(InvalidOperation that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
boolean this_present_whatOp = true;
|
||||
boolean that_present_whatOp = true;
|
||||
if (this_present_whatOp || that_present_whatOp) {
|
||||
if (!(this_present_whatOp && that_present_whatOp))
|
||||
return false;
|
||||
if (this.whatOp != that.whatOp)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_why = true && this.isSetWhy();
|
||||
boolean that_present_why = true && that.isSetWhy();
|
||||
if (this_present_why || that_present_why) {
|
||||
if (!(this_present_why && that_present_why))
|
||||
return false;
|
||||
if (!this.why.equals(that.why))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + whatOp;
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetWhy()) ? 131071 : 524287);
|
||||
if (isSetWhy())
|
||||
hashCode = hashCode * 8191 + why.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(InvalidOperation other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetWhatOp()).compareTo(other.isSetWhatOp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetWhatOp()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.whatOp, other.whatOp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetWhy()).compareTo(other.isSetWhy());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetWhy()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.why, other.why);
|
||||
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("InvalidOperation(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("whatOp:");
|
||||
sb.append(this.whatOp);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("why:");
|
||||
if (this.why == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.why);
|
||||
}
|
||||
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, java.lang.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 InvalidOperationStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public InvalidOperationStandardScheme getScheme() {
|
||||
return new InvalidOperationStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class InvalidOperationStandardScheme extends org.apache.thrift.scheme.StandardScheme<InvalidOperation> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidOperation 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: // WHAT_OP
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.whatOp = iprot.readI32();
|
||||
struct.setWhatOpIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 2: // WHY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.why = iprot.readString();
|
||||
struct.setWhyIsSet(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, InvalidOperation struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldBegin(WHAT_OP_FIELD_DESC);
|
||||
oprot.writeI32(struct.whatOp);
|
||||
oprot.writeFieldEnd();
|
||||
if (struct.why != null) {
|
||||
oprot.writeFieldBegin(WHY_FIELD_DESC);
|
||||
oprot.writeString(struct.why);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class InvalidOperationTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public InvalidOperationTupleScheme getScheme() {
|
||||
return new InvalidOperationTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class InvalidOperationTupleScheme extends org.apache.thrift.scheme.TupleScheme<InvalidOperation> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, InvalidOperation 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.isSetWhatOp()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
if (struct.isSetWhy()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetWhatOp()) {
|
||||
oprot.writeI32(struct.whatOp);
|
||||
}
|
||||
if (struct.isSetWhy()) {
|
||||
oprot.writeString(struct.why);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, InvalidOperation 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.whatOp = iprot.readI32();
|
||||
struct.setWhatOpIsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
struct.why = iprot.readString();
|
||||
struct.setWhyIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> 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();
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package tutorial;
|
||||
|
||||
|
||||
/**
|
||||
* You can define enums, which are just 32 bit integers. Values are optional
|
||||
* and start at 1 if not supplied, C style again.
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-01")
|
||||
public enum Operation implements org.apache.thrift.TEnum {
|
||||
ADD(1),
|
||||
SUBTRACT(2),
|
||||
MULTIPLY(3),
|
||||
DIVIDE(4);
|
||||
|
||||
private final int value;
|
||||
|
||||
private Operation(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the integer value of this enum value, as defined in the Thrift IDL.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a the enum type by its integer value, as defined in the Thrift IDL.
|
||||
* @return null if the value is not found.
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public static Operation findByValue(int value) {
|
||||
switch (value) {
|
||||
case 1:
|
||||
return ADD;
|
||||
case 2:
|
||||
return SUBTRACT;
|
||||
case 3:
|
||||
return MULTIPLY;
|
||||
case 4:
|
||||
return DIVIDE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,708 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package tutorial;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
/**
|
||||
* Structs are the basic complex data structures. They are comprised of fields
|
||||
* which each have an integer identifier, a type, a symbolic name, and an
|
||||
* optional default value.
|
||||
*
|
||||
* Fields can be declared "optional", which ensures they will not be included
|
||||
* in the serialized output if they aren't set. Note that this requires some
|
||||
* manual management in some languages.
|
||||
*/
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-01")
|
||||
public class Work implements org.apache.thrift.TBase<Work, Work._Fields>, java.io.Serializable, Cloneable, Comparable<Work> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Work");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField NUM1_FIELD_DESC = new org.apache.thrift.protocol.TField("num1", org.apache.thrift.protocol.TType.I32, (short)1);
|
||||
private static final org.apache.thrift.protocol.TField NUM2_FIELD_DESC = new org.apache.thrift.protocol.TField("num2", org.apache.thrift.protocol.TType.I32, (short)2);
|
||||
private static final org.apache.thrift.protocol.TField OP_FIELD_DESC = new org.apache.thrift.protocol.TField("op", org.apache.thrift.protocol.TType.I32, (short)3);
|
||||
private static final org.apache.thrift.protocol.TField COMMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("comment", org.apache.thrift.protocol.TType.STRING, (short)4);
|
||||
|
||||
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new WorkStandardSchemeFactory();
|
||||
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new WorkTupleSchemeFactory();
|
||||
|
||||
public int num1; // required
|
||||
public int num2; // required
|
||||
/**
|
||||
*
|
||||
* @see Operation
|
||||
*/
|
||||
public @org.apache.thrift.annotation.Nullable Operation op; // required
|
||||
public @org.apache.thrift.annotation.Nullable java.lang.String comment; // 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 {
|
||||
NUM1((short)1, "num1"),
|
||||
NUM2((short)2, "num2"),
|
||||
/**
|
||||
*
|
||||
* @see Operation
|
||||
*/
|
||||
OP((short)3, "op"),
|
||||
COMMENT((short)4, "comment");
|
||||
|
||||
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
|
||||
|
||||
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: // NUM1
|
||||
return NUM1;
|
||||
case 2: // NUM2
|
||||
return NUM2;
|
||||
case 3: // OP
|
||||
return OP;
|
||||
case 4: // COMMENT
|
||||
return COMMENT;
|
||||
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 int __NUM1_ISSET_ID = 0;
|
||||
private static final int __NUM2_ISSET_ID = 1;
|
||||
private byte __isset_bitfield = 0;
|
||||
private static final _Fields optionals[] = {_Fields.COMMENT};
|
||||
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.NUM1, new org.apache.thrift.meta_data.FieldMetaData("num1", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
tmpMap.put(_Fields.NUM2, new org.apache.thrift.meta_data.FieldMetaData("num2", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
tmpMap.put(_Fields.OP, new org.apache.thrift.meta_data.FieldMetaData("op", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Operation.class)));
|
||||
tmpMap.put(_Fields.COMMENT, new org.apache.thrift.meta_data.FieldMetaData("comment", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Work.class, metaDataMap);
|
||||
}
|
||||
|
||||
public Work() {
|
||||
this.num1 = 0;
|
||||
|
||||
}
|
||||
|
||||
public Work(
|
||||
int num1,
|
||||
int num2,
|
||||
Operation op)
|
||||
{
|
||||
this();
|
||||
this.num1 = num1;
|
||||
setNum1IsSet(true);
|
||||
this.num2 = num2;
|
||||
setNum2IsSet(true);
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public Work(Work other) {
|
||||
__isset_bitfield = other.__isset_bitfield;
|
||||
this.num1 = other.num1;
|
||||
this.num2 = other.num2;
|
||||
if (other.isSetOp()) {
|
||||
this.op = other.op;
|
||||
}
|
||||
if (other.isSetComment()) {
|
||||
this.comment = other.comment;
|
||||
}
|
||||
}
|
||||
|
||||
public Work deepCopy() {
|
||||
return new Work(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.num1 = 0;
|
||||
|
||||
setNum2IsSet(false);
|
||||
this.num2 = 0;
|
||||
this.op = null;
|
||||
this.comment = null;
|
||||
}
|
||||
|
||||
public int getNum1() {
|
||||
return this.num1;
|
||||
}
|
||||
|
||||
public Work setNum1(int num1) {
|
||||
this.num1 = num1;
|
||||
setNum1IsSet(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetNum1() {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM1_ISSET_ID);
|
||||
}
|
||||
|
||||
/** Returns true if field num1 is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetNum1() {
|
||||
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM1_ISSET_ID);
|
||||
}
|
||||
|
||||
public void setNum1IsSet(boolean value) {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM1_ISSET_ID, value);
|
||||
}
|
||||
|
||||
public int getNum2() {
|
||||
return this.num2;
|
||||
}
|
||||
|
||||
public Work setNum2(int num2) {
|
||||
this.num2 = num2;
|
||||
setNum2IsSet(true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetNum2() {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM2_ISSET_ID);
|
||||
}
|
||||
|
||||
/** Returns true if field num2 is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetNum2() {
|
||||
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM2_ISSET_ID);
|
||||
}
|
||||
|
||||
public void setNum2IsSet(boolean value) {
|
||||
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM2_ISSET_ID, value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see Operation
|
||||
*/
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public Operation getOp() {
|
||||
return this.op;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see Operation
|
||||
*/
|
||||
public Work setOp(@org.apache.thrift.annotation.Nullable Operation op) {
|
||||
this.op = op;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetOp() {
|
||||
this.op = null;
|
||||
}
|
||||
|
||||
/** Returns true if field op is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetOp() {
|
||||
return this.op != null;
|
||||
}
|
||||
|
||||
public void setOpIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.op = null;
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public Work setComment(@org.apache.thrift.annotation.Nullable java.lang.String comment) {
|
||||
this.comment = comment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetComment() {
|
||||
this.comment = null;
|
||||
}
|
||||
|
||||
/** Returns true if field comment is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetComment() {
|
||||
return this.comment != null;
|
||||
}
|
||||
|
||||
public void setCommentIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.comment = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
|
||||
switch (field) {
|
||||
case NUM1:
|
||||
if (value == null) {
|
||||
unsetNum1();
|
||||
} else {
|
||||
setNum1((java.lang.Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case NUM2:
|
||||
if (value == null) {
|
||||
unsetNum2();
|
||||
} else {
|
||||
setNum2((java.lang.Integer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case OP:
|
||||
if (value == null) {
|
||||
unsetOp();
|
||||
} else {
|
||||
setOp((Operation)value);
|
||||
}
|
||||
break;
|
||||
|
||||
case COMMENT:
|
||||
if (value == null) {
|
||||
unsetComment();
|
||||
} else {
|
||||
setComment((java.lang.String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@org.apache.thrift.annotation.Nullable
|
||||
public java.lang.Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NUM1:
|
||||
return getNum1();
|
||||
|
||||
case NUM2:
|
||||
return getNum2();
|
||||
|
||||
case OP:
|
||||
return getOp();
|
||||
|
||||
case COMMENT:
|
||||
return getComment();
|
||||
|
||||
}
|
||||
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 NUM1:
|
||||
return isSetNum1();
|
||||
case NUM2:
|
||||
return isSetNum2();
|
||||
case OP:
|
||||
return isSetOp();
|
||||
case COMMENT:
|
||||
return isSetComment();
|
||||
}
|
||||
throw new java.lang.IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof Work)
|
||||
return this.equals((Work)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Work that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
boolean this_present_num1 = true;
|
||||
boolean that_present_num1 = true;
|
||||
if (this_present_num1 || that_present_num1) {
|
||||
if (!(this_present_num1 && that_present_num1))
|
||||
return false;
|
||||
if (this.num1 != that.num1)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_num2 = true;
|
||||
boolean that_present_num2 = true;
|
||||
if (this_present_num2 || that_present_num2) {
|
||||
if (!(this_present_num2 && that_present_num2))
|
||||
return false;
|
||||
if (this.num2 != that.num2)
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_op = true && this.isSetOp();
|
||||
boolean that_present_op = true && that.isSetOp();
|
||||
if (this_present_op || that_present_op) {
|
||||
if (!(this_present_op && that_present_op))
|
||||
return false;
|
||||
if (!this.op.equals(that.op))
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_comment = true && this.isSetComment();
|
||||
boolean that_present_comment = true && that.isSetComment();
|
||||
if (this_present_comment || that_present_comment) {
|
||||
if (!(this_present_comment && that_present_comment))
|
||||
return false;
|
||||
if (!this.comment.equals(that.comment))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 1;
|
||||
|
||||
hashCode = hashCode * 8191 + num1;
|
||||
|
||||
hashCode = hashCode * 8191 + num2;
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetOp()) ? 131071 : 524287);
|
||||
if (isSetOp())
|
||||
hashCode = hashCode * 8191 + op.getValue();
|
||||
|
||||
hashCode = hashCode * 8191 + ((isSetComment()) ? 131071 : 524287);
|
||||
if (isSetComment())
|
||||
hashCode = hashCode * 8191 + comment.hashCode();
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Work other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetNum1()).compareTo(other.isSetNum1());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetNum1()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num1, other.num1);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetNum2()).compareTo(other.isSetNum2());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetNum2()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num2, other.num2);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetOp()).compareTo(other.isSetOp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetOp()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.op, other.op);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = java.lang.Boolean.valueOf(isSetComment()).compareTo(other.isSetComment());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetComment()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comment, other.comment);
|
||||
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("Work(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("num1:");
|
||||
sb.append(this.num1);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("num2:");
|
||||
sb.append(this.num2);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("op:");
|
||||
if (this.op == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.op);
|
||||
}
|
||||
first = false;
|
||||
if (isSetComment()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("comment:");
|
||||
if (this.comment == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.comment);
|
||||
}
|
||||
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, java.lang.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 WorkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public WorkStandardScheme getScheme() {
|
||||
return new WorkStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class WorkStandardScheme extends org.apache.thrift.scheme.StandardScheme<Work> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, Work 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: // NUM1
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.num1 = iprot.readI32();
|
||||
struct.setNum1IsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 2: // NUM2
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.num2 = iprot.readI32();
|
||||
struct.setNum2IsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 3: // OP
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
|
||||
struct.op = tutorial.Operation.findByValue(iprot.readI32());
|
||||
struct.setOpIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 4: // COMMENT
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.comment = iprot.readString();
|
||||
struct.setCommentIsSet(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, Work struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
oprot.writeFieldBegin(NUM1_FIELD_DESC);
|
||||
oprot.writeI32(struct.num1);
|
||||
oprot.writeFieldEnd();
|
||||
oprot.writeFieldBegin(NUM2_FIELD_DESC);
|
||||
oprot.writeI32(struct.num2);
|
||||
oprot.writeFieldEnd();
|
||||
if (struct.op != null) {
|
||||
oprot.writeFieldBegin(OP_FIELD_DESC);
|
||||
oprot.writeI32(struct.op.getValue());
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
if (struct.comment != null) {
|
||||
if (struct.isSetComment()) {
|
||||
oprot.writeFieldBegin(COMMENT_FIELD_DESC);
|
||||
oprot.writeString(struct.comment);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class WorkTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
|
||||
public WorkTupleScheme getScheme() {
|
||||
return new WorkTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class WorkTupleScheme extends org.apache.thrift.scheme.TupleScheme<Work> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, Work 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.isSetNum1()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
if (struct.isSetNum2()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
if (struct.isSetOp()) {
|
||||
optionals.set(2);
|
||||
}
|
||||
if (struct.isSetComment()) {
|
||||
optionals.set(3);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 4);
|
||||
if (struct.isSetNum1()) {
|
||||
oprot.writeI32(struct.num1);
|
||||
}
|
||||
if (struct.isSetNum2()) {
|
||||
oprot.writeI32(struct.num2);
|
||||
}
|
||||
if (struct.isSetOp()) {
|
||||
oprot.writeI32(struct.op.getValue());
|
||||
}
|
||||
if (struct.isSetComment()) {
|
||||
oprot.writeString(struct.comment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, Work struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
|
||||
java.util.BitSet incoming = iprot.readBitSet(4);
|
||||
if (incoming.get(0)) {
|
||||
struct.num1 = iprot.readI32();
|
||||
struct.setNum1IsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
struct.num2 = iprot.readI32();
|
||||
struct.setNum2IsSet(true);
|
||||
}
|
||||
if (incoming.get(2)) {
|
||||
struct.op = tutorial.Operation.findByValue(iprot.readI32());
|
||||
struct.setOpIsSet(true);
|
||||
}
|
||||
if (incoming.get(3)) {
|
||||
struct.comment = iprot.readString();
|
||||
struct.setCommentIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <S extends org.apache.thrift.scheme.IScheme> 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();
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.12.0)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
package tutorial;
|
||||
|
||||
@SuppressWarnings({"cast", "unused"})
|
||||
public class tutorialConstants {
|
||||
|
||||
/**
|
||||
* Thrift also lets you define constants for use across languages. Complex
|
||||
* types and structs are specified using JSON notation.
|
||||
*/
|
||||
public static final int INT32CONSTANT = 9853;
|
||||
|
||||
public static final java.util.Map<java.lang.String,java.lang.String> MAPCONSTANT = new java.util.HashMap<java.lang.String,java.lang.String>();
|
||||
static {
|
||||
MAPCONSTANT.put("goodnight", "moon");
|
||||
MAPCONSTANT.put("hello", "world");
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
log4j.rootLogger=debug,Console
|
||||
|
||||
log4j.logger.org.eclipse.jetty=info
|
||||
|
||||
log4j.appender.Console=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.Console.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %l - %m%n
|
@ -6,7 +6,7 @@ import org.nutz.boot.NbApp;
|
||||
class PercaLauncherTest {
|
||||
|
||||
@Test
|
||||
void testMain() {
|
||||
public void testMain() {
|
||||
//
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user