Interface MethodInvocationResult

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object getReturnValue()
      The return value from the method invocation.
      <T extends Throwable>
      T
      getThrown(Class<T> throwableClass)
      If isFail() is true, this method provides access to the actual checked exception that was thrown.
      boolean isFail()
      If true, then the method invocation ended with a checked exception being thrown.
      void rethrow()
      If the invocation threw a checked exception, this method will wrap that exception in a RuntimeException and throw that.
    • Method Detail

      • getReturnValue

        Object getReturnValue()
        The return value from the method invocation. This will be null if the method returns null, is a void method, or if a checked exception was thrown by the method.
      • isFail

        boolean isFail()
        If true, then the method invocation ended with a checked exception being thrown.
      • rethrow

        void rethrow()
        If the invocation threw a checked exception, this method will wrap that exception in a RuntimeException and throw that. For most code that doesn't specifically care about the thrown exception, this method should be invoked before continuing on to examine getReturnValue().
      • getThrown

        <T extends Throwable> T getThrown(Class<T> throwableClass)
        If isFail() is true, this method provides access to the actual checked exception that was thrown.
        Parameters:
        throwableClass - the type of exception to match
        Returns:
        the exception, if the method invocation threw a checked exception, and the exception is assignable to the provided type. In other cases, null is returned.