Class GrpcRouting.Builder

java.lang.Object
io.helidon.grpc.server.GrpcRouting.Builder
All Implemented Interfaces:
Builder<GrpcRouting.Builder,GrpcRouting>, Supplier<GrpcRouting>
Enclosing interface:
GrpcRouting

public static final class GrpcRouting.Builder extends Object implements Builder<GrpcRouting.Builder,GrpcRouting>
A builder that can build GrpcRouting instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • intercept

      public GrpcRouting.Builder intercept(io.grpc.ServerInterceptor... interceptors)
      Add one or more global ServerInterceptor instances that will intercept calls to all services in the GrpcRouting built by this builder.

      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 of InterceptorPriorities.USER will be used.

      Parameters:
      interceptors - one or more global ServerInterceptors
      Returns:
      this builder to allow fluent method chaining
    • intercept

      public GrpcRouting.Builder intercept(int priority, io.grpc.ServerInterceptor... interceptors)
      Add one or more global ServerInterceptor instances that will intercept calls to all services in the GrpcRouting built by this builder.

      The added interceptors will be applied using the specified priority.

      Parameters:
      priority - the priority to assign to the interceptors
      interceptors - one or more global ServerInterceptors
      Returns:
      this builder to allow fluent method chaining
    • register

      public GrpcRouting.Builder register(GrpcService service)
      Add a GrpcService with the GrpcRouting to be built by this builder.
      Parameters:
      service - the GrpcService to register
      Returns:
      this builder to allow fluent method chaining
      Throws:
      IllegalArgumentException - if an attempt is made to register a service with the same name as an already registered service
    • register

      public GrpcRouting.Builder register(GrpcService service, ServiceDescriptor.Configurer configurer)
      Add a GrpcService with the GrpcRouting to be built by this builder.
      Parameters:
      service - the GrpcService to register
      configurer - an optional configurer that can update the ServiceDescriptor for the registered service
      Returns:
      this builder to allow fluent method chaining
      Throws:
      IllegalArgumentException - if an attempt is made to register a service with the same name as an already registered service
    • register

      public GrpcRouting.Builder register(io.grpc.BindableService service)
      Add a BindableService with the GrpcRouting to be built by this builder.
      Parameters:
      service - the BindableService to register
      Returns:
      this builder to allow fluent method chaining
      Throws:
      IllegalArgumentException - if an attempt is made to register a service with the same name as an already registered service
    • register

      public GrpcRouting.Builder register(io.grpc.BindableService service, ServiceDescriptor.Configurer configurer)
      Add a BindableService with the GrpcRouting to be built by this builder.
      Parameters:
      service - the BindableService to register
      configurer - an optional configurer that can update the ServiceDescriptor for the registered service
      Returns:
      this builder to allow fluent method chaining
      Throws:
      IllegalArgumentException - if an attempt is made to register a service with the same name as an already registered service
    • register

      public GrpcRouting.Builder register(ServiceDescriptor service)
      Register a ServiceDescriptor with the GrpcRouting to be built by this builder.
      Parameters:
      service - the ServiceDescriptor to register
      Returns:
      this builder to allow fluent method chaining
      Throws:
      IllegalArgumentException - if an attempt is made to register a service with the same name as an already registered service
    • build

      public GrpcRouting build()
      Builds a new GrpcRouting.
      Specified by:
      build in interface Builder<GrpcRouting.Builder,GrpcRouting>
      Returns:
      a new GrpcRouting instance