Appendix A. AspectJ Quick Reference

Table of Contents

Pointcuts
Type Patterns
Advice
Inter-type member declarations
Other declarations
Aspects

Pointcuts

Methods and Constructors
call(Signature) every call to any method or constructor matching Signature at the call site
execution(Signature) every execution of any method or constructor matching Signature
Fields
get(Signature) every reference to any field matching Signature
set(Signature) every assignment to any field matching Signature. The assigned value can be exposed with an args pointcut
Exception Handlers
handler(TypePattern) every exception handler for any Throwable type in TypePattern. The exception value can be exposed with an args pointcut
Advice
adviceexecution() every execution of any piece of advice
Initialization
staticinitialization(TypePattern) every execution of a static initializer for any type in TypePattern
initialization(Signature) every initialization of an object when the first constructor called in the type matches Signature, encompassing the return from the super constructor call to the return of the first-called constructor
preinitialization(Signature) every pre-initialization of an object when the first constructor called in the type matches Signature, encompassing the entry of the first-called constructor to the call to the super constructor
Lexical
within(TypePattern) every join point from code defined in a type in TypePattern
withincode(Signature) every join point from code defined in a method or constructor matching Signature
Instanceof checks and context exposure
this(Type or Id) every join point when the currently executing object is an instance of Type or Id's type
target(Type or Id) every join point when the target executing object is an instance of Type or Id's type
args(Type or Id, ...) every join point when the arguments are instances of Types or the types of the Ids
Control Flow
cflow(Pointcut) every join point in the control flow of each join point P picked out by Pointcut, including P itself
cflowbelow(Pointcut) every join point below the control flow of each join point P picked out by Pointcut; does not include P itself
Conditional
if(Expression) every join point when the boolean Expression is true
Combination
! Pointcut every join point not picked out by Pointcut
Pointcut0 && Pointcut1 each join point picked out by both Pointcut0 and Pointcut1
Pointcut0 || Pointcut1 each join point picked out by either Pointcut0 or Pointcut1
( Pointcut ) each join point picked out by Pointcut