Class RemoteInvocationResult
java.lang.Object
org.springframework.amqp.support.converter.RemoteInvocationResult
- All Implemented Interfaces:
Serializable
Encapsulates a remote invocation result, holding a result value or an exception.
- Since:
- 3.0
- Author:
- Juergen Hoeller, Gary Russell, Ngoc Nhan
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionReturn the exception thrown by an unsuccessful invocation of the target method, if any.getValue()
Return the result value returned by a successful invocation of the target method, if any.boolean
Return whether this invocation result holds an exception.boolean
Return whether this invocation result holds an InvocationTargetException, thrown by an invocation of the target method itself.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
Set the result value returned by a successful invocation of the target method, if any.
-
Constructor Details
-
RemoteInvocationResult
Create a new RemoteInvocationResult for the given result value.- Parameters:
value
- the result value returned by a successful invocation of the target method
-
RemoteInvocationResult
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 Details
-
setValue
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:
-
getValue
Return the result value returned by a successful invocation of the target method, if any.- See Also:
-
setException
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:
-
getException
Return the exception thrown by an unsuccessful invocation of the target method, if any.- See Also:
-
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:
-
hasInvocationTargetException
public boolean hasInvocationTargetException()Return whether this invocation result holds an InvocationTargetException, thrown by an invocation of the target method itself.- See Also:
-
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.- Returns:
- the result value, if any
- Throws:
Throwable
- the exception, if any
-