org.jgroups.blocks

## Class MethodCall

- java.lang.Object
- - org.jgroups.blocks.MethodCall

- All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

      public class MethodCall
      extends java.lang.Object
      implements java.io.Externalizable

  A method call is the JGroups representation of a remote method. It includes the name of the method (case sensitive) and a list of arguments. A method call is serializable and can be passed over the wire.
  Version:
    $Revision: 1.39 $
  Author:
    Bela Ban
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Object[]` | `args` The arguments of the method.
    `protected static short` | `ID` Use an ID to map to a method
    `protected static Log` | `log`
    `protected java.lang.reflect.Method` | `method` The Method of the call.
    `protected static short` | `METHOD` Explicitly ship the method, caller has to determine method himself.
    `protected short` | `method_id` The ID of a method, maps to a java.lang.reflect.Method
    `protected java.lang.String` | `method_name` The name of the method, case sensitive.
    `protected short` | `mode` Which mode to use.
    `protected static short` | `OLD` Infer the method from the arguments.
    `protected java.util.Map` | `payload` Deprecated.
    `protected java.lang.String[]` | `signature` Deprecated.
    `protected static short` | `SIGNATURE` Provide a signature, similar to JMX.
    `protected java.lang.Class[]` | `types` The class types, e.g., new Class[]{String.class, int.class}.
    `protected static short` | `TYPES` Use class information.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodCall()` Creates an empty method call, this is always invalid, until `setName()` has been called.
    `MethodCall(java.lang.reflect.Method method)`
    `MethodCall(java.lang.reflect.Method method, java.lang.Object... arguments)`
    `MethodCall(short method_id, java.lang.Object... args)`
    `MethodCall(java.lang.String method_name, java.lang.Object... args)` Deprecated.
    `MethodCall(java.lang.String method_name, java.lang.Object[] args, java.lang.Class[] types)`
    `MethodCall(java.lang.String method_name, java.lang.Object[] args, java.lang.String[] signature)` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.Object` | `convert(java.lang.String arg, java.lang.Class<?> type)`
    `static java.lang.reflect.Method` | `findMethod(java.lang.Class target_class, java.lang.String method_name, java.lang.Object[] args)`
    `java.lang.Object` | `get(java.lang.Object key)` Deprecated.
    `java.lang.Object[]` | `getArgs()` returns an ordered list of arguments used for the method invokation
    `short` | `getId()`
    `java.lang.reflect.Method` | `getMethod()`
    `int` | `getMode()`
    `java.lang.String` | `getName()` returns the name of the method to be invoked using this method call object
    `java.lang.Object` | `invoke(java.lang.Object target)` Invokes the method with the supplied arguments against the target object.
    `java.lang.Object` | `invoke(java.lang.Object target, java.lang.Object[] args)`
    `java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)` Deprecated.
    `void` | `readExternal(java.io.ObjectInput in)`
    `void` | `setArgs(java.lang.Object[] args)`
    `void` | `setId(short method_id)`
    `void` | `setMethod(java.lang.reflect.Method m)`
    `void` | `setName(java.lang.String n)` sets the name for this MethodCall and allowing you to reuse the same object for a different method invokation of a different method
    `java.lang.String` | `toString()`
    `java.lang.String` | `toStringDetails()`
    `void` | `writeExternal(java.io.ObjectOutput out)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### method_name

          protected java.lang.String method_name

      The name of the method, case sensitive.

    - #### method_id

          protected short method_id

      The ID of a method, maps to a java.lang.reflect.Method

    - #### args

          protected java.lang.Object[] args

      The arguments of the method.

    - #### types

          protected java.lang.Class[] types

      The class types, e.g., new Class[]{String.class, int.class}.

    - #### signature

          @Deprecated
          protected java.lang.String[] signature

      Deprecated.
      The signature, e.g., new String[]{String.class.getName(), int.class.getName()}.

    - #### method

          protected java.lang.reflect.Method method

      The Method of the call.

    - #### payload

          @Deprecated
          protected java.util.Map payload

      Deprecated.
      To carry arbitrary data with a method call, data needs to be serializable if sent across the wire

    - #### log

          protected static final Log log

    - #### mode

          protected short mode

      Which mode to use.

    - #### OLD

          protected static final short OLD

      Infer the method from the arguments.
      See Also:
        Constant Field Values

    - #### METHOD

          protected static final short METHOD

      Explicitly ship the method, caller has to determine method himself.
      See Also:
        Constant Field Values

    - #### TYPES

          protected static final short TYPES

      Use class information.
      See Also:
        Constant Field Values

    - #### SIGNATURE

          protected static final short SIGNATURE

      Provide a signature, similar to JMX.
      See Also:
        Constant Field Values

    - #### ID

          protected static final short ID

      Use an ID to map to a method
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MethodCall

          public MethodCall()

      Creates an empty method call, this is always invalid, until `setName()` has been called.

    - #### MethodCall

          public MethodCall(java.lang.reflect.Method method)

    - #### MethodCall

          public MethodCall(java.lang.reflect.Method method,
                    java.lang.Object... arguments)

    - #### MethodCall

          @Deprecated
          public MethodCall(java.lang.String method_name,
                               java.lang.Object... args)

      Deprecated.
      Parameters:
        `method_name` -
        `args` -

    - #### MethodCall

          public MethodCall(short method_id,
                    java.lang.Object... args)

    - #### MethodCall

          public MethodCall(java.lang.String method_name,
                    java.lang.Object[] args,
                    java.lang.Class[] types)

    - #### MethodCall

          @Deprecated
          public MethodCall(java.lang.String method_name,
                               java.lang.Object[] args,
                               java.lang.String[] signature)

      Deprecated.

  - ### Method Detail

    - #### getMode

          public int getMode()

    - #### getName

          public java.lang.String getName()

      returns the name of the method to be invoked using this method call object
      Returns:
        a case sensitive name, can be null for an invalid method call

    - #### setName

          public void setName(java.lang.String n)

      sets the name for this MethodCall and allowing you to reuse the same object for a different method invokation of a different method
      Parameters:
        `n` - - a case sensitive method name

    - #### getId

          public short getId()

    - #### setId

          public void setId(short method_id)

    - #### getArgs

          public java.lang.Object[] getArgs()

      returns an ordered list of arguments used for the method invokation
      Returns:
        returns the list of ordered arguments

    - #### setArgs

          public void setArgs(java.lang.Object[] args)

    - #### getMethod

          public java.lang.reflect.Method getMethod()

    - #### setMethod

          public void setMethod(java.lang.reflect.Method m)

    - #### put

          @Deprecated
          public java.lang.Object put(java.lang.Object key,
                                        java.lang.Object value)

      Deprecated.

    - #### get

          @Deprecated
          public java.lang.Object get(java.lang.Object key)

      Deprecated.

    - #### findMethod

          public static java.lang.reflect.Method findMethod(java.lang.Class target_class,
                                            java.lang.String method_name,
                                            java.lang.Object[] args)
                                                     throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### invoke

          public java.lang.Object invoke(java.lang.Object target)
                                  throws java.lang.Throwable

      Invokes the method with the supplied arguments against the target object. If a method lookup is provided, it will be used. Otherwise, the default method lookup will be used.
      Parameters:
        `target` - - the object that you want to invoke the method on
      Returns:
        an object
      Throws:
        `java.lang.Throwable`

    - #### invoke

          public java.lang.Object invoke(java.lang.Object target,
                                java.lang.Object[] args)
                                  throws java.lang.Throwable

      Throws:
        `java.lang.Throwable`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### toStringDetails

          public java.lang.String toStringDetails()

    - #### writeExternal

          public void writeExternal(java.io.ObjectOutput out)
                             throws java.io.IOException

      Specified by:
        `writeExternal` in interface `java.io.Externalizable`
      Throws:
        `java.io.IOException`

    - #### readExternal

          public void readExternal(java.io.ObjectInput in)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException

      Specified by:
        `readExternal` in interface `java.io.Externalizable`
      Throws:
        `java.io.IOException`
        `java.lang.ClassNotFoundException`

    - #### convert

          public static java.lang.Object convert(java.lang.String arg,
                                 java.lang.Class<?> type)

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.