Package com.yahoo.jrt

Class Method

java.lang.Object
com.yahoo.jrt.Method

public class Method extends Object

A Method encapsulates the reflective information about a single RPC method.

Method parameters and return values are declared with type strings. A type string denotes the concatenation of type identifiers where a string is used to represent a sequence of types. For example 'ii' is the type string for two 32-bit integers, while 'iss' is the type string for a single 32-bit integer followed by two strings. The complete list of type identifiers can be found in the Value class.

The type strings associated with actual method parameters and return values may only contain valid type identifiers. However, when you specify the parameters accepted by- or returned from a RPC method via the Method constructor, '*' may be used as the last character in the type string. Ending a type string specification with '*' means that additional values are optional and may have any type. This feature can also be used with the Request.checkReturnTypes method when verifying return types.

See Also:
  • Constructor Details

    • Method

      public Method(String name, String paramTypes, String returnTypes, MethodHandler handler)
      Create a new Method. The parameters define the name of the method, the parameter types, the return value types and also the handler for the method. Please refer to the Method class description for an explanation of type strings.
      Parameters:
      name - method name
      paramTypes - a type string defining the parameter types
      returnTypes - a type string defining the return value types
      handler - the handler for this RPC method
      Throws:
      MethodCreateException - if the handler is null.
  • Method Details

    • methodDesc

      public Method methodDesc(String desc)
      Describe this method. This adds documentation that can be obtained through remote reflection.
      Returns:
      this Method, to allow chaining
    • paramDesc

      public Method paramDesc(int index, String name, String desc)
      Describe a parameter of this method. This adds documentation that can be obtained through remote reflection.
      Parameters:
      index - the parameter index
      name - the parameter name
      desc - the parameter description
      Returns:
      this Method, to allow chaining
    • requestAccessFilter

      public Method requestAccessFilter(RequestAccessFilter filter)
    • requestAccessFilter

      public RequestAccessFilter requestAccessFilter()
    • returnDesc

      public Method returnDesc(int index, String name, String desc)
      Describe a return value of this method. This adds documentation that can be obtained through remote reflection.
      Parameters:
      index - the return value index
      name - the return value name
      desc - the return value description
      Returns:
      this Method, to allow chaining
    • toString

      public String toString()
      Overrides:
      toString in class Object