寫在前面:thrift是一個軟件框架,用來進行可擴展且跨語言的服務的開發。它結合了功能強大的軟件堆棧和代碼生成引擎,以構建在 C++, Java, Go,Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml 這些編程語言間無縫結合的、高效的服務。如果對dubbo比較熟悉,也看做沒有註冊中心的rpc(遠程過程調用)框架。
本文使用的環境:docker ,java 1.8 ,python 3.7
thrift官網:http://thrift.apache.org
thrift java版本源碼:https://github.com/Blankwhiter/thrift-java-demo
thrift python版本源碼:https://github.com/Blankwhiter/thrift-demo
1.在centos窗口中,執行如下命令,拉取thrift鏡像:
docker pull thrift
2.創建並編寫接口thrift文件 ProductService.thrift
在centos窗口中,/home/thrift/data目錄下創建ProductService.thrift:
namespace java com.thrift.demo.api service ProductService{ void printProductName() string getProuctDesc(1:string name) bool isHaveStock() }
1.java版本:在centos窗口中,執行如下命令:
docker run -v /home/thrift/data:/data thrift thrift -o /data --gen java /data/ProductService.thrift
執行成功後,會在 /home/thrift/data/gen-java目錄下,生成具有(com.thrift.demo.api)包(文件夾)的ProductService.java
. └── com └── thrift └── demo └── api └── ProductService.java 4 directories, 1 file
注:讀者可以進入gen-java目錄,使用 tree 命令查看,如果未安裝,可使用命令 yum install tree 進行安裝
2.python版本:在centos窗口中,執行如下命令:
docker run -v /home/thrift/data:/data thrift thrift -o /data --gen py /data/ProductService.thrift
執行成功後會生成 /home/thrift/data/gen-py目錄下,生成一系列python文件。目錄結構如下:
.
├── __init__.py
└── ProductService
├── constants.py
├── __init__.py
├── ProductService.py
├── ProductService-remote
└── ttypes.py
1 directory, 6 files
注:
thrift -o <output path> --gen <language> <Thrift filename>
項目目錄結構示意圖:
讀者請自行創建目錄結構,或者放置同個項目也行。
目錄說明:
一.api模塊:api接口的複製
1.引入依賴
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.thrift</groupId> <artifactId>api</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.11.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
2.將第二步生成的java代碼放入 api模塊中。
ProductService.java
/** * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.thrift.demo.api; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-11-20") public class ProductService { public interface Iface { public void printProductName() throws org.apache.thrift.TException; public java.lang.String getProductDesc(java.lang.String name) throws org.apache.thrift.TException; public boolean isHaveStock() throws org.apache.thrift.TException; } public interface AsyncIface { public void printProductName(org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; public void getProductDesc(java.lang.String name, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException; public void isHaveStock(org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> 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 void printProductName() throws org.apache.thrift.TException { send_printProductName(); recv_printProductName(); } public void send_printProductName() throws org.apache.thrift.TException { printProductName_args args = new printProductName_args(); sendBase("printProductName", args); } public void recv_printProductName() throws org.apache.thrift.TException { printProductName_result result = new printProductName_result(); receiveBase(result, "printProductName"); return; } public java.lang.String getProductDesc(java.lang.String name) throws org.apache.thrift.TException { send_getProductDesc(name); return recv_getProductDesc(); } public void send_getProductDesc(java.lang.String name) throws org.apache.thrift.TException { getProductDesc_args args = new getProductDesc_args(); args.setName(name); sendBase("getProductDesc", args); } public java.lang.String recv_getProductDesc() throws org.apache.thrift.TException { getProductDesc_result result = new getProductDesc_result(); receiveBase(result, "getProductDesc"); if (result.isSetSuccess()) { return result.success; } throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getProductDesc failed: unknown result"); } public boolean isHaveStock() throws org.apache.thrift.TException { send_isHaveStock(); return recv_isHaveStock(); } public void send_isHaveStock() throws org.apache.thrift.TException { isHaveStock_args args = new isHaveStock_args(); sendBase("isHaveStock", args); } public boolean recv_isHaveStock() throws org.apache.thrift.TException { isHaveStock_result result = new isHaveStock_result(); receiveBase(result, "isHaveStock"); if (result.isSetSuccess()) { return result.success; } throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isHaveStock 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 printProductName(org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { checkReady(); printProductName_call method_call = new printProductName_call(resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class printProductName_call extends org.apache.thrift.async.TAsyncMethodCall<Void> { public printProductName_call(org.apache.thrift.async.AsyncMethodCallback<Void> 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); } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("printProductName", org.apache.thrift.protocol.TMessageType.CALL, 0)); printProductName_args args = new printProductName_args(); args.write(prot); prot.writeMessageEnd(); } public Void 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 null; } } public void getProductDesc(java.lang.String name, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { checkReady(); getProductDesc_call method_call = new getProductDesc_call(name, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getProductDesc_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> { private java.lang.String name; public getProductDesc_call(java.lang.String name, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> 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.name = name; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getProductDesc", org.apache.thrift.protocol.TMessageType.CALL, 0)); getProductDesc_args args = new getProductDesc_args(); args.setName(name); args.write(prot); prot.writeMessageEnd(); } public java.lang.String 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_getProductDesc(); } } public void isHaveStock(org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException { checkReady(); isHaveStock_call method_call = new isHaveStock_call(resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class isHaveStock_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Boolean> { public isHaveStock_call(org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> 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); } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isHaveStock", org.apache.thrift.protocol.TMessageType.CALL, 0)); isHaveStock_args args = new isHaveStock_args(); args.write(prot); prot.writeMessageEnd(); } public java.lang.Boolean 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_isHaveStock(); } } } 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("printProductName", new printProductName()); processMap.put("getProductDesc", new getProductDesc()); processMap.put("isHaveStock", new isHaveStock()); return processMap; } public static class printProductName<I extends Iface> extends org.apache.thrift.ProcessFunction<I, printProductName_args> { public printProductName() { super("printProductName"); } public printProductName_args getEmptyArgsInstance() { return new printProductName_args(); } protected boolean isOneway() { return false; } @Override protected boolean handleRuntimeExceptions() { return false; } public printProductName_result getResult(I iface, printProductName_args args) throws org.apache.thrift.TException { printProductName_result result = new printProductName_result(); iface.printProductName(); return result; } } public static class getProductDesc<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getProductDesc_args> { public getProductDesc() { super("getProductDesc"); } public getProductDesc_args getEmptyArgsInstance() { return new getProductDesc_args(); } protected boolean isOneway() { return false; } @Override protected boolean handleRuntimeExceptions() { return false; } public getProductDesc_result getResult(I iface, getProductDesc_args args) throws org.apache.thrift.TException { getProductDesc_result result = new getProductDesc_result(); result.success = iface.getProductDesc(args.name); return result; } } public static class isHaveStock<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isHaveStock_args> { public isHaveStock() { super("isHaveStock"); } public isHaveStock_args getEmptyArgsInstance() { return new isHaveStock_args(); } protected boolean isOneway() { return false; } @Override protected boolean handleRuntimeExceptions() { return false; } public isHaveStock_result getResult(I iface, isHaveStock_args args) throws org.apache.thrift.TException { isHaveStock_result result = new isHaveStock_result(); result.success = iface.isHaveStock(); result.setSuccessIsSet(true); 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("printProductName", new printProductName()); processMap.put("getProductDesc", new getProductDesc()); processMap.put("isHaveStock", new isHaveStock()); return processMap; } public static class printProductName<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, printProductName_args, Void> { public printProductName() { super("printProductName"); } public printProductName_args getEmptyArgsInstance() { return new printProductName_args(); } public org.apache.thrift.async.AsyncMethodCallback<Void> 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<Void>() { public void onComplete(Void o) { printProductName_result result = new printProductName_result(); 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; printProductName_result result = new printProductName_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, printProductName_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { iface.printProductName(resultHandler); } } public static class getProductDesc<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getProductDesc_args, java.lang.String> { public getProductDesc() { super("getProductDesc"); } public getProductDesc_args getEmptyArgsInstance() { return new getProductDesc_args(); } public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> 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<java.lang.String>() { public void onComplete(java.lang.String o) { getProductDesc_result result = new getProductDesc_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; getProductDesc_result result = new getProductDesc_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, getProductDesc_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { iface.getProductDesc(args.name,resultHandler); } } public static class isHaveStock<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isHaveStock_args, java.lang.Boolean> { public isHaveStock() { super("isHaveStock"); } public isHaveStock_args getEmptyArgsInstance() { return new isHaveStock_args(); } public org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> 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<java.lang.Boolean>() { public void onComplete(java.lang.Boolean o) { isHaveStock_result result = new isHaveStock_result(); result.success = o; result.setSuccessIsSet(true); 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; isHaveStock_result result = new isHaveStock_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, isHaveStock_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException { iface.isHaveStock(resultHandler); } } } public static class printProductName_args implements org.apache.thrift.TBase<printProductName_args, printProductName_args._Fields>, java.io.Serializable, Cloneable, Comparable<printProductName_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("printProductName_args"); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new printProductName_argsStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new printProductName_argsTupleSchemeFactory(); /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ; 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. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { 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. */ 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; } } 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); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(printProductName_args.class, metaDataMap); } public printProductName_args() { } /** * Performs a deep copy on <i>other</i>. */ public printProductName_args(printProductName_args other) { } public printProductName_args deepCopy() { return new printProductName_args(this); } @Override public void clear() { } public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { } } public java.lang.Object getFieldValue(_Fields field) { switch (field) { } 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) { } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof printProductName_args) return this.equals((printProductName_args)that); return false; } public boolean equals(printProductName_args that) { if (that == null) return false; if (this == that) return true; return true; } @Override public int hashCode() { int hashCode = 1; return hashCode; } @Override public int compareTo(printProductName_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { 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("printProductName_args("); boolean first = true; 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 { 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 printProductName_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public printProductName_argsStandardScheme getScheme() { return new printProductName_argsStandardScheme(); } } private static class printProductName_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<printProductName_args> { public void read(org.apache.thrift.protocol.TProtocol iprot, printProductName_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) { 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, printProductName_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class printProductName_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public printProductName_argsTupleScheme getScheme() { return new printProductName_argsTupleScheme(); } } private static class printProductName_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<printProductName_args> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, printProductName_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; } @Override public void read(org.apache.thrift.protocol.TProtocol prot, printProductName_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; } } 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 printProductName_result implements org.apache.thrift.TBase<printProductName_result, printProductName_result._Fields>, java.io.Serializable, Cloneable, Comparable<printProductName_result> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("printProductName_result"); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new printProductName_resultStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new printProductName_resultTupleSchemeFactory(); /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ; 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. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { 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. */ 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; } } 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); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(printProductName_result.class, metaDataMap); } public printProductName_result() { } /** * Performs a deep copy on <i>other</i>. */ public printProductName_result(printProductName_result other) { } public printProductName_result deepCopy() { return new printProductName_result(this); } @Override public void clear() { } public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { } } public java.lang.Object getFieldValue(_Fields field) { switch (field) { } 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) { } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof printProductName_result) return this.equals((printProductName_result)that); return false; } public boolean equals(printProductName_result that) { if (that == null) return false; if (this == that) return true; return true; } @Override public int hashCode() { int hashCode = 1; return hashCode; } @Override public int compareTo(printProductName_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { 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("printProductName_result("); boolean first = true; 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 { 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 printProductName_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public printProductName_resultStandardScheme getScheme() { return new printProductName_resultStandardScheme(); } } private static class printProductName_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<printProductName_result> { public void read(org.apache.thrift.protocol.TProtocol iprot, printProductName_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) { 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, printProductName_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class printProductName_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public printProductName_resultTupleScheme getScheme() { return new printProductName_resultTupleScheme(); } } private static class printProductName_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<printProductName_result> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, printProductName_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; } @Override public void read(org.apache.thrift.protocol.TProtocol prot, printProductName_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; } } 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 getProductDesc_args implements org.apache.thrift.TBase<getProductDesc_args, getProductDesc_args._Fields>, java.io.Serializable, Cloneable, Comparable<getProductDesc_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getProductDesc_args"); private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getProductDesc_argsStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getProductDesc_argsTupleSchemeFactory(); public java.lang.String name; // 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 { NAME((short)1, "name"); 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. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // NAME return NAME; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", 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(getProductDesc_args.class, metaDataMap); } public getProductDesc_args() { } public getProductDesc_args( java.lang.String name) { this(); this.name = name; } /** * Performs a deep copy on <i>other</i>. */ public getProductDesc_args(getProductDesc_args other) { if (other.isSetName()) { this.name = other.name; } } public getProductDesc_args deepCopy() { return new getProductDesc_args(this); } @Override public void clear() { this.name = null; } public java.lang.String getName() { return this.name; } public getProductDesc_args setName(java.lang.String name) { this.name = name; return this; } public void unsetName() { this.name = null; } /** Returns true if field name is set (has been assigned a value) and false otherwise */ public boolean isSetName() { return this.name != null; } public void setNameIsSet(boolean value) { if (!value) { this.name = null; } } public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case NAME: if (value == null) { unsetName(); } else { setName((java.lang.String)value); } break; } } public java.lang.Object getFieldValue(_Fields field) { switch (field) { case NAME: return getName(); } 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 NAME: return isSetName(); } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof getProductDesc_args) return this.equals((getProductDesc_args)that); return false; } public boolean equals(getProductDesc_args that) { if (that == null) return false; if (this == that) return true; boolean this_present_name = true && this.isSetName(); boolean that_present_name = true && that.isSetName(); if (this_present_name || that_present_name) { if (!(this_present_name && that_present_name)) return false; if (!this.name.equals(that.name)) return false; } return true; } @Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); return hashCode; } @Override public int compareTo(getProductDesc_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); if (lastComparison != 0) { return lastComparison; } if (isSetName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { 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("getProductDesc_args("); boolean first = true; sb.append("name:"); if (this.name == null) { sb.append("null"); } else { sb.append(this.name); } 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 { 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 getProductDesc_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getProductDesc_argsStandardScheme getScheme() { return new getProductDesc_argsStandardScheme(); } } private static class getProductDesc_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getProductDesc_args> { public void read(org.apache.thrift.protocol.TProtocol iprot, getProductDesc_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: // NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.name = iprot.readString(); struct.setNameIsSet(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, getProductDesc_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.name != null) { oprot.writeFieldBegin(NAME_FIELD_DESC); oprot.writeString(struct.name); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class getProductDesc_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getProductDesc_argsTupleScheme getScheme() { return new getProductDesc_argsTupleScheme(); } } private static class getProductDesc_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getProductDesc_args> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, getProductDesc_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.isSetName()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetName()) { oprot.writeString(struct.name); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, getProductDesc_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.name = iprot.readString(); struct.setNameIsSet(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 getProductDesc_result implements org.apache.thrift.TBase<getProductDesc_result, getProductDesc_result._Fields>, java.io.Serializable, Cloneable, Comparable<getProductDesc_result> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getProductDesc_result"); private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getProductDesc_resultStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getProductDesc_resultTupleSchemeFactory(); public java.lang.String 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. */ 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. */ 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getProductDesc_result.class, metaDataMap); } public getProductDesc_result() { } public getProductDesc_result( java.lang.String success) { this(); this.success = success; } /** * Performs a deep copy on <i>other</i>. */ public getProductDesc_result(getProductDesc_result other) { if (other.isSetSuccess()) { this.success = other.success; } } public getProductDesc_result deepCopy() { return new getProductDesc_result(this); } @Override public void clear() { this.success = null; } public javagetProductDesc_result(this); } @Override public void clear() { this.success = null; } public java.lang.String getSuccess() { return this.success; } public getProductDesc_result setSuccess(java.lang.String 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, java.lang.Object value) { switch (field) { case SUCCESS: if (value == null) { unsetSuccess(); } else { setSuccess((java.lang.String)value); } break; } } 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