org.aspectj.weaver.tools
Interface PointcutExpression


public interface PointcutExpression

Represents an AspectJ pointcut expression and provides convenience methods to determine whether or not the pointcut matches join points specified in terms of the java.lang.reflect interfaces.


Method Summary
 String getPointcutExpression()
          Return a string representation of this pointcut expression.
 FuzzyBoolean matchesAdviceExecution(Method anAdviceMethod, Class thisClass)
          Determine whether or not this pointcut matches the execution of a given piece of advice.
 FuzzyBoolean matchesConstructorCall(Constructor aConstructor, Class thisClass, Member withinCode)
          Determine whether or not this pointcut matches a call to the given constructor.
 FuzzyBoolean matchesConstructorExecution(Constructor aConstructor, Class thisClass)
          Determine whether or not this pointcut matches the execution of a given constructor.
 boolean matchesDynamically(Object thisObject, Object targetObject, Object[] args)
          Returns true iff the dynamic portions of the pointcut expression (this, target, and args) match the given this, target, and args objects.
 FuzzyBoolean matchesFieldGet(Field aField, Class thisClass, Class targetClass, Member withinCode)
          Determine whether or not this pointcut matches a get of the given field.
 FuzzyBoolean matchesFieldSet(Field aField, Class thisClass, Class targetClass, Member withinCode)
          Determine whether or not this pointcut matches a set of the given field.
 FuzzyBoolean matchesHandler(Class exceptionType, Class inClass, Member withinCode)
          Determine whether or not this pointcut matches the execution of a given exception handler
 FuzzyBoolean matchesInitialization(Constructor aConstructor)
          Determine whether or not this pointcut matches the initialization of an object initiated by a call to the given constructor.
 FuzzyBoolean matchesMethodCall(Method aMethod, Class thisClass, Class targetClass, Member withinCode)
          Determine whether or not this pointcut matches a method call to the given method.
 FuzzyBoolean matchesMethodExecution(Method aMethod, Class thisClass)
          Determine whether or not this pointcut matches the execution of a given method.
 FuzzyBoolean matchesPreInitialization(Constructor aConstructor)
          Determine whether or not this pointcut matches the preinitialization of an object initiated by a call to the given constructor.
 FuzzyBoolean matchesStaticInitialization(Class aClass)
          Determine whether or not this pointcut matches the static initialization of the given class.
 

Method Detail

matchesMethodCall

public FuzzyBoolean matchesMethodCall(Method aMethod,
                                      Class thisClass,
                                      Class targetClass,
                                      Member withinCode)
Determine whether or not this pointcut matches a method call to the given method.

Parameters:
aMethod - the method being called
thisClass - the type making the method call
targetClass - the static type of the target of the call (may be a subtype of aMethod.getDeclaringClass() )
withinCode - the Method or Constructor from within which the call is made
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments, caller, and called object.

matchesMethodExecution

public FuzzyBoolean matchesMethodExecution(Method aMethod,
                                           Class thisClass)
Determine whether or not this pointcut matches the execution of a given method.

Parameters:
aMethod - the method being executed
thisClass - the static type of the object in which the method is executing (may be a subtype of aMethod.getDeclaringClass())
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments and executing object.

matchesConstructorCall

public FuzzyBoolean matchesConstructorCall(Constructor aConstructor,
                                           Class thisClass,
                                           Member withinCode)
Determine whether or not this pointcut matches a call to the given constructor.

Parameters:
aConstructor - the constructor being called
thisClass - the type making the constructor call
withinCode - the Method or Constructor from within which the call is made
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments and caller.

matchesConstructorExecution

public FuzzyBoolean matchesConstructorExecution(Constructor aConstructor,
                                                Class thisClass)
Determine whether or not this pointcut matches the execution of a given constructor.

Parameters:
aConstructor - the constructor being executed
thisClass - the static type of the object in which the constructor is executing (may be a subtype of aConstructor.getDeclaringClass())
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments and executing object.

matchesAdviceExecution

public FuzzyBoolean matchesAdviceExecution(Method anAdviceMethod,
                                           Class thisClass)
Determine whether or not this pointcut matches the execution of a given piece of advice.

Parameters:
anAdviceMethod - a method representing the advice being executed
thisClass - the static type of the aspect in which the advice is executing (may be a subtype of anAdviceMethod.getDeclaringClass())
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime type of the executing aspect.

matchesHandler

public FuzzyBoolean matchesHandler(Class exceptionType,
                                   Class inClass,
                                   Member withinCode)
Determine whether or not this pointcut matches the execution of a given exception handler

Parameters:
exceptionType - the static type of the exception being handled
inClass - the class in which the catch block is declared
withinCode - the method or constructor in which the catch block is declared
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the exception and exception-handling object.

matchesInitialization

public FuzzyBoolean matchesInitialization(Constructor aConstructor)
Determine whether or not this pointcut matches the initialization of an object initiated by a call to the given constructor.

Parameters:
aConstructor - the constructor initiating the initialization
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments.

matchesPreInitialization

public FuzzyBoolean matchesPreInitialization(Constructor aConstructor)
Determine whether or not this pointcut matches the preinitialization of an object initiated by a call to the given constructor.

Parameters:
aConstructor - the constructor initiating the initialization
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the arguments.

matchesStaticInitialization

public FuzzyBoolean matchesStaticInitialization(Class aClass)
Determine whether or not this pointcut matches the static initialization of the given class.

Parameters:
aClass - the class being statically initialized
Returns:
FuzzyBoolean.YES is the pointcut always matches, FuzzyBoolean.NO if the pointcut never matches.

matchesFieldSet

public FuzzyBoolean matchesFieldSet(Field aField,
                                    Class thisClass,
                                    Class targetClass,
                                    Member withinCode)
Determine whether or not this pointcut matches a set of the given field.

Parameters:
aField - the field being updated
thisClass - the type sending the update message
targetClass - the static type of the target of the field update message (may be a subtype of aField.getDeclaringClass() )
withinCode - the Method or Constructor from within which the update message is sent
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the caller and called object.

matchesFieldGet

public FuzzyBoolean matchesFieldGet(Field aField,
                                    Class thisClass,
                                    Class targetClass,
                                    Member withinCode)
Determine whether or not this pointcut matches a get of the given field.

Parameters:
aField - the field being accessed
thisClass - the type accessing the field
targetClass - the static type of the target of the field access message (may be a subtype of aField.getDeclaringClass() )
withinCode - the Method or Constructor from within which the field is accessed
Returns:
a FuzzyBoolean indicating whether the pointcut always matches such a join point (YES), never matches such a join point (NO), or may match such a join point (MAYBE) depending on the runtime types of the caller and called object.

matchesDynamically

public boolean matchesDynamically(Object thisObject,
                                  Object targetObject,
                                  Object[] args)
Returns true iff the dynamic portions of the pointcut expression (this, target, and args) match the given this, target, and args objects. This method only needs to be called if a previous call to a FuzzyBoolean-returning matching method returned FuzzyBoolean.MAYBE. Even if this method returns true, the pointcut can only be considered to match the join point if the appropriate matches method for the join point kind has also returned FuzzyBoolean.YES or FuzzyBoolean.MAYBE.

Parameters:
thisObject -
targetObject -
args -
Returns:

getPointcutExpression

public String getPointcutExpression()
Return a string representation of this pointcut expression.