站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

NameMatchMethodPointcut (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.aop.support
Class NameMatchMethodPointcut

java.lang.Object
  extended by org.springframework.aop.support.StaticMethodMatcher
      extended by org.springframework.aop.support.StaticMethodMatcherPointcut
          extended by org.springframework.aop.support.NameMatchMethodPointcut
All Implemented Interfaces:
Serializable, MethodMatcher, Pointcut
Direct Known Subclasses:
NameMatchMethodPointcutAdvisor

public class NameMatchMethodPointcut
extends StaticMethodMatcherPointcut
implements Serializable

Pointcut bean for simple method name matches, as alternative to regexp patterns. Does not handle overloaded methods: all methods *with a given name will be eligible.

Since:
11.02.2004
Author:
Juergen Hoeller, Rod Johnson
See Also:
isMatch(java.lang.String, java.lang.String), Serialized Form

Field Summary
 
Fields inherited from interface org.springframework.aop.Pointcut
TRUE
 
Fields inherited from interface org.springframework.aop.MethodMatcher
TRUE
 
Constructor Summary
NameMatchMethodPointcut()
           
 
Method Summary
 NameMatchMethodPointcut addMethodName(String name)
          Add another eligible method name, in addition to those already named.
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.
 
Methods inherited from class org.springframework.aop.support.StaticMethodMatcherPointcut
getClassFilter, getMethodMatcher, setClassFilter
 
Methods inherited from class org.springframework.aop.support.StaticMethodMatcher
isRuntime, matches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameMatchMethodPointcut

public NameMatchMethodPointcut()
Method Detail

setMappedName

public void setMappedName(String mappedName)
Convenience method when we have only a single method name to match. Use either this method or setMappedNames(), not both.

See Also:
setMappedNames(java.lang.String[])

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.

Parameters:
name - name of the additional method that will match
Returns:
this pointcut to allow for multiple additions in one line

matches

public boolean matches(Method method,
                       Class targetClass)
Description copied from interface: MethodMatcher
Perform static checking whether the given method matches. 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.

Specified by:
matches in interface MethodMatcher
Parameters:
method - the candidate method
targetClass - the target class (may be null, in which case the candidate class must be taken to be the method's declaring class)
Returns:
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*" and "*xxx" matches. Can be overridden in subclasses.

Parameters:
methodName - the method name of the class
mappedName - the name in the descriptor
Returns:
if the names match


Copyright (c) 2002-2007 The Spring Framework Project.