Interface ServiceDescriptor.Rules

All Known Implementing Classes:
ServiceDescriptor.Builder
Enclosing class:
ServiceDescriptor

public static interface ServiceDescriptor.Rules
Fluent configuration interface for the ServiceDescriptor.
  • 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 null
      IllegalArgumentException - 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

      ServiceDescriptor.Rules proto(com.google.protobuf.Descriptors.FileDescriptor proto)
      Register the proto for the service.
      Parameters:
      proto - the service proto
      Returns:
      this ServiceDescriptor.Rules instance for fluent call chaining
    • marshallerSupplier

      ServiceDescriptor.Rules marshallerSupplier(MarshallerSupplier marshallerSupplier)
      Register the MarshallerSupplier for the service.
      Parameters:
      marshallerSupplier - the MarshallerSupplier for the service
      Returns:
      this ServiceDescriptor.Rules instance for fluent call chaining
    • intercept

      ServiceDescriptor.Rules intercept(io.grpc.ServerInterceptor... interceptors)
      Add one or more ServerInterceptor 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 of InterceptorPriorities.USER will be used.

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

      ServiceDescriptor.Rules intercept(int priority, io.grpc.ServerInterceptor... interceptors)
      Add one or more ServerInterceptor 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 interceptors
      interceptors - one or more ServerInterceptors to add
      Returns:
      this builder to allow fluent method chaining
    • intercept

      ServiceDescriptor.Rules intercept(String methodName, io.grpc.ServerInterceptor... interceptors)
      Register one or more interceptors 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 of InterceptorPriorities.USER will be used.

      Parameters:
      methodName - the name of the method to intercept
      interceptors - 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 more interceptors 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 intercept
      priority - the priority to assign to the interceptors
      interceptors - 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

      <V> ServiceDescriptor.Rules addContextValue(io.grpc.Context.Key<V> key, V value)
      Add value to the Context for the service.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key for the context value
      value - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - the unary method to register
      configurer - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - the server streaming method to register
      configurer - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - the client streaming method to register
      configurer - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - 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 type
      ResT - the method response type
      Parameters:
      name - the name of the method
      method - the bi-directional streaming method to register
      configurer - the method configurer
      Returns:
      this ServiceDescriptor.Rules instance for fluent call chaining
    • healthCheck

      ServiceDescriptor.Rules healthCheck(HealthCheck healthCheck)
      Register the service HealthCheck.
      Parameters:
      healthCheck - the service HealthCheck
      Returns:
      this ServiceDescriptor.Rules instance for fluent call chaining