org.jgroups.blocks

Class MethodCall

public class MethodCall extends Object implements 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.19 $

Author: Bela Ban

Field Summary
protected Object[]args
The arguments of the method.
protected static shortID
Use an ID to map to a method
protected static Loglog
protected Methodmethod
The Method of the call.
protected shortmethod_id
The ID of a method, maps to a java.lang.reflect.Method
protected Stringmethod_name
The name of the method, case sensitive.
protected shortmode
Which mode to use.
protected static shortMETHOD
Explicitly ship the method, caller has to determine method himself.
protected static shortOLD
Infer the method from the arguments.
protected Mappayload
To carry arbitrary data with a method call, data needs to be serializable if sent across the wire
protected String[]signature
The signature, e.g., new String[]{String.class.getName(), int.class.getName()}.
protected static shortSIGNATURE
Provide a signature, similar to JMX.
protected Class[]types
The class types, e.g., new Class[]{String.class, int.class}.
protected static shortTYPES
Use class information.
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)
MethodCall(short method_id, Object[] args)
MethodCall(String method_name, Object[] args, Class[] types)
MethodCall(String method_name, Object[] args, String[] signature)
Method Summary
Objectget(Object key)
Object[]getArgs()
returns an ordered list of arguments used for the method invokation
shortgetId()
MethodgetMethod()
intgetMode()
StringgetName()
returns the name of the method to be invoked using this method call object
Objectinvoke(Object target)
Invokes the method with the supplied arguments against the target object.
Objectinvoke(Object target, Object[] args)
Objectput(Object key, Object value)
voidreadExternal(ObjectInput in)
voidsetArgs(Object[] args)
voidsetId(short method_id)
voidsetMethod(Method m)
voidsetName(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
StringtoString()
StringtoStringDetails()
voidwriteExternal(ObjectOutput out)

Field Detail

args

protected Object[] args
The arguments of the method.

ID

protected static final short ID
Use an ID to map to a method

log

protected static final Log log

method

protected Method method
The Method of the call.

method_id

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

method_name

protected String method_name
The name of the method, case sensitive.

mode

protected short mode
Which mode to use.

METHOD

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

OLD

protected static final short OLD
Infer the method from the arguments.

payload

protected Map payload
To carry arbitrary data with a method call, data needs to be serializable if sent across the wire

signature

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

SIGNATURE

protected static final short SIGNATURE
Provide a signature, similar to JMX.

types

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

TYPES

protected static final short TYPES
Use class information.

Constructor Detail

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(short method_id, Object[] args)

MethodCall

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

MethodCall

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

Method Detail

get

public Object get(Object key)

getArgs

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

Returns: returns the list of ordered arguments

getId

public short getId()

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)
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)

put

public Object put(Object key, Object value)

readExternal

public void readExternal(ObjectInput in)

setArgs

public void setArgs(Object[] args)

setId

public void setId(short method_id)

setMethod

public void setMethod(Method m)

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)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.