public class

RemoteInvocation

extends Object
implements Serializable
java.lang.Object
   ↳ org.springframework.remoting.support.RemoteInvocation

Class Overview

Encapsulates a remote invocation, providing core method invocation properties in a serializable fashion. Used for RMI and HTTP-based serialization invokers.

This is an SPI class, typically not used directly by applications. Can be subclassed for additional invocation parameters.

Summary

Public Constructors
RemoteInvocation()
Create a new RemoteInvocation for use as JavaBean.
RemoteInvocation(String methodName, Class[] parameterTypes, Object[] arguments)
Create a new RemoteInvocation for the given parameters.
RemoteInvocation(MethodInvocation methodInvocation)
Create a new RemoteInvocation for the given AOP method invocation.
Public Methods
void addAttribute(String key, Serializable value)
Add an additional invocation attribute.
Object[] getArguments()
Return the arguments for the target method call.
Serializable getAttribute(String key)
Retrieve the attribute for the given key, if any.
Map<StringSerializable> getAttributes()
Return the attributes Map.
String getMethodName()
Return the name of the target method.
Class[] getParameterTypes()
Return the parameter types of the target method.
Object invoke(Object targetObject)
Perform this invocation on the given target object.
void setArguments(Object[] arguments)
Set the arguments for the target method call.
void setAttributes(Map<StringSerializable> attributes)
Set the attributes Map.
void setMethodName(String methodName)
Set the name of the target method.
void setParameterTypes(Class[] parameterTypes)
Set the parameter types of the target method.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RemoteInvocation ()

Create a new RemoteInvocation for use as JavaBean.

public RemoteInvocation (String methodName, Class[] parameterTypes, Object[] arguments)

Create a new RemoteInvocation for the given parameters.

Parameters
methodName the name of the method to invoke
parameterTypes the parameter types of the method
arguments the arguments for the invocation

public RemoteInvocation (MethodInvocation methodInvocation)

Create a new RemoteInvocation for the given AOP method invocation.

Parameters
methodInvocation the AOP invocation to convert

Public Methods

public void addAttribute (String key, Serializable value)

Add an additional invocation attribute. Useful to add additional invocation context without having to subclass RemoteInvocation.

Attribute keys have to be unique, and no overriding of existing attributes is allowed.

The implementation avoids to unnecessarily create the attributes Map, to minimize serialization size.

Parameters
key the attribute key
value the attribute value
Throws
IllegalStateException if the key is already bound

public Object[] getArguments ()

Return the arguments for the target method call.

public Serializable getAttribute (String key)

Retrieve the attribute for the given key, if any.

The implementation avoids to unnecessarily create the attributes Map, to minimize serialization size.

Parameters
key the attribute key
Returns
  • the attribute value, or null if not defined

public Map<StringSerializable> getAttributes ()

Return the attributes Map. Mainly here for debugging purposes: Preferably, use addAttribute(String, Serializable) and getAttribute(String).

Returns
  • the attributes Map, or null if none created

public String getMethodName ()

Return the name of the target method.

public Class[] getParameterTypes ()

Return the parameter types of the target method.

public Object invoke (Object targetObject)

Perform this invocation on the given target object. Typically called when a RemoteInvocation is received on the server.

Parameters
targetObject the target object to apply the invocation to
Returns
  • the invocation result
Throws
NoSuchMethodException if the method name could not be resolved
IllegalAccessException if the method could not be accessed
InvocationTargetException if the method invocation resulted in an exception

public void setArguments (Object[] arguments)

Set the arguments for the target method call.

public void setAttributes (Map<StringSerializable> attributes)

Set the attributes Map. Only here for special purposes: Preferably, use addAttribute(String, Serializable) and getAttribute(String).

Parameters
attributes the attributes Map

public void setMethodName (String methodName)

Set the name of the target method.

public void setParameterTypes (Class[] parameterTypes)

Set the parameter types of the target method.

public String toString ()