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 java.lang.Object
A builder for aMethodDescriptor
.- Since:
- 1.1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
fullMethodName
private boolean
idempotent
private MethodDescriptor.Marshaller<ReqT>
requestMarshaller
private MethodDescriptor.Marshaller<RespT>
responseMarshaller
private boolean
safe
private boolean
sampledToLocalTracing
private java.lang.Object
schemaDescriptor
private MethodDescriptor.MethodType
type
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder()
-
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(java.lang.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(java.lang.Object schemaDescriptor)
Sets the schema descriptor for this builder.MethodDescriptor.Builder<ReqT,RespT>
setType(MethodDescriptor.MethodType type)
Sets the method type.
-
-
-
Field Detail
-
requestMarshaller
private MethodDescriptor.Marshaller<ReqT> requestMarshaller
-
responseMarshaller
private MethodDescriptor.Marshaller<RespT> responseMarshaller
-
type
private MethodDescriptor.MethodType type
-
fullMethodName
private java.lang.String fullMethodName
-
idempotent
private boolean idempotent
-
safe
private boolean safe
-
schemaDescriptor
private java.lang.Object schemaDescriptor
-
sampledToLocalTracing
private boolean sampledToLocalTracing
-
-
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(java.lang.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 java.lang.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
-
-