public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements Serializable
isMatch(java.lang.String, java.lang.String)
,
Serialized FormTRUE
Constructor and Description |
---|
NameMatchMethodPointcut() |
Modifier and Type | Method and Description |
---|---|
NameMatchMethodPointcut |
addMethodName(String name)
Add another eligible method name, in addition to those already named.
|
boolean |
equals(Object other) |
int |
hashCode() |
protected boolean |
isMatch(String methodName,
String mappedName)
Return if the given method name matches the mapped name.
|
boolean |
matches(Method method,
Class<?> targetClass)
Perform static checking whether the given method matches.
|
void |
setMappedName(String mappedName)
Convenience method when we have only a single method name to match.
|
void |
setMappedNames(String... mappedNames)
Set the method names defining methods to match.
|
getClassFilter, getMethodMatcher, setClassFilter
isRuntime, matches
public void setMappedName(String mappedName)
setMappedNames
, not both.setMappedNames(java.lang.String...)
public void setMappedNames(String... mappedNames)
public NameMatchMethodPointcut addMethodName(String name)
NB: This method does not work after the proxy is in use, as advice chains will be cached.
name
- name of the additional method that will matchpublic boolean matches(Method method, Class<?> targetClass)
MethodMatcher
If this returns false
or if the MethodMatcher.isRuntime()
method returns false
, no runtime check (i.e. no
MethodMatcher.matches(java.lang.reflect.Method, Class, Object[])
call)
will be made.
matches
in interface MethodMatcher
method
- the candidate methodtargetClass
- the target classprotected boolean isMatch(String methodName, String mappedName)
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
methodName
- the method name of the classmappedName
- the name in the descriptorPatternMatchUtils.simpleMatch(String, String)