Class InvocationResult<R>

java.lang.Object
org.jppf.utils.InvocationResult<R>
Type Parameters:
R - the non-exception type of the referenced object.
All Implemented Interfaces:
Serializable

public class InvocationResult<R> extends Object implements Serializable
Instances of this class hold a reference to an object than can be either of the specified parametrized type or an exception. They can be seen as a way to carry the result of a method invocation, even if this invocation raises an exception.
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • InvocationResult

      public InvocationResult(R ref)
      Initialize with the specified reference object.
      Parameters:
      ref - the referenced object with the expected type.
    • InvocationResult

      public InvocationResult(Exception ref)
      Initialize with the specified reference object.
      Parameters:
      ref - the referenced object as an exception type.
  • Method Details

    • isException

      public boolean isException()
      Determine whether the referenced object is an exception.
      Returns:
      true if the referenced object is an exception, false otherwise.
    • exception

      public Exception exception()
      Get the referenced object as an exception.
      Returns:
      the referenced object as an Exception, or null if it is not an exception.
    • result

      public R result()
      Get the invocation result.
      Returns:
      the result with the desired parametrized type, or null if the result is an exception.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object