You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by GitBox <gi...@apache.org> on 2022/04/12 15:43:12 UTC

[GitHub] [thrift] Jimexist commented on pull request #2562: THRIFT-5555: Java codegen and library to support future-returning client interface and implementation

Jimexist commented on PR #2562:
URL: https://github.com/apache/thrift/pull/2562#issuecomment-1096893593

   Result:
   
   <details>
   <summary>Generated `Service.java`</summary>
   
   ```java
   /**
    * Autogenerated by Thrift Compiler (0.17.0)
    *
    * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
    *  @generated
    */
   package thrift.test;
   
   @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
   @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2022-04-12")
   public class Service {
   
     public interface Iface {
   
       public long mymethod(long blah) throws org.apache.thrift.TException;
   
     }
   
     public interface AsyncIface {
   
       public void mymethod(long blah, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException;
   
     }
   
     public interface FutureIface {
   
       public java.util.concurrent.CompletableFuture<java.lang.Long> mymethod(long blah) 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 long mymethod(long blah) throws org.apache.thrift.TException
       {
         send_mymethod(blah);
         return recv_mymethod();
       }
   
       public void send_mymethod(long blah) throws org.apache.thrift.TException
       {
         mymethod_args args = new mymethod_args();
         args.set_blah(blah);
         sendBase("mymethod", args);
       }
   
       public long recv_mymethod() throws org.apache.thrift.TException
       {
         mymethod_result result = new mymethod_result();
         receiveBase(result, "mymethod");
         if (result.is_set_success()) {
           return result.success;
         }
         throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "mymethod 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 mymethod(long blah, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
         checkReady();
         mymethod_call method_call = new mymethod_call(blah, resultHandler, this, ___protocolFactory, ___transport);
         this.___currentMethod = method_call;
         ___manager.call(method_call);
       }
   
       public static class mymethod_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Long> {
         private long blah;
         public mymethod_call(long blah, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> 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.blah = blah;
         }
   
         public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
           prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("mymethod", org.apache.thrift.protocol.TMessageType.CALL, 0));
           mymethod_args args = new mymethod_args();
           args.set_blah(blah);
           args.write(prot);
           prot.writeMessageEnd();
         }
   
         public java.lang.Long 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_mymethod();
         }
       }
   
     }
   
     public static class FutureClient implements FutureIface {
       public FutureClient(AsyncIface delegate) {
         this.delegate = delegate;
       }
       private final AsyncIface delegate;
       @Override
       public java.util.concurrent.CompletableFuture<java.lang.Long> mymethod(long blah) throws org.apache.thrift.TException {
         org.apache.thrift.async.AsyncMethodFutureAdapter<java.lang.Long> asyncMethodFutureAdapter24 = org.apache.thrift.async.AsyncMethodFutureAdapter.<java.lang.Long>create();
         delegate.mymethod(blah, asyncMethodFutureAdapter24);
         return asyncMethodFutureAdapter24.getFuture();
       }
   
     }
   
     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("mymethod", new mymethod());
         return processMap;
       }
   
       public static class mymethod<I extends Iface> extends org.apache.thrift.ProcessFunction<I, mymethod_args> {
         public mymethod() {
           super("mymethod");
         }
   
         public mymethod_args getEmptyArgsInstance() {
           return new mymethod_args();
         }
   
         protected boolean isOneway() {
           return false;
         }
   
         @Override
         protected boolean rethrowUnhandledExceptions() {
           return false;
         }
   
         public mymethod_result getResult(I iface, mymethod_args args) throws org.apache.thrift.TException {
           mymethod_result result = new mymethod_result();
           result.success = iface.mymethod(args.blah);
           result.set_success_isSet(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("mymethod", new mymethod());
         return processMap;
       }
   
       public static class mymethod<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, mymethod_args, java.lang.Long> {
         public mymethod() {
           super("mymethod");
         }
   
         public mymethod_args getEmptyArgsInstance() {
           return new mymethod_args();
         }
   
         public org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> 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.Long>() { 
             public void onComplete(java.lang.Long o) {
               mymethod_result result = new mymethod_result();
               result.success = o;
               result.set_success_isSet(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;
               mymethod_result result = new mymethod_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, mymethod_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
           iface.mymethod(args.blah,resultHandler);
         }
       }
   
     }
   
     public static class mymethod_args implements org.apache.thrift.TBase<mymethod_args, mymethod_args._Fields>, java.io.Serializable, Cloneable, Comparable<mymethod_args>   {
       private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("mymethod_args");
   
       private static final org.apache.thrift.protocol.TField BLAH_FIELD_DESC = new org.apache.thrift.protocol.TField("blah", org.apache.thrift.protocol.TType.I64, (short)-1);
   
       private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new mymethod_argsStandardSchemeFactory();
       private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new mymethod_argsTupleSchemeFactory();
   
       private long blah; // 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 {
         BLAH((short)-1, "blah");
   
         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: // BLAH
               return BLAH;
             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 __BLAH_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.BLAH, new org.apache.thrift.meta_data.FieldMetaData("blah", org.apache.thrift.TFieldRequirementType.DEFAULT, 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
         metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
         org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(mymethod_args.class, metaDataMap);
       }
   
       public mymethod_args() {
       }
   
       public mymethod_args(
         long blah)
       {
         this();
         this.blah = blah;
         set_blah_isSet(true);
       }
   
       /**
        * Performs a deep copy on <i>other</i>.
        */
       public mymethod_args(mymethod_args other) {
         __isset_bitfield = other.__isset_bitfield;
         this.blah = other.blah;
       }
   
       public mymethod_args deepCopy() {
         return new mymethod_args(this);
       }
   
       @Override
       public void clear() {
         set_blah_isSet(false);
         this.blah = 0;
       }
   
       public long get_blah() {
         return this.blah;
       }
   
       public void set_blah(long blah) {
         this.blah = blah;
         set_blah_isSet(true);
       }
   
       public void unset_blah() {
         __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BLAH_ISSET_ID);
       }
   
       /** Returns true if field blah is set (has been assigned a value) and false otherwise */
       public boolean is_set_blah() {
         return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BLAH_ISSET_ID);
       }
   
       public void set_blah_isSet(boolean value) {
         __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BLAH_ISSET_ID, value);
       }
   
       public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
         switch (field) {
         case BLAH:
           if (value == null) {
             unset_blah();
           } else {
             set_blah((java.lang.Long)value);
           }
           break;
   
         }
       }
   
       @org.apache.thrift.annotation.Nullable
       public java.lang.Object getFieldValue(_Fields field) {
         switch (field) {
         case BLAH:
           return get_blah();
   
         }
         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 BLAH:
           return is_set_blah();
         }
         throw new java.lang.IllegalStateException();
       }
   
       @Override
       public boolean equals(java.lang.Object that) {
         if (that instanceof mymethod_args)
           return this.equals((mymethod_args)that);
         return false;
       }
   
       public boolean equals(mymethod_args that) {
         if (that == null)
           return false;
         if (this == that)
           return true;
   
         boolean this_present_blah = true;
         boolean that_present_blah = true;
         if (this_present_blah || that_present_blah) {
           if (!(this_present_blah && that_present_blah))
             return false;
           if (this.blah != that.blah)
             return false;
         }
   
         return true;
       }
   
       @Override
       public int hashCode() {
         int hashCode = 1;
   
         hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(blah);
   
         return hashCode;
       }
   
       @Override
       public int compareTo(mymethod_args other) {
         if (!getClass().equals(other.getClass())) {
           return getClass().getName().compareTo(other.getClass().getName());
         }
   
         int lastComparison = 0;
   
         lastComparison = java.lang.Boolean.compare(is_set_blah(), other.is_set_blah());
         if (lastComparison != 0) {
           return lastComparison;
         }
         if (is_set_blah()) {
           lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blah, other.blah);
           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("mymethod_args(");
         boolean first = true;
   
         sb.append("blah:");
         sb.append(this.blah);
         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 mymethod_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
         public mymethod_argsStandardScheme getScheme() {
           return new mymethod_argsStandardScheme();
         }
       }
   
       private static class mymethod_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<mymethod_args> {
   
         public void read(org.apache.thrift.protocol.TProtocol iprot, mymethod_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: // BLAH
                 if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                   struct.blah = iprot.readI64();
                   struct.set_blah_isSet(true);
                 } else { 
                   org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                 }
                 break;
               default:
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             iprot.readFieldEnd();
           }
           iprot.readStructEnd();
           struct.validate();
         }
   
         public void write(org.apache.thrift.protocol.TProtocol oprot, mymethod_args struct) throws org.apache.thrift.TException {
           struct.validate();
   
           oprot.writeStructBegin(STRUCT_DESC);
           oprot.writeFieldBegin(BLAH_FIELD_DESC);
           oprot.writeI64(struct.blah);
           oprot.writeFieldEnd();
           oprot.writeFieldStop();
           oprot.writeStructEnd();
         }
   
       }
   
       private static class mymethod_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
         public mymethod_argsTupleScheme getScheme() {
           return new mymethod_argsTupleScheme();
         }
       }
   
       private static class mymethod_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<mymethod_args> {
   
         @Override
         public void write(org.apache.thrift.protocol.TProtocol prot, mymethod_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.is_set_blah()) {
             optionals.set(0);
           }
           oprot.writeBitSet(optionals, 1);
           if (struct.is_set_blah()) {
             oprot.writeI64(struct.blah);
           }
         }
   
         @Override
         public void read(org.apache.thrift.protocol.TProtocol prot, mymethod_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.blah = iprot.readI64();
             struct.set_blah_isSet(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 mymethod_result implements org.apache.thrift.TBase<mymethod_result, mymethod_result._Fields>, java.io.Serializable, Cloneable, Comparable<mymethod_result>   {
       private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("mymethod_result");
   
       private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0);
   
       private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new mymethod_resultStandardSchemeFactory();
       private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new mymethod_resultTupleSchemeFactory();
   
       private long 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
       private static final int __SUCCESS_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.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.I64)));
         metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
         org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(mymethod_result.class, metaDataMap);
       }
   
       public mymethod_result() {
       }
   
       public mymethod_result(
         long success)
       {
         this();
         this.success = success;
         set_success_isSet(true);
       }
   
       /**
        * Performs a deep copy on <i>other</i>.
        */
       public mymethod_result(mymethod_result other) {
         __isset_bitfield = other.__isset_bitfield;
         this.success = other.success;
       }
   
       public mymethod_result deepCopy() {
         return new mymethod_result(this);
       }
   
       @Override
       public void clear() {
         set_success_isSet(false);
         this.success = 0;
       }
   
       public long get_success() {
         return this.success;
       }
   
       public void set_success(long success) {
         this.success = success;
         set_success_isSet(true);
       }
   
       public void unset_success() {
         __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
       }
   
       /** Returns true if field success is set (has been assigned a value) and false otherwise */
       public boolean is_set_success() {
         return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
       }
   
       public void set_success_isSet(boolean value) {
         __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
       }
   
       public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
         switch (field) {
         case SUCCESS:
           if (value == null) {
             unset_success();
           } else {
             set_success((java.lang.Long)value);
           }
           break;
   
         }
       }
   
       @org.apache.thrift.annotation.Nullable
       public java.lang.Object getFieldValue(_Fields field) {
         switch (field) {
         case SUCCESS:
           return get_success();
   
         }
         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 is_set_success();
         }
         throw new java.lang.IllegalStateException();
       }
   
       @Override
       public boolean equals(java.lang.Object that) {
         if (that instanceof mymethod_result)
           return this.equals((mymethod_result)that);
         return false;
       }
   
       public boolean equals(mymethod_result that) {
         if (that == null)
           return false;
         if (this == that)
           return true;
   
         boolean this_present_success = true;
         boolean that_present_success = true;
         if (this_present_success || that_present_success) {
           if (!(this_present_success && that_present_success))
             return false;
           if (this.success != that.success)
             return false;
         }
   
         return true;
       }
   
       @Override
       public int hashCode() {
         int hashCode = 1;
   
         hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(success);
   
         return hashCode;
       }
   
       @Override
       public int compareTo(mymethod_result other) {
         if (!getClass().equals(other.getClass())) {
           return getClass().getName().compareTo(other.getClass().getName());
         }
   
         int lastComparison = 0;
   
         lastComparison = java.lang.Boolean.compare(is_set_success(), other.is_set_success());
         if (lastComparison != 0) {
           return lastComparison;
         }
         if (is_set_success()) {
           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("mymethod_result(");
         boolean first = true;
   
         sb.append("success:");
         sb.append(this.success);
         first = false;
         sb.append(")");
         return sb.toString();
       }
   
       public void validate() throws org.apache.thrift.TException {
         // check for required fields
         // check for sub-struct validity
       }
   
       private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
         try {
           write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
         } catch (org.apache.thrift.TException te) {
           throw new java.io.IOException(te);
         }
       }
   
       private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, 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 mymethod_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
         public mymethod_resultStandardScheme getScheme() {
           return new mymethod_resultStandardScheme();
         }
       }
   
       private static class mymethod_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<mymethod_result> {
   
         public void read(org.apache.thrift.protocol.TProtocol iprot, mymethod_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.I64) {
                   struct.success = iprot.readI64();
                   struct.set_success_isSet(true);
                 } else { 
                   org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                 }
                 break;
               default:
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             iprot.readFieldEnd();
           }
           iprot.readStructEnd();
           struct.validate();
         }
   
         public void write(org.apache.thrift.protocol.TProtocol oprot, mymethod_result struct) throws org.apache.thrift.TException {
           struct.validate();
   
           oprot.writeStructBegin(STRUCT_DESC);
           if (struct.is_set_success()) {
             oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
             oprot.writeI64(struct.success);
             oprot.writeFieldEnd();
           }
           oprot.writeFieldStop();
           oprot.writeStructEnd();
         }
   
       }
   
       private static class mymethod_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
         public mymethod_resultTupleScheme getScheme() {
           return new mymethod_resultTupleScheme();
         }
       }
   
       private static class mymethod_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<mymethod_result> {
   
         @Override
         public void write(org.apache.thrift.protocol.TProtocol prot, mymethod_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.is_set_success()) {
             optionals.set(0);
           }
           oprot.writeBitSet(optionals, 1);
           if (struct.is_set_success()) {
             oprot.writeI64(struct.success);
           }
         }
   
         @Override
         public void read(org.apache.thrift.protocol.TProtocol prot, mymethod_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 = iprot.readI64();
             struct.set_success_isSet(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();
       }
     }
   
   }
   
   ```
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org