Class RemoteInvocationResult

java.lang.Object
org.springframework.amqp.support.converter.RemoteInvocationResult
All Implemented Interfaces:
Serializable

public class RemoteInvocationResult extends Object implements Serializable
Encapsulates a remote invocation result, holding a result value or an exception.
Since:
3.0
Author:
Juergen Hoeller, Gary Russell
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new RemoteInvocationResult for JavaBean-style deserialization (e.g.
    Create a new RemoteInvocationResult for the given result value.
    Create a new RemoteInvocationResult for the given exception.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the exception thrown by an unsuccessful invocation of the target method, if any.
    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 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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RemoteInvocationResult

      public RemoteInvocationResult(@Nullable 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(@Nullable 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).
      See Also:
  • Method Details

    • setValue

      public void setValue(@Nullable 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:
    • getValue

      @Nullable public Object getValue()
      Return the result value returned by a successful invocation of the target method, if any.
      See Also:
    • setException

      public void setException(@Nullable 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:
    • getException

      @Nullable public Throwable 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 returns false, the result value applies (even if it is null).
      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

      @Nullable 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