The name pattern matches against the method name, and can be one of the following:
perform
*form
per*
*erfo*
. *
The parameters pattern follows the name pattern and is optional. It is used to check the number of parameters, or their types. When the parameters pattern is omitted, then the number and types of parameters are not considred when matching methods.
The parameters pattern, when present, is contained within open and closed parenthis after the method pattern. Inside the parenthesis may be a number, indicating the exact number of method parameters to match against. Alternately, a comma-seperated list of Java types is used, which matches against a method that takes the exact set of parameters. Examples:
perform()
-- method with no parameters perform(2)
-- method with two parameters perform(java.util.List, int)
- method taking a List and an int parameter A MethodMatcher may be evaluated statically or at runtime (dynamically). Static matching involves method and (possibly) method attributes. Dynamic matching also makes arguments for a particular call available, and any effects of running previous advice applying to the joinpoint.
If an implementation returns false
from its {@link #isRuntime()}method, evaluation can be performed statically, and the result will be the same for all invocations of this method, whatever their arguments. This means that if the {@link #isRuntime()} method returns false
, the 3-arg{@link #matches(java.lang.reflect.Method,Class,Object[])} method will never be invoked.
If an implementation returns true
from its 2-arg {@link #matches(java.lang.reflect.Method,Class)} method and its {@link #isRuntime()} methodreturns true
, the 3-arg {@link #matches(java.lang.reflect.Method,Class,Object[])}method will be invoked immediately before each potential execution of the related advice, to decide whether the advice should run. All previous advice, such as earlier interceptors in an interceptor chain, will have run, so any state changes they have produced in parameters or ThreadLocal state will be available at the time of evaluation.
@author Rod Johnson
@since 11.11.2003
@see Pointcut
@see ClassFilter
|
|
|
|
|
|
|
|