Package org.apache.tapestry5.plastic
Interface MethodInvocation
- All Superinterfaces:
AnnotationAccess
,MethodInvocationResult
- All Known Implementing Classes:
AbstractMethodInvocation
A representation of the invocation of a method that allows the behavior of the method to be advised: either by
changing parameter values, or by changing the return value, or by catch or throwing different exceptions. Provides
access to annotations on the advised method.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThe instance on which the method was originally invoked.Returns the method being invoked.getParameter
(int index) Returns the parameter at the given index.proceed()
Proceed with the method invocation, either chaining into the nextMethodAdvice
added to the method, or ultimately into the actual method implementation.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).setParameter
(int index, Object newValue) Changes a parameter value.setReturnValue
(Object returnValue) Overrides the return value of the method.Methods inherited from interface org.apache.tapestry5.plastic.AnnotationAccess
getAnnotation, hasAnnotation
Methods inherited from interface org.apache.tapestry5.plastic.MethodInvocationResult
didThrowCheckedException, getCheckedException, getReturnValue, rethrow
-
Method Details
-
getInstance
The instance on which the method was originally invoked. -
getInstanceContext
-
proceed
Proceed with the method invocation, either chaining into the nextMethodAdvice
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 asMethodInvocationResult.didThrowCheckedException()
.- Returns:
- this method invocation, for a fluent API
-
setReturnValue
Overrides the return value of the method. The value provided will be cast to the actual return type (or, if the return type is a primitive value, the value will be cast to the corresponding wrapper type and then converted to a primitive). Overriding the return value clears any checked exception.- Parameters:
returnValue
-- Returns:
- this method invocation, for a fluent API
- Throws:
NullPointerException
- if the method's return type is a primitive and null is provided
-
getParameter
Returns the parameter at the given index. Primitive types will be wrapped as they are returned.- Parameters:
index
- of parameter to access- Returns:
- parameter value
-
setParameter
Changes a parameter value. The value will be cast to the parameter's type. For primitive types, the value will be cast to the corresponding wrapper type.- Parameters:
index
- index of parameter to modifynewValue
- new value for parameter- Returns:
- this method invocation, for a fluent API
-
setCheckedException
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).- Parameters:
exception
- new checked exception, or null- Returns:
- this method invocation, for a fluent API
-
getMethod
Returns the method being invoked.
-