org.apache.tapestry5.internal.services

## Class MethodInvocationFailResult

- java.lang.Object
- - org.apache.tapestry5.internal.services.MethodInvocationFailResult

- All Implemented Interfaces:
    MethodInvocationResult

      public class MethodInvocationFailResult
      extends Object
      implements MethodInvocationResult

  Implementation of `MethodInvocationResult` for failed invocations (where a checked exception was thrown).
  Since:
    5.2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodInvocationFailResult(Throwable thrown)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getReturnValue()` The return value from the method invocation.
    `<T extends Throwable> T` | `getThrown(Class<T> throwableClass)` If `MethodInvocationResult.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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MethodInvocationFailResult

          public MethodInvocationFailResult(Throwable thrown)

  - ### Method Detail

    - #### getReturnValue

          public Object getReturnValue()

      Description copied from interface: `MethodInvocationResult`
      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.
      Specified by:
        `getReturnValue` in interface `MethodInvocationResult`

    - #### getThrown

          public <T extends Throwable> T getThrown(Class<T> throwableClass)

      Description copied from interface: `MethodInvocationResult`
      If `MethodInvocationResult.isFail()` is true, this method provides access to the actual checked exception that was thrown.
      Specified by:
        `getThrown` in interface `MethodInvocationResult`
      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.

    - #### isFail

          public boolean isFail()

      Description copied from interface: `MethodInvocationResult`
      If true, then the method invocation ended with a checked exception being thrown.
      Specified by:
        `isFail` in interface `MethodInvocationResult`

    - #### rethrow

          public void rethrow()

      Description copied from interface: `MethodInvocationResult`
      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 `MethodInvocationResult.getReturnValue()`.
      Specified by:
        `rethrow` in interface `MethodInvocationResult`

${project.version} - Copyright © 2003-2015 The Apache Software Foundation.