public class RemoteInvocation extends Object implements Serializable
This is an SPI class, typically not used directly by applications. Can be subclassed for additional invocation parameters.
Both RemoteInvocation
and RemoteInvocationResult
are designed
for use with standard Java serialization as well as JavaBean-style serialization.
RemoteInvocationResult
,
RemoteInvocationFactory
,
RemoteInvocationExecutor
,
RmiProxyFactoryBean
,
RmiServiceExporter
,
HttpInvokerProxyFactoryBean
,
HttpInvokerServiceExporter
,
Serialized FormConstructor and Description |
---|
RemoteInvocation()
Create a new RemoteInvocation for JavaBean-style deserialization
(e.g.
|
RemoteInvocation(MethodInvocation methodInvocation)
Create a new RemoteInvocation for the given AOP method invocation.
|
RemoteInvocation(String methodName,
Class<?>[] parameterTypes,
Object[] arguments)
Create a new RemoteInvocation for the given parameters.
|
Modifier and Type | Method and Description |
---|---|
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<String,Serializable> |
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<String,Serializable> 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() |
public RemoteInvocation(MethodInvocation methodInvocation)
methodInvocation
- the AOP invocation to convertpublic RemoteInvocation(String methodName, Class<?>[] parameterTypes, Object[] arguments)
methodName
- the name of the method to invokeparameterTypes
- the parameter types of the methodarguments
- the arguments for the invocationpublic RemoteInvocation()
public void setMethodName(String methodName)
This setter is intended for JavaBean-style deserialization.
public String getMethodName()
public void setParameterTypes(Class<?>[] parameterTypes)
This setter is intended for JavaBean-style deserialization.
public Class<?>[] getParameterTypes()
public void setArguments(Object[] arguments)
This setter is intended for JavaBean-style deserialization.
public Object[] getArguments()
public void addAttribute(String key, Serializable value) throws IllegalStateException
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.
key
- the attribute keyvalue
- the attribute valueIllegalStateException
- if the key is already boundpublic Serializable getAttribute(String key)
The implementation avoids to unnecessarily create the attributes Map, to minimize serialization size.
key
- the attribute keynull
if not definedpublic void setAttributes(Map<String,Serializable> attributes)
addAttribute(java.lang.String, java.io.Serializable)
and getAttribute(java.lang.String)
.attributes
- the attributes MapaddAttribute(java.lang.String, java.io.Serializable)
,
getAttribute(java.lang.String)
public Map<String,Serializable> getAttributes()
addAttribute(java.lang.String, java.io.Serializable)
and getAttribute(java.lang.String)
.null
if none createdaddAttribute(java.lang.String, java.io.Serializable)
,
getAttribute(java.lang.String)
public Object invoke(Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
targetObject
- the target object to apply the invocation toNoSuchMethodException
- if the method name could not be resolvedIllegalAccessException
- if the method could not be accessedInvocationTargetException
- if the method invocation resulted in an exceptionMethod.invoke(java.lang.Object, java.lang.Object...)