Class RemoteInvocationResult
- java.lang.Object
- org.springframework.remoting.support.RemoteInvocationResult
- All Implemented Interfaces:
Serializable
public class RemoteInvocationResult extends Object implements Serializable
Encapsulates a remote invocation result, holding a result value or an exception. Used for 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.- Since:
- 1.1
- Author:
- Juergen Hoeller
- See Also:
RemoteInvocation
, Serialized Form
Constructor Summary
Constructors Constructor Description RemoteInvocationResult()
Create a new RemoteInvocationResult for JavaBean-style deserialization (e.g.RemoteInvocationResult(Object value)
Create a new RemoteInvocationResult for the given result value.RemoteInvocationResult(Throwable exception)
Create a new RemoteInvocationResult for the given exception.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwable
getException()
Return the exception thrown by an unsuccessful invocation of the target method, if any.Object
getValue()
Return the result value returned by a successful invocation of the target method, if any.boolean
hasException()
Return whether this invocation result holds an exception.boolean
hasInvocationTargetException()
Return whether this invocation result holds an InvocationTargetException, thrown by an invocation of the target method itself.Object
recreate()
Recreate the invocation result, either returning the result value in case of a successful invocation of the target method, or rethrowing the exception thrown by the target method.void
setException(Throwable exception)
Set the exception thrown by an unsuccessful invocation of the target method, if any.void
setValue(Object value)
Set the result value returned by a successful invocation of the target method, if any.
Constructor Detail
RemoteInvocationResult
public RemoteInvocationResult(Object value)
Create a new RemoteInvocationResult for the given result value.- Parameters:
value
- the result value returned by a successful invocation of the target method
RemoteInvocationResult
public RemoteInvocationResult(Throwable exception)
Create a new RemoteInvocationResult for the given exception.- Parameters:
exception
- the exception thrown by an unsuccessful invocation of the target method
RemoteInvocationResult
public RemoteInvocationResult()
Create a new RemoteInvocationResult for JavaBean-style deserialization (e.g. with Jackson).
Method Detail
setValue
public void setValue(Object value)
Set the result value returned by a successful invocation of the target method, if any.This setter is intended for JavaBean-style deserialization. Use
RemoteInvocationResult(Object)
otherwise.- See Also:
RemoteInvocationResult()
getValue
public Object getValue()
Return the result value returned by a successful invocation of the target method, if any.- See Also:
hasException()
setException
public void setException(Throwable exception)
Set the exception thrown by an unsuccessful invocation of the target method, if any.This setter is intended for JavaBean-style deserialization. Use
RemoteInvocationResult(Throwable)
otherwise.- See Also:
RemoteInvocationResult()
getException
public Throwable getException()
Return the exception thrown by an unsuccessful invocation of the target method, if any.- See Also:
hasException()
hasException
public boolean hasException()
Return whether this invocation result holds an exception. If this returnsfalse
, the result value applies (even if it isnull
).- See Also:
getValue()
,getException()
hasInvocationTargetException
public boolean hasInvocationTargetException()
Return whether this invocation result holds an InvocationTargetException, thrown by an invocation of the target method itself.- See Also:
hasException()
recreate
public Object recreate() throws Throwable
Recreate the invocation result, either returning the result value in case of a successful invocation of the target method, or rethrowing the exception thrown by the target method.- Returns:
- the result value, if any
- Throws:
Throwable
- the exception, if any