dynaop
Class Pointcuts

java.lang.Object
  extended bydynaop.Pointcuts

public class Pointcuts
extends java.lang.Object

Creates class and method pointcuts.

Author:
Bob Lee (crazybob@crazybob.org)

Field Summary
static ClassPointcut ALL_CLASSES
          Picks all classes.
static MethodPointcut ALL_METHODS
          Picks all methods.
static MethodPointcut GET_METHODS
          Picks getXxx() methods.
static MethodPointcut IS_METHODS
          Picks isXxx() methods.
static MethodPointcut OBJECT_METHODS
          Picks equals(), hashCode(), and toString().
static MethodPointcut SET_METHODS
          Picks setXxx() methods.
 
Method Summary
static ClassPointcut className(java.lang.String regex)
          Matches class names with a regular expression.
static MethodPointcut declaringClass(ClassPointcut classPointcut)
          Picks method if the given class pointcut picks the method's declaring class.
static ClassPointcut instancesOf(java.lang.Class parent)
          Picks classes that are an instance of the parent class or interface.
static ClassPointcut intersection(ClassPointcut a, ClassPointcut b)
          Intersection of two class pointcuts.
static MethodPointcut intersection(MethodPointcut a, MethodPointcut b)
          Intersection of two method pointcuts.
static MethodPointcut membersOf(java.lang.Class clazz)
          Picks methods that are members of the given class (whether or not the method's actual declaring class is an instance of the given class).
static ClassPointcut not(ClassPointcut a)
          Inverts pointcut.
static MethodPointcut not(MethodPointcut a)
          Inverts pointcut.
static ClassPointcut packageName(java.lang.String packageName)
          Picks all classes in package.
static MethodPointcut returnType(ClassPointcut classPointcut)
          Picks method if the given class pointcut picks the method's return type.
static MethodPointcut signature(java.lang.String regex)
          Matches method signatures with a regular expression.
static ClassPointcut singleton(java.lang.Class c)
          Picks one class.
static MethodPointcut singleton(java.lang.reflect.Method m)
          Picks one method.
static ClassPointcut union(ClassPointcut a, ClassPointcut b)
          Union of two class pointcuts.
static MethodPointcut union(MethodPointcut a, MethodPointcut b)
          Union of two method pointcuts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_CLASSES

public static final ClassPointcut ALL_CLASSES
Picks all classes.


ALL_METHODS

public static final MethodPointcut ALL_METHODS
Picks all methods.


OBJECT_METHODS

public static final MethodPointcut OBJECT_METHODS
Picks equals(), hashCode(), and toString().


GET_METHODS

public static final MethodPointcut GET_METHODS
Picks getXxx() methods.


IS_METHODS

public static final MethodPointcut IS_METHODS
Picks isXxx() methods.


SET_METHODS

public static final MethodPointcut SET_METHODS
Picks setXxx() methods.

Method Detail

packageName

public static ClassPointcut packageName(java.lang.String packageName)
Picks all classes in package.


union

public static ClassPointcut union(ClassPointcut a,
                                  ClassPointcut b)
Union of two class pointcuts.


union

public static MethodPointcut union(MethodPointcut a,
                                   MethodPointcut b)
Union of two method pointcuts.


intersection

public static ClassPointcut intersection(ClassPointcut a,
                                         ClassPointcut b)
Intersection of two class pointcuts.


intersection

public static MethodPointcut intersection(MethodPointcut a,
                                          MethodPointcut b)
Intersection of two method pointcuts.


className

public static ClassPointcut className(java.lang.String regex)
                               throws org.apache.oro.text.regex.MalformedPatternException
Matches class names with a regular expression. Uses ORO (http://jakarta.apache.org/oro/index.html).

Throws:
org.apache.oro.text.regex.MalformedPatternException

signature

public static MethodPointcut signature(java.lang.String regex)
                                throws org.apache.oro.text.regex.MalformedPatternException
Matches method signatures with a regular expression. Method signatures follow this pattern:
 ReturnType methodName(ArgumentType, ArgumentType, ...) 
 		throws ExceptionType, ExceptionType
 
Omits "java.lang." from classes in java.lang package. Uses ORO (http://jakarta.apache.org/oro/index.html).

Throws:
org.apache.oro.text.regex.MalformedPatternException

instancesOf

public static ClassPointcut instancesOf(java.lang.Class parent)
Picks classes that are an instance of the parent class or interface.


singleton

public static ClassPointcut singleton(java.lang.Class c)
Picks one class.


singleton

public static MethodPointcut singleton(java.lang.reflect.Method m)
Picks one method.


not

public static ClassPointcut not(ClassPointcut a)
Inverts pointcut.


not

public static MethodPointcut not(MethodPointcut a)
Inverts pointcut.


declaringClass

public static MethodPointcut declaringClass(ClassPointcut classPointcut)
Picks method if the given class pointcut picks the method's declaring class.


returnType

public static MethodPointcut returnType(ClassPointcut classPointcut)
Picks method if the given class pointcut picks the method's return type.


membersOf

public static MethodPointcut membersOf(java.lang.Class clazz)
Picks methods that are members of the given class (whether or not the method's actual declaring class is an instance of the given class).