- All Known Implementing Classes:
ServiceDescriptor.Builder
- Enclosing class:
- ServiceDescriptor
public static interface ServiceDescriptor.Rules
Fluent configuration interface for the
ServiceDescriptor
.-
Method Summary
Modifier and TypeMethodDescriptionaddContextValue
(io.grpc.Context.Key<V> key, V value) Add value to theContext
for the service.<ReqT,
ResT>
ServiceDescriptor.Rulesbidirectional
(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT, ResT> method) Register bi-directional streaming method for the service.<ReqT,
ResT>
ServiceDescriptor.Rulesbidirectional
(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register bi-directional streaming method for the service.<ReqT,
ResT>
ServiceDescriptor.RulesclientStreaming
(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT, ResT> method) Register client streaming method for the service.<ReqT,
ResT>
ServiceDescriptor.RulesclientStreaming
(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register client streaming method for the service.healthCheck
(HealthCheck healthCheck) Register the serviceHealthCheck
.intercept
(int priority, io.grpc.ServerInterceptor... interceptors) Add one or moreServerInterceptor
instances that will intercept calls to this service.intercept
(io.grpc.ServerInterceptor... interceptors) Add one or moreServerInterceptor
instances that will intercept calls to this service.Register one or moreinterceptors
for a named method of the service.Register one or moreinterceptors
for a named method of the service.marshallerSupplier
(MarshallerSupplier marshallerSupplier) Register theMarshallerSupplier
for the service.name()
Obtain the name fo the service this configuration configures.Set the name for the service.proto
(com.google.protobuf.Descriptors.FileDescriptor proto) Register the proto for the service.<ReqT,
ResT>
ServiceDescriptor.RulesserverStreaming
(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT, ResT> method) Register server streaming method for the service.<ReqT,
ResT>
ServiceDescriptor.RulesserverStreaming
(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register server streaming method for the service.<ReqT,
ResT>
ServiceDescriptor.RulesRegister unary method for the service.<ReqT,
ResT>
ServiceDescriptor.Rulesunary
(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register unary method for the service.
-
Method Details
-
name
Set the name for the service.- Parameters:
name
- the service name- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining - Throws:
NullPointerException
- if the name is nullIllegalArgumentException
- if the name is a blank String
-
name
String name()Obtain the name fo the service this configuration configures.- Returns:
- the name fo the service this configuration configures
-
proto
Register the proto for the service.- Parameters:
proto
- the service proto- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
marshallerSupplier
Register theMarshallerSupplier
for the service.- Parameters:
marshallerSupplier
- theMarshallerSupplier
for the service- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
intercept
Add one or moreServerInterceptor
instances that will intercept calls to this service.If the added interceptors are annotated with the
Priority
annotation then that value will be used to assign a priority to use when applying the interceptor otherwise a priority ofInterceptorPriorities.USER
will be used.- Parameters:
interceptors
- one or moreServerInterceptor
s to add- Returns:
- this builder to allow fluent method chaining
-
intercept
Add one or moreServerInterceptor
instances that will intercept calls to this service.The added interceptors will be applied using the specified priority.
- Parameters:
priority
- the priority to assign to the interceptorsinterceptors
- one or moreServerInterceptor
s to add- Returns:
- this builder to allow fluent method chaining
-
intercept
Register one or moreinterceptors
for a named method of the service.If the added interceptors are annotated with the
Priority
annotation then that value will be used to assign a priority to use when applying the interceptor otherwise a priority ofInterceptorPriorities.USER
will be used.- Parameters:
methodName
- the name of the method to interceptinterceptors
- the interceptor(s) to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining - Throws:
IllegalArgumentException
- if no method exists for the specified name
-
intercept
ServiceDescriptor.Rules intercept(String methodName, int priority, io.grpc.ServerInterceptor... interceptors) Register one or moreinterceptors
for a named method of the service.The added interceptors will be applied using the specified priority.
- Parameters:
methodName
- the name of the method to interceptpriority
- the priority to assign to the interceptorsinterceptors
- the interceptor(s) to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining - Throws:
IllegalArgumentException
- if no method exists for the specified name
-
addContextValue
Add value to theContext
for the service.- Type Parameters:
V
- the type of the value- Parameters:
key
- the key for the context valuevalue
- the value to add- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
unary
<ReqT,ResT> ServiceDescriptor.Rules unary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT, ResT> method) Register unary method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the unary method to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
unary
<ReqT,ResT> ServiceDescriptor.Rules unary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register unary method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the unary method to registerconfigurer
- the method configurer- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
serverStreaming
<ReqT,ResT> ServiceDescriptor.Rules serverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT, ResT> method) Register server streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the server streaming method to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
serverStreaming
<ReqT,ResT> ServiceDescriptor.Rules serverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register server streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the server streaming method to registerconfigurer
- the method configurer- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
clientStreaming
<ReqT,ResT> ServiceDescriptor.Rules clientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT, ResT> method) Register client streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the client streaming method to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
clientStreaming
<ReqT,ResT> ServiceDescriptor.Rules clientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register client streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the client streaming method to registerconfigurer
- the method configurer- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
bidirectional
<ReqT,ResT> ServiceDescriptor.Rules bidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT, ResT> method) Register bi-directional streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the bi-directional streaming method to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
bidirectional
<ReqT,ResT> ServiceDescriptor.Rules bidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT, ResT> method, MethodDescriptor.Configurer<ReqT, ResT> configurer) Register bi-directional streaming method for the service.- Type Parameters:
ReqT
- the method request typeResT
- the method response type- Parameters:
name
- the name of the methodmethod
- the bi-directional streaming method to registerconfigurer
- the method configurer- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
healthCheck
Register the serviceHealthCheck
.- Parameters:
healthCheck
- the serviceHealthCheck
- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-