org.nanocontainer.aop
Interface PointcutsFactory

All Known Implementing Classes:
AbstractPointcutsFactory, DynaopPointcutsFactory

public interface PointcutsFactory

Produces pointcuts.

Version:
$Revision: 3144 $
Author:
Stephen Molitor

Method Summary
 ClassPointcut allClasses()
          Returns a class pointcut that picks all classes.
 MethodPointcut allMethods()
          Returns a pointcut that matches all methods.
 ClassPointcut className(String regex)
          Returns a class pointcut that matches class names with a regular expression.
 ComponentPointcut component(Object componentKey)
          Returns a component pointcut that picks one component key.
 ComponentPointcut componentName(String regex)
          Returns a component pointcut that matches component keys with a regular expression.
 MethodPointcut declaringClass(ClassPointcut classPointcut)
          Returns a method pointcut that picks a method if the given class pointcut picks the method's declaring class.
 MethodPointcut getMethods()
          Returns a pointcut that matches get methods.
 ClassPointcut instancesOf(Class type)
          Returns a class pointcut that picks all instances of a given type.
 ClassPointcut intersection(ClassPointcut a, ClassPointcut b)
          Returns a class pointcut that is the intersection of two class pointcuts.
 MethodPointcut intersection(MethodPointcut a, MethodPointcut b)
          Returns a method pointcut that is the intersection of two other method pointcuts.
 MethodPointcut isMethods()
          Returns a pointcut that matches is methods.
 MethodPointcut membersOf(Class clazz)
          Picks methods that are members of the given class (even if the method was declared in a super class of the given class).
 ClassPointcut not(ClassPointcut classPointcut)
          Returns a class pointcut that inverts the original pointcut.
 MethodPointcut not(MethodPointcut methodPointcut)
          Creates a method pointcut that inverts the original pointcut.
 MethodPointcut objectMethods()
          Returns a method pointcut that picks equals, hashCode, and toString.
 ClassPointcut oneClass(Class clazz)
          Returns a class pointcut that picks one class.
 MethodPointcut oneMethod(Method method)
          Returns a pointcut that matches one method.
 ClassPointcut packageName(String packageName)
          Returns a class pointcut that picks all classes in a package.
 MethodPointcut returnType(ClassPointcut classPointcut)
          Returns a method pointcut that picks a method if the given class pointcut picks the method's return type.
 MethodPointcut setMethods()
          Returns a method pointcut that matches set methods.
 MethodPointcut signature(String regexp)
          Returns a method pointcut that matches the method signatures with a regular expression.
 ClassPointcut union(ClassPointcut a, ClassPointcut b)
          Returns a pointcut that is the union of two class pointcuts.
 MethodPointcut union(MethodPointcut a, MethodPointcut b)
          Returns a method pointcut that is the union of two other method pointcuts.
 

Method Detail

component

ComponentPointcut component(Object componentKey)
Returns a component pointcut that picks one component key.

Parameters:
componentKey - the component key to match against.
Returns:
a ComponentPointcut that matches componentKey.

componentName

ComponentPointcut componentName(String regex)
                                throws MalformedRegularExpressionException
Returns a component pointcut that matches component keys with a regular expression. The regular expression must be an ORO Perl5 compatible regular expression.

Parameters:
regex - the regular expression to match against.
Returns:
a ComponentPointcut that matches the component key against regex.
Throws:
MalformedRegularExpressionException - if the regular expression is invalid.

allClasses

ClassPointcut allClasses()
Returns a class pointcut that picks all classes.

Returns:
a ClassPointcut that matches all classes.

instancesOf

ClassPointcut instancesOf(Class type)
Returns a class pointcut that picks all instances of a given type.

Parameters:
type - the base interface or class.
Returns:
a ClassPointcut that matches instances of type.

className

ClassPointcut className(String regex)
                        throws MalformedRegularExpressionException
Returns a class pointcut that matches class names with a regular expression. The regular expression must be an ORO Perl5 regular expression.

Parameters:
regex - the regular expression to match against.
Returns:
a ClassPointcut that matches the class name against regex.
Throws:
MalformedRegularExpressionException - if the regular expression is invalid.

oneClass

ClassPointcut oneClass(Class clazz)
Returns a class pointcut that picks one class.

Parameters:
clazz - the class to match against.
Returns:
a ClassPointcut that matches clazz.

packageName

