Class AbstractMethodInvocation
- java.lang.Object
-
- org.apache.tapestry5.internal.plastic.AbstractMethodInvocation
-
- All Implemented Interfaces:
AnnotationAccess,MethodInvocation,MethodInvocationResult
public abstract class AbstractMethodInvocation extends java.lang.Object implements MethodInvocation
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMethodInvocation(java.lang.Object instance, InstanceContext instanceContext, MethodInvocationBundle bundle)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidclearCheckedException()Invoked from the implementation ofMethodInvocation.setReturnValue(Object).booleandidThrowCheckedException()Returns true if the method invocation threw a checked exception.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationType)Returns an instantiated annotation, or null if the target does not have the indicated annotation.<T extends java.lang.Throwable>
TgetCheckedException(java.lang.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.java.lang.ObjectgetInstance()The instance on which the method was originally invoked.InstanceContextgetInstanceContext()java.lang.reflect.MethodgetMethod()Returns the method being invoked.<T extends java.lang.annotation.Annotation>
booleanhasAnnotation(java.lang.Class<T> annotationType)Checks to see if the target has an annotation of the given type.MethodInvocationproceed()Proceed with the method invocation, either chaining into the nextMethodAdviceadded to the method, or ultimately into the actual method implementation.protected abstract voidproceedToAdvisedMethod()This is implemented in a runtime-generated subclass.voidrethrow()If the invocation threw a checked exception, then this method throws that exception wrapped as the cause of a new RuntimeException.MethodInvocationsetCheckedException(java.lang.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 Detail
-
AbstractMethodInvocation
protected AbstractMethodInvocation(java.lang.Object instance, InstanceContext instanceContext, MethodInvocationBundle bundle)
-
-
Method Detail
-
clearCheckedException
protected void clearCheckedException()
Invoked from the implementation ofMethodInvocation.setReturnValue(Object).
-
rethrow
public void rethrow()
Description copied from interface:MethodInvocationResultIf 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:
rethrowin interfaceMethodInvocationResult
-
didThrowCheckedException
public boolean didThrowCheckedException()
Description copied from interface:MethodInvocationResultReturns true if the method invocation threw a checked exception.- Specified by:
didThrowCheckedExceptionin interfaceMethodInvocationResult
-
getCheckedException
public <T extends java.lang.Throwable> T getCheckedException(java.lang.Class<T> exceptionType)
Description copied from interface:MethodInvocationResultRetrieves 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:
getCheckedExceptionin interfaceMethodInvocationResult
-
getInstance
public java.lang.Object getInstance()
Description copied from interface:MethodInvocationThe instance on which the method was originally invoked.- Specified by:
getInstancein interfaceMethodInvocation
-
getInstanceContext
public InstanceContext getInstanceContext()
- Specified by:
getInstanceContextin interfaceMethodInvocation
-
proceed
public MethodInvocation proceed()
Description copied from interface:MethodInvocationProceed with the method invocation, either chaining into the nextMethodAdviceadded to the method, or ultimately into the actual method implementation. The method may throw a checked exception, which will be caught and be reported asMethodInvocationResult.didThrowCheckedException().- Specified by:
proceedin interfaceMethodInvocation- Returns:
- this method invocation, for a fluent API
-
setCheckedException
public MethodInvocation setCheckedException(java.lang.Exception exception)
Description copied from interface:MethodInvocationSets 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:
setCheckedExceptionin interfaceMethodInvocation- Parameters:
exception- new checked exception, or null- Returns:
- this method invocation, for a fluent API
-
hasAnnotation
public <T extends java.lang.annotation.Annotation> boolean hasAnnotation(java.lang.Class<T> annotationType)
Description copied from interface:AnnotationAccessChecks to see if the target has an annotation of the given type.- Specified by:
hasAnnotationin interfaceAnnotationAccess
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
Description copied from interface:AnnotationAccessReturns an instantiated annotation, or null if the target does not have the indicated annotation.- Specified by:
getAnnotationin interfaceAnnotationAccess
-
getMethod
public java.lang.reflect.Method getMethod()
Description copied from interface:MethodInvocationReturns the method being invoked.- Specified by:
getMethodin interfaceMethodInvocation
-
proceedToAdvisedMethod
protected abstract void proceedToAdvisedMethod()
This is implemented in a runtime-generated subclass.
-
-