org.jgroups.blocks

Class MethodCall

Implemented Interfaces:
Externalizable

public class MethodCall
extends java.lang.Object
implements Externalizable

A method call is the JavaGroup 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.9 $

Author:
Bela Ban

Field Summary

protected static short
METHOD
explicitly ship the method, caller has to determine method himself
protected static short
OLD
infer the method from the arguments
protected static short
SIGNATURE
provide a signature, similar to JMX
protected static short
TYPES
use class information
protected Object[]
args
the arguments of the method
protected static Log
log
protected Method
method
the Method of the call
protected String
method_name
the name of the method, case sensitive
protected short
mode
which mode to use
protected String[]
signature
the signature, e.g.
protected Class[]
types
the class types, e.g.

Constructor Summary

MethodCall()
creates an empty method call, this is always invalid, until setName() has been called
MethodCall(Method method)
MethodCall(Method method, Object[] arguments)
MethodCall(String method_name, Object[] args)
Deprecated. Use one of the constructors that take class types as arguments
MethodCall(String method_name, Object[] args, Class[] types)
MethodCall(String method_name, Object[] args, String[] signature)

Method Summary

Object[]
getArgs()
returns an ordered list of arguments used for the method invokation
Method
getMethod()
int
getMode()
String
getName()
returns the name of the method to be invoked using this method call object
Object
invoke(Object target)
Invokes the method with the supplied arguments against the target object.
Object
invoke(Object target, Object[] args)
void
readExternal(ObjectInput in)
void
setArgs(Object[] args)
void
setName(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
String
toString()
String
toStringDetails()
void
writeExternal(ObjectOutput out)

Field Details

METHOD

protected static final short METHOD
explicitly ship the method, caller has to determine method himself

Field Value:
2


OLD

protected static final short OLD
infer the method from the arguments

Field Value:
1


SIGNATURE

protected static final short SIGNATURE
provide a signature, similar to JMX

Field Value:
4


TYPES

protected static final short TYPES
use class information

Field Value:
3


args

protected Object[] args
the arguments of the method


log

protected static Log log


method

protected Method method
the Method of the call


method_name

protected String method_name
the name of the method, case sensitive


mode

protected short mode
which mode to use


signature

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


types

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

Constructor Details

MethodCall

public MethodCall()
creates an empty method call, this is always invalid, until setName() has been called


MethodCall

public MethodCall(Method method)


MethodCall

public MethodCall(Method method,
                  Object[] arguments)


MethodCall

public MethodCall(String method_name,
                  Object[] args)

Deprecated. Use one of the constructors that take class types as arguments

Parameters:
method_name -
args -


MethodCall

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


MethodCall

public MethodCall(String method_name,
                  Object[] args,
                  String[] signature)

Method Details

getArgs

public Object[] getArgs()
returns an ordered list of arguments used for the method invokation

Returns:
returns the list of ordered arguments


getMethod

public Method getMethod()


getMode

public int getMode()


getName

public 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


invoke

public Object invoke(Object target)
            throws 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


invoke

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


readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException


setArgs

public void setArgs(Object[] args)


setName

public void setName(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


toString

public String toString()


toStringDetails

public String toStringDetails()


writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.