ClassPointcut packageName(String packageName)
Returns a class pointcut that picks all classes in a package. Note that the packageName argument is not a regular expression; the returned pointcut expects an exact match against the package name.

Parameters:
packageName - the package name to match against the package of the candidate component's class.
Returns:
a ClassPointcut that matches the class package with packageName.

intersection

ClassPointcut intersection(ClassPointcut a,
                           ClassPointcut b)
Returns a class pointcut that is the intersection of two class pointcuts.

Parameters:
a - the first ClassPointcut.
b - the second ClassPointcut.
Returns:
a ClassPointcut that is the intersection of a and b.

union

ClassPointcut union(ClassPointcut a,
                    ClassPointcut b)
Returns a pointcut that is the union of two class pointcuts.

Parameters:
a - the first ClassPointcut.
b - the second ClassPointcut.
Returns:
a ClassPointcut that is the union of a and b.

not

ClassPointcut not(ClassPointcut classPointcut)
Returns a class pointcut that inverts the original pointcut.

Parameters:
classPointcut - the pointcut to negate.
Returns:
a ClassPointcut that inverts classPointcut.

allMethods

MethodPointcut allMethods()
Returns a pointcut that matches all methods.

Returns:
a MethodPointcut that matches all methods.

getMethods

MethodPointcut getMethods()
Returns a pointcut that matches get methods. Note that this does not include 'is' methods.

Returns:
a MethodPointcut that matches get methods.

isMethods

MethodPointcut isMethods()
Returns a pointcut that matches is methods.

Returns:
a MethodPointcut that matches is methods.

setMethods

MethodPointcut setMethods()
Returns a method pointcut that matches set methods.

Returns:
a MethodPointcut that matches set methods.

objectMethods

MethodPointcut objectMethods()
Returns a method pointcut that picks equals, hashCode, and toString.

Returns:
a MethodPointcut that matches methods declared by java.lang.Object.

signature

MethodPointcut signature(String regexp)
Returns a method pointcut that matches the method signatures with a regular expression. Uses dynaop's signature pointcut. Method signatures follow this pattern:

 

ReturnType methodName(ArgumentType, ArgumentType, ...) throws ExceptionType, ExceptionType

Omits "java.lang." from classes in java.lang package. The regular expression must be an ORO Perl5 regular expression.

Parameters:
regexp - the method signature regular expression.
Returns:
a MethodPointcut that matches the method signature against a regular expression.

oneMethod

MethodPointcut oneMethod(Method method)
Returns a pointcut that matches one method.

Parameters:
method - the method to match against.
Returns:
a MethodPointcut that matches one method.

returnType

MethodPointcut returnType(ClassPointcut classPointcut)
Returns a method pointcut that picks a method if the given class pointcut picks the method's return type.

Parameters:
classPointcut - the class pointcut to match against the method's return type.
Returns:
a MethodPointcut that matches classPointcut against the method's return type

declaringClass

MethodPointcut declaringClass(ClassPointcut classPointcut)
Returns a method pointcut that picks a method if the given class pointcut picks the method's declaring class.

Parameters:
classPointcut - the class pointcut to match against the method's declaring class.
Returns:
a MethodPointcut that matches classPointcut against the method's declaring class.

membersOf

MethodPointcut membersOf(Class clazz)
Picks methods that are members of the given class (even if the method was declared in a super class of the given class).

Parameters:
clazz - the class that we will check to see if the method is a member of.
Returns:
a MethodPointcut that will check to see if the method is a member of clazz.

intersection

MethodPointcut intersection(MethodPointcut a,
                            MethodPointcut b)
Returns a method pointcut that is the intersection of two other method pointcuts.

Parameters:
a - the first method pointcut.
b - the second method pointcut.
Returns:
a MethodPointcut that is the intersection of a and b.

union

MethodPointcut union(MethodPointcut a,
                     MethodPointcut b)
Returns a method pointcut that is the union of two other method pointcuts.

Parameters:
a - the first method pointcut.
b - the second method pointcut.
Returns:
a MethodPointcut that is the union of a and b.

not

MethodPointcut not(MethodPointcut methodPointcut)
Creates a method pointcut that inverts the original pointcut.

Parameters:
methodPointcut - the pointcut to negate.
Returns:
a new MethodPointcut that inverts methodPointcut.


Copyright © 2003-2009 Codehaus. All Rights Reserved.