类 RemoteInvocation
- java.lang.Object
- org.springframework.remoting.support.RemoteInvocation
- 所有已实现的接口:
Serializable
public class RemoteInvocation extends Object implements Serializable
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.
Both
RemoteInvocation
andRemoteInvocationResult
are designed for use with standard Java serialization as well as JavaBean-style serialization.- 从以下版本开始:
- 25.02.2004
- 作者:
- Juergen Hoeller
- 另请参阅:
RemoteInvocationResult
,RemoteInvocationFactory
,RemoteInvocationExecutor
,RmiProxyFactoryBean
,RmiServiceExporter
,HttpInvokerProxyFactoryBean
,HttpInvokerServiceExporter
, 序列化表格
构造器概要
构造器 构造器 说明 RemoteInvocation()
Create a new RemoteInvocation for JavaBean-style deserialization (e.g. with Jackson).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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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()
构造器详细资料
RemoteInvocation
public RemoteInvocation(MethodInvocation methodInvocation)
Create a new RemoteInvocation for the given AOP method invocation.- 参数:
methodInvocation
- the AOP invocation to convert
RemoteInvocation
public RemoteInvocation(String methodName, Class<?>[] parameterTypes, Object[] arguments)
Create a new RemoteInvocation for the given parameters.- 参数:
methodName
- the name of the method to invokeparameterTypes
- the parameter types of the methodarguments
- the arguments for the invocation
RemoteInvocation
public RemoteInvocation()
Create a new RemoteInvocation for JavaBean-style deserialization (e.g. with Jackson).
方法详细资料
setMethodName
public void setMethodName(String methodName)
Set the name of the target method.This setter is intended for JavaBean-style deserialization.
getMethodName
public String getMethodName()
Return the name of the target method.
setParameterTypes
public void setParameterTypes(Class<?>[] parameterTypes)
Set the parameter types of the target method.This setter is intended for JavaBean-style deserialization.
getParameterTypes
public Class<?>[] getParameterTypes()
Return the parameter types of the target method.
setArguments
public void setArguments(Object[] arguments)
Set the arguments for the target method call.This setter is intended for JavaBean-style deserialization.
getArguments
public Object[] getArguments()
Return the arguments for the target method call.
addAttribute
public void addAttribute(String key, Serializable value) throws IllegalStateException
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.
- 参数:
key
- the attribute keyvalue
- the attribute value- 抛出:
IllegalStateException
- if the key is already bound
getAttribute
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.
- 参数:
key
- the attribute key- 返回:
- the attribute value, or
null
if not defined
setAttributes
public void setAttributes(Map<String,Serializable> attributes)
Set the attributes Map. Only here for special purposes: Preferably, useaddAttribute(java.lang.String, java.io.Serializable)
andgetAttribute(java.lang.String)
.- 参数:
attributes
- the attributes Map- 另请参阅:
addAttribute(java.lang.String, java.io.Serializable)
,getAttribute(java.lang.String)
getAttributes
public Map<String,Serializable> getAttributes()
Return the attributes Map. Mainly here for debugging purposes: Preferably, useaddAttribute(java.lang.String, java.io.Serializable)
andgetAttribute(java.lang.String)
.- 返回:
- the attributes Map, or
null
if none created - 另请参阅:
addAttribute(java.lang.String, java.io.Serializable)
,getAttribute(java.lang.String)
invoke
public Object invoke(Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
Perform this invocation on the given target object. Typically called when a RemoteInvocation is received on the server.- 参数:
targetObject
- the target object to apply the invocation to- 返回:
- the invocation result
- 抛出:
NoSuchMethodException
- if the method name could not be resolvedIllegalAccessException
- if the method could not be accessedInvocationTargetException
- if the method invocation resulted in an exception- 另请参阅:
Method.invoke(java.lang.Object, java.lang.Object...)