org.springframework.aop.support
Class NameMatchMethodPointcut

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

public class NameMatchMethodPointcut
extends StaticMethodMatcherPointcut

Pointcut bean for simple method name matches, as alternative to regexp patterns.

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

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
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 m, java.lang.Class targetClass)
          Perform static checking.
 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.
 
Methods inherited from class org.springframework.aop.support.StaticMethodMatcherPointcut
getClassFilter, getMethodMatcher
 
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(java.lang.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(java.lang.String[] mappedNames)
Set the method names defining methods to match. Matching will be the union of all these; if any match, the pointcut matches.


matches

public boolean matches(java.lang.reflect.Method m,
                       java.lang.Class targetClass)
Description copied from interface: MethodMatcher
Perform static checking. If this returns false, or if the isRuntime() method returns false, no runtime check will be made.

Parameters:
m - candidate method
targetClass - 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(java.lang.String methodName,
                          java.lang.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) 2003-2004 The Spring Framework Project.