Package org.apache.tapestry5.internal.plastic

# Class AbstractMethodInvocation

java.lang.Object
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation

All Implemented Interfaces:
  `AnnotationAccess`, `MethodInvocation`, `MethodInvocationResult`

public abstract class AbstractMethodInvocation extends Object implements MethodInvocation

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractMethodInvocation(Object instance, InstanceContext instanceContext, MethodInvocationBundle bundle)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `clearCheckedException()`
  Invoked from the implementation of `MethodInvocation.setReturnValue(Object)`.
  `boolean`
  `didThrowCheckedException()`
  Returns true if the method invocation threw a checked exception.
  `<T extends Annotation>
  T`
  `getAnnotation(Class<T> annotationType)`
  Returns an instantiated annotation, or null if the target does not have the indicated annotation.
  `<T extends Throwable>
  T`
  `getCheckedException(Class<T> exceptionType)`
  Retrieves the checked exception assignable to the indicated type, or null if the invocation did not throw a checked exception or the thrown exception is not assignable.
  `Object`
  `getInstance()`
  The instance on which the method was originally invoked.
  `InstanceContext`
  `getInstanceContext()`
  `Method`
  `getMethod()`
  Returns the method being invoked.
  `<T extends Annotation>
  boolean`
  `hasAnnotation(Class<T> annotationType)`
  Checks to see if the target has an annotation of the given type.
  `MethodInvocation`
  `proceed()`
  Proceed with the method invocation, either chaining into the next `MethodAdvice` added to the method, or ultimately into the actual method implementation.
  `protected abstract void`
  `proceedToAdvisedMethod()`
  This is implemented in a runtime-generated subclass.
  `void`
  `rethrow()`
  If the invocation threw a checked exception, then this method throws that exception wrapped as the cause of a new RuntimeException.
  `MethodInvocation`
  `setCheckedException(Exception exception)`
  Sets the checked exception; this can be used to indicate failure for the method, or to cancel the thrown exception (by setting the exception to null).

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

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

  ### Methods inherited from interface org.apache.tapestry5.plastic.MethodInvocation

  `getParameter, setParameter, setReturnValue`

  ### Methods inherited from interface org.apache.tapestry5.plastic.MethodInvocationResult

  `getReturnValue`

- ## Constructor Details

  - ### AbstractMethodInvocation

    protected AbstractMethodInvocation(Object instance, InstanceContext instanceContext, MethodInvocationBundle bundle)

- ## Method Details

  - ### clearCheckedException

    protected void clearCheckedException()
    Invoked from the implementation of `MethodInvocation.setReturnValue(Object)`.

  - ### rethrow

    public void rethrow()
    Description copied from interface: `MethodInvocationResult`
    If the invocation threw a checked exception, then this method throws that exception wrapped as the cause of a new RuntimeException. Otherwise, this method does nothing.
    Specified by:
      `rethrow` in interface `MethodInvocationResult`

  - ### didThrowCheckedException

    public boolean didThrowCheckedException()
    Description copied from interface: `MethodInvocationResult`
    Returns true if the method invocation threw a checked exception.
    Specified by:
      `didThrowCheckedException` in interface `MethodInvocationResult`

  - ### getCheckedException

    public <T extends Throwable> T getCheckedException(Class<T> exceptionType)
    Description copied from interface: `MethodInvocationResult`
    Retrieves the checked exception assignable to the indicated type, or null if the invocation did not throw a checked exception or the thrown exception is not assignable.
    Specified by:
      `getCheckedException` in interface `MethodInvocationResult`

  - ### getInstance

    public Object getInstance()
    Description copied from interface: `MethodInvocation`
    The instance on which the method was originally invoked.
    Specified by:
      `getInstance` in interface `MethodInvocation`

  - ### getInstanceContext

    public InstanceContext getInstanceContext()
    Specified by:
      `getInstanceContext` in interface `MethodInvocation`

  - ### proceed

    public MethodInvocation proceed()
    Description copied from interface: `MethodInvocation`
    Proceed with the method invocation, either chaining into the next `MethodAdvice` added to the method, or ultimately into the actual method implementation. The method may throw a checked exception, which will be caught and be reported as `MethodInvocationResult.didThrowCheckedException()`.
    Specified by:
      `proceed` in interface `MethodInvocation`
    Returns:
      this method invocation, for a fluent API

  - ### setCheckedException

    public MethodInvocation setCheckedException(Exception exception)
    Description copied from interface: `MethodInvocation`
    Sets the checked exception; this can be used to indicate failure for the method, or to cancel the thrown exception (by setting the exception to null).
    Specified by:
      `setCheckedException` in interface `MethodInvocation`
    Parameters:
      `exception` - new checked exception, or null
    Returns:
      this method invocation, for a fluent API

  - ### hasAnnotation

    public <T extends Annotation> boolean hasAnnotation(Class<T> annotationType)
    Description copied from interface: `AnnotationAccess`
    Checks to see if the target has an annotation of the given type.
    Specified by:
      `hasAnnotation` in interface `AnnotationAccess`

  - ### getAnnotation

    public <T extends Annotation> T getAnnotation(Class<T> annotationType)
    Description copied from interface: `AnnotationAccess`
    Returns an instantiated annotation, or null if the target does not have the indicated annotation.
    Specified by:
      `getAnnotation` in interface `AnnotationAccess`

  - ### getMethod

    public Method getMethod()
    Description copied from interface: `MethodInvocation`
    Returns the method being invoked.
    Specified by:
      `getMethod` in interface `MethodInvocation`

  - ### proceedToAdvisedMethod

    protected abstract void proceedToAdvisedMethod()
    This is implemented in a runtime-generated subclass.