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 aMethodDescriptor
.- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodDescriptor<ReqT,RespT>
build()
Builds the method descriptor.MethodDescriptor.Builder<ReqT,RespT>
setFullMethodName(String fullMethodName)
Sets the fully qualified (service and method) method name.MethodDescriptor.Builder<ReqT,RespT>
setIdempotent(boolean idempotent)
Sets whether the method is idempotent.MethodDescriptor.Builder<ReqT,RespT>
setRequestMarshaller(MethodDescriptor.Marshaller<ReqT> requestMarshaller)
Sets the request marshaller.MethodDescriptor.Builder<ReqT,RespT>
setResponseMarshaller(MethodDescriptor.Marshaller<RespT> responseMarshaller)
Sets the response marshaller.MethodDescriptor.Builder<ReqT,RespT>
setSafe(boolean safe)
Sets whether this method is safe.MethodDescriptor.Builder<ReqT,RespT>
setSampledToLocalTracing(boolean value)
Sets whether RPCs for this method may be sampled into the local tracing store.MethodDescriptor.Builder<ReqT,RespT>
setSchemaDescriptor(Object schemaDescriptor)
Sets the schema descriptor for this builder.MethodDescriptor.Builder<ReqT,RespT>
setType(MethodDescriptor.MethodType type)
Sets the method type.
-
-
-
Method Detail
-
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
public MethodDescriptor.Builder<ReqT,RespT> setType(MethodDescriptor.MethodType type)
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:
MethodDescriptor.generateFullMethodName(java.lang.String, java.lang.String)
-
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 callingMethodDescriptor.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. Iffalse
, method is also not safe. Note that implies callingbuilder.setIdempotent(false).setIdempotent(true)
will leaveisSafe() == 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. Iftrue
, method is also idempotent. Note that implies callingbuilder.setSafe(true).setSafe(false)
will leaveisIdempotent() == 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
-
-