Package com.yahoo.jrt

Class Method


  • public class Method
    extends java.lang.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:
    Supervisor.addMethod(com.yahoo.jrt.Method)
    • Constructor Summary

      Constructors 
      Constructor Description
      Method​(java.lang.String name, java.lang.String paramTypes, java.lang.String returnTypes, MethodHandler handler)
      Create a new Method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Method methodDesc​(java.lang.String desc)
      Describe this method.
      Method paramDesc​(int index, java.lang.String name, java.lang.String desc)
      Describe a parameter of this method.
      Method returnDesc​(int index, java.lang.String name, java.lang.String desc)
      Describe a return value of this method.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Method

        public Method​(java.lang.String name,
                      java.lang.String paramTypes,
                      java.lang.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 Detail

      • methodDesc

        public Method methodDesc​(java.lang.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,
                                java.lang.String name,
                                java.lang.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
      • returnDesc

        public Method returnDesc​(int index,
                                 java.lang.String name,
                                 java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object