public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements java.io.Serializable
Does not handle overloaded methods: all methods with a given name will be eligible.
isMatch(java.lang.String, java.lang.String)
,
Serialized FormModifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
mappedNames |
TRUE
Constructor and Description |
---|
NameMatchMethodPointcut() |
Modifier and Type | Method and Description |
---|---|
NameMatchMethodPointcut |
addMethodName(java.lang.String name)
Add another eligible method name, in addition to those already named.
|
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
protected boolean |
isMatch(java.lang.String methodName,
java.lang.String mappedName)
Return if the given method name matches the mapped name.
|
boolean |
matches(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Perform static checking whether the given method matches.
|
void |
setMappedName(java.lang.String mappedName)
Convenience method when we have only a single method name to match.
|
void |
setMappedNames(java.lang.String... mappedNames)
Set the method names defining methods to match.
|
java.lang.String |
toString() |
getClassFilter, getMethodMatcher, setClassFilter
isRuntime, matches
public void setMappedName(java.lang.String mappedName)
setMappedNames
, not both.setMappedNames(java.lang.String...)
public void setMappedNames(java.lang.String... mappedNames)
public NameMatchMethodPointcut addMethodName(java.lang.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(java.lang.reflect.Method method, java.lang.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(java.lang.String methodName, java.lang.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)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object