Interface MethodDescriptor.Rules<ReqT,ResT>

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

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

    • addContextValue

      <T> MethodDescriptor.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 MethodDescriptor.Rules instance for fluent call chaining
      Throws:
      NullPointerException - if the key parameter is null
    • intercept

      MethodDescriptor.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

      MethodDescriptor.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

      MethodDescriptor.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 ServiceDescriptor.Rules instance for fluent call chaining
    • requestType

      <Rnew> MethodDescriptor.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 ServiceDescriptor.Rules instance for fluent call chaining
    • responseType

      <Rnew> MethodDescriptor.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 ServiceDescriptor.Rules instance for fluent call chaining