Package io.helidon.grpc.server
Class ServiceDescriptor.Builder
- java.lang.Object
-
- io.helidon.grpc.server.ServiceDescriptor.Builder
-
- All Implemented Interfaces:
Builder<ServiceDescriptor>
,ServiceDescriptor.Rules
,Supplier<ServiceDescriptor>
- Enclosing class:
- ServiceDescriptor
public static final class ServiceDescriptor.Builder extends Object implements ServiceDescriptor.Rules, Builder<ServiceDescriptor>
AServiceDescriptor
builder.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> ServiceDescriptor.Builder
addContextValue(io.grpc.Context.Key<V> key, V value)
Add value to theContext
for the service.<ReqT,ResT>
ServiceDescriptor.Builderbidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,ResT> method)
Register bi-directional streaming method for the service.<ReqT,ResT>
ServiceDescriptor.Builderbidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Register bi-directional streaming method for the service.ServiceDescriptor
build()
Build the instance from this builder.<ReqT,ResT>
ServiceDescriptor.BuilderclientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,ResT> method)
Register client streaming method for the service.<ReqT,ResT>
ServiceDescriptor.BuilderclientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Register client streaming method for the service.ServiceDescriptor.Builder
healthCheck(HealthCheck healthCheck)
Register the serviceHealthCheck
.ServiceDescriptor.Builder
intercept(int priority, io.grpc.ServerInterceptor... interceptors)
Add one or moreServerInterceptor
instances that will intercept calls to this service.ServiceDescriptor.Builder
intercept(io.grpc.ServerInterceptor... interceptors)
Add one or moreServerInterceptor
instances that will intercept calls to this service.ServiceDescriptor.Builder
intercept(String methodName, int priority, io.grpc.ServerInterceptor... interceptors)
Register one or moreinterceptors
for a named method of the service.ServiceDescriptor.Builder
intercept(String methodName, io.grpc.ServerInterceptor... interceptors)
Register one or moreinterceptors
for a named method of the service.ServiceDescriptor.Builder
marshallerSupplier(MarshallerSupplier marshallerSupplier)
Register theMarshallerSupplier
for the service.String
name()
Obtain the name fo the service this configuration configures.ServiceDescriptor.Builder
name(String name)
Set the name for the service.ServiceDescriptor.Builder
proto(com.google.protobuf.Descriptors.FileDescriptor proto)
Register the proto for the service.<ReqT,ResT>
ServiceDescriptor.BuilderserverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,ResT> method)
Register server streaming method for the service.<ReqT,ResT>
ServiceDescriptor.BuilderserverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Register server streaming method for the service.String
toString()
<ReqT,ResT>
ServiceDescriptor.Builderunary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT,ResT> method)
Register unary method for the service.<ReqT,ResT>
ServiceDescriptor.Builderunary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Register unary method for the service.
-
-
-
Method Detail
-
name
public String name()
Description copied from interface:ServiceDescriptor.Rules
Obtain the name fo the service this configuration configures.- Specified by:
name
in interfaceServiceDescriptor.Rules
- Returns:
- the name fo the service this configuration configures
-
name
public ServiceDescriptor.Builder name(String name)
Description copied from interface:ServiceDescriptor.Rules
Set the name for the service.- Specified by:
name
in interfaceServiceDescriptor.Rules
- Parameters:
name
- the service name- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
proto
public ServiceDescriptor.Builder proto(com.google.protobuf.Descriptors.FileDescriptor proto)
Description copied from interface:ServiceDescriptor.Rules
Register the proto for the service.- Specified by:
proto
in interfaceServiceDescriptor.Rules
- Parameters:
proto
- the service proto- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
marshallerSupplier
public ServiceDescriptor.Builder marshallerSupplier(MarshallerSupplier marshallerSupplier)
Description copied from interface:ServiceDescriptor.Rules
Register theMarshallerSupplier
for the service.- Specified by:
marshallerSupplier
in interfaceServiceDescriptor.Rules
- Parameters:
marshallerSupplier
- theMarshallerSupplier
for the service- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
unary
public <ReqT,ResT> ServiceDescriptor.Builder unary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT,ResT> method)
Description copied from interface:ServiceDescriptor.Rules
Register unary method for the service.- Specified by:
unary
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder unary(String name, io.grpc.stub.ServerCalls.UnaryMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Description copied from interface:ServiceDescriptor.Rules
Register unary method for the service.- Specified by:
unary
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder serverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,ResT> method)
Description copied from interface:ServiceDescriptor.Rules
Register server streaming method for the service.- Specified by:
serverStreaming
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder serverStreaming(String name, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Description copied from interface:ServiceDescriptor.Rules
Register server streaming method for the service.- Specified by:
serverStreaming
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder clientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,ResT> method)
Description copied from interface:ServiceDescriptor.Rules
Register client streaming method for the service.- Specified by:
clientStreaming
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder clientStreaming(String name, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Description copied from interface:ServiceDescriptor.Rules
Register client streaming method for the service.- Specified by:
clientStreaming
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder bidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,ResT> method)
Description copied from interface:ServiceDescriptor.Rules
Register bi-directional streaming method for the service.- Specified by:
bidirectional
in interfaceServiceDescriptor.Rules
- 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
public <ReqT,ResT> ServiceDescriptor.Builder bidirectional(String name, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,ResT> method, MethodDescriptor.Configurer<ReqT,ResT> configurer)
Description copied from interface:ServiceDescriptor.Rules
Register bi-directional streaming method for the service.- Specified by:
bidirectional
in interfaceServiceDescriptor.Rules
- 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
-
intercept
public ServiceDescriptor.Builder intercept(io.grpc.ServerInterceptor... interceptors)
Description copied from interface:ServiceDescriptor.Rules
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.- Specified by:
intercept
in interfaceServiceDescriptor.Rules
- Parameters:
interceptors
- one or moreServerInterceptor
s to add- Returns:
- this builder to allow fluent method chaining
-
intercept
public ServiceDescriptor.Builder intercept(int priority, io.grpc.ServerInterceptor... interceptors)
Description copied from interface:ServiceDescriptor.Rules
Add one or moreServerInterceptor
instances that will intercept calls to this service.The added interceptors will be applied using the specified priority.
- Specified by:
intercept
in interfaceServiceDescriptor.Rules
- Parameters:
priority
- the priority to assign to the interceptorsinterceptors
- one or moreServerInterceptor
s to add- Returns:
- this builder to allow fluent method chaining
-
intercept
public ServiceDescriptor.Builder intercept(String methodName, io.grpc.ServerInterceptor... interceptors)
Description copied from interface:ServiceDescriptor.Rules
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.- Specified by:
intercept
in interfaceServiceDescriptor.Rules
- Parameters:
methodName
- the name of the method to interceptinterceptors
- the interceptor(s) to register- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
intercept
public ServiceDescriptor.Builder intercept(String methodName, int priority, io.grpc.ServerInterceptor... interceptors)
Description copied from interface:ServiceDescriptor.Rules
Register one or moreinterceptors
for a named method of the service.The added interceptors will be applied using the specified priority.
- Specified by:
intercept
in interfaceServiceDescriptor.Rules
- 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
-
addContextValue
public <V> ServiceDescriptor.Builder addContextValue(io.grpc.Context.Key<V> key, V value)
Description copied from interface:ServiceDescriptor.Rules
Add value to theContext
for the service.- Specified by:
addContextValue
in interfaceServiceDescriptor.Rules
- 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
-
healthCheck
public ServiceDescriptor.Builder healthCheck(HealthCheck healthCheck)
Description copied from interface:ServiceDescriptor.Rules
Register the serviceHealthCheck
.- Specified by:
healthCheck
in interfaceServiceDescriptor.Rules
- Parameters:
healthCheck
- the serviceHealthCheck
- Returns:
- this
ServiceDescriptor.Rules
instance for fluent call chaining
-
build
public ServiceDescriptor build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<ServiceDescriptor>
- Returns:
- instance of the built type
-
-