Package io.grpc

Class MethodDescriptor.Builder<ReqT,RespT>

java.lang.Object
io.grpc.MethodDescriptor.Builder<ReqT,RespT>
Enclosing class:
MethodDescriptor<ReqT,RespT>

public static final class MethodDescriptor.Builder<ReqT,RespT> extends Object
A builder for a MethodDescriptor.
Since:
1.1.0
  • Method Details

    • setRequestMarshaller

      public MethodDescriptor.Builder<ReqT,RespT> setRequestMarshaller(MethodDescriptor.Marshaller<ReqT> requestMarshaller)
      Sets the request marshaller.
      Parameters:
      requestMarshaller - the marshaller to use.
      Since:
      1.1.0
    • setResponseMarshaller

      public MethodDescriptor.Builder<ReqT,RespT> setResponseMarshaller(MethodDescriptor.Marshaller<RespT> responseMarshaller)
      Sets the response marshaller.
      Parameters:
      responseMarshaller - the marshaller to use.
      Since:
      1.1.0
    • setType

      Sets the method type.
      Parameters:
      type - the type of the method.
      Since:
      1.1.0
    • setFullMethodName

      public MethodDescriptor.Builder<ReqT,RespT> setFullMethodName(String fullMethodName)
      Sets the fully qualified (service and method) method name.
      Since:
      1.1.0
      See Also:
    • setSchemaDescriptor

      public MethodDescriptor.Builder<ReqT,RespT> setSchemaDescriptor(@Nullable Object schemaDescriptor)
      Sets the schema descriptor for this builder. A schema descriptor is an object that is not used by gRPC core but includes information related to the methods. The type of the object is specific to the consumer, so both the code calling this and the code calling MethodDescriptor.getSchemaDescriptor() must coordinate.
      Parameters:
      schemaDescriptor - an object that describes the service structure. Should be immutable.
      Since:
      1.7.0
    • setIdempotent

      public MethodDescriptor.Builder<ReqT,RespT> setIdempotent(boolean idempotent)
      Sets whether the method is idempotent. If true, calling this method more than once doesn't have additional side effects. If false, method is also not safe. Note that implies calling builder.setIdempotent(false).setIdempotent(true) will leave isSafe() == false.
      Since:
      1.1.0
    • setSafe

      public MethodDescriptor.Builder<ReqT,RespT> setSafe(boolean safe)
      Sets whether this method is safe. If true, calling this method any number of times doesn't have side effects. If true, method is also idempotent. Note that implies calling builder.setSafe(true).setSafe(false) will leave isIdempotent() == true.
      Since:
      1.1.0
    • setSampledToLocalTracing

      public MethodDescriptor.Builder<ReqT,RespT> setSampledToLocalTracing(boolean value)
      Sets whether RPCs for this method may be sampled into the local tracing store. If true, sampled traces of this method may be kept in memory by tracing libraries.
      Since:
      1.8.0
    • build

      @CheckReturnValue public MethodDescriptor<ReqT,RespT> build()
      Builds the method descriptor.
      Since:
      1.1.0