Interface GrpcMethodDescriptor.Rules<ReqT,ResT>

Type Parameters:
ReqT - request type
ResT - response type
Enclosing class:
GrpcMethodDescriptor<ReqT,ResT>

public static interface GrpcMethodDescriptor.Rules<ReqT,ResT>
Method configuration API.
  • Method Details

    • addContextValue

      <T> GrpcMethodDescriptor.Rules<ReqT,ResT> addContextValue(io.grpc.Context.Key<T> key, T value)
      Add a Context.Key and value to be added to the call Context when this method is invoked.
      Type Parameters:
      T - the type of the Context.Key and value
      Parameters:
      key - the Context.Key to add
      value - the value to map to the Context.Key
      Returns:
      this GrpcMethodDescriptor.Rules instance for fluent call chaining
      Throws:
      NullPointerException - if the key parameter is null
    • intercept

      GrpcMethodDescriptor.Rules<ReqT,ResT> intercept(io.grpc.ServerInterceptor... interceptors)
      Register one or more interceptors for the method.
      Parameters:
      interceptors - one or more ServerInterceptors to register
      Returns:
      this builder to allow fluent method chaining
    • intercept

      GrpcMethodDescriptor.Rules<ReqT,ResT> intercept(int priority, io.grpc.ServerInterceptor... interceptors)
      Register one or more interceptors for the method.

      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 register
      Returns:
      this builder to allow fluent method chaining
    • marshallerSupplier

      GrpcMethodDescriptor.Rules<ReqT,ResT> marshallerSupplier(MarshallerSupplier marshallerSupplier)
      Register the MarshallerSupplier for the method.

      If not set the default MarshallerSupplier from the service will be used.

      Parameters:
      marshallerSupplier - the MarshallerSupplier for the service
      Returns:
      this GrpcServiceDescriptor.Rules instance for fluent call chaining
    • requestType

      <Rnew> GrpcMethodDescriptor.Rules<Rnew,ResT> requestType(Class<Rnew> requestType)
      Set the request type.

      Setting the request type is optional as it is used to obtain the correct marshaller so if the marshaller supplier being used is type agnostic, such as Java serialization then whereas some marshallers such as Protocol Buffers require a type.

      Type Parameters:
      Rnew - the type of the request message
      Parameters:
      requestType - the type of the request message
      Returns:
      this GrpcServiceDescriptor.Rules instance for fluent call chaining
    • responseType

      <Rnew> GrpcMethodDescriptor.Rules<ReqT,Rnew> responseType(Class<Rnew> responseType)
      Set the response type.

      Setting the response type is optional as it is used to obtain the correct marshaller so if the marshaller supplier being used is type agnostic, such as Java serialization then whereas some marshallers such as Protocol Buffers require a type.

      Type Parameters:
      Rnew - the type of the request message
      Parameters:
      responseType - the type of the request message
      Returns:
      this GrpcServiceDescriptor.Rules instance for fluent call chaining