类 NameMatchMethodPointcut
- java.lang.Object
- org.springframework.aop.support.StaticMethodMatcher
- org.springframework.aop.support.StaticMethodMatcherPointcut
- org.springframework.aop.support.NameMatchMethodPointcut
- 所有已实现的接口:
Serializable
,MethodMatcher
,Pointcut
public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements Serializable
Pointcut bean for simple method name matches, as an alternative to regexp patterns.Does not handle overloaded methods: all methods with a given name will be eligible.
- 从以下版本开始:
- 11.02.2004
- 作者:
- Juergen Hoeller, Rod Johnson, Rob Harrop
- 另请参阅:
isMatch(java.lang.String, java.lang.String)
, 序列化表格
字段概要
从接口继承的字段 org.springframework.aop.MethodMatcher
TRUE
构造器概要
构造器 构造器 说明 NameMatchMethodPointcut()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.aop.support.StaticMethodMatcherPointcut
getClassFilter, getMethodMatcher, setClassFilter
从类继承的方法 org.springframework.aop.support.StaticMethodMatcher
isRuntime, matches
构造器详细资料
NameMatchMethodPointcut
public NameMatchMethodPointcut()
方法详细资料
setMappedName
public void setMappedName(String mappedName)
Convenience method when we have only a single method name to match. Use either this method orsetMappedNames
, not both.
setMappedNames
public void setMappedNames(String... mappedNames)
Set the method names defining methods to match. Matching will be the union of all these; if any match, the pointcut matches.
addMethodName
public NameMatchMethodPointcut addMethodName(String name)
Add another eligible method name, in addition to those already named. Like the set methods, this method is for use when configuring proxies, before a proxy is used.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 match- 返回:
- this pointcut to allow for multiple additions in one line
matches
public boolean matches(Method method, Class<?> targetClass)
从接口复制的说明:MethodMatcher
Perform static checking whether the given method matches.If this returns
false
or if theMethodMatcher.isRuntime()
method returnsfalse
, no runtime check (i.e. noMethodMatcher.matches(java.lang.reflect.Method, Class, Object[])
call) will be made.- 指定者:
matches
在接口中MethodMatcher
- 参数:
method
- the candidate methodtargetClass
- the target class (may benull
, in which case the candidate class must be taken to be the method's declaring class)- 返回:
- whether or not this method matches statically
isMatch
protected boolean isMatch(String methodName, String mappedName)
Return if the given method name matches the mapped name.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 descriptor- 返回:
- if the names match
- 另请参阅:
PatternMatchUtils.simpleMatch(String, String)