Chapter 6. Capturing Join Points on Advice
In AspectJ, aspects are first-class language constructs just like classes. Classes and their business logic can be advised by aspects and so can aspects themselves. Although aspects can contain methods and other candidate join points, there is one construct that is specific to aspects that is in need of its own mechanism for capturing its join points. That construct is advice.
This chapter deals with using pointcut definitions that are purely
concerned with capturing join points that occur within advice.
AspectJ provides the
adviceexecution() pointcut for this purpose.
pointcut’s syntax and a simple example of its use,
this chapter then shows how the
pointcut can provide an especially effective means of working with
situations where advice and the behavior it invokes need to be
excluded from being advised by the other aspects in your application.
This chapter ends by showing how to use some interesting
characteristics of how AspectJ implements advice to access the
original join point that triggered the advice that is in turn being
advised using the
adviceexecution( ) pointcut.
adviceexecution( ) pointcut is a reasonably
new addition to the AspectJ developers toolbox, and this chapter
shows how useful this pointcut can be when working with aspects that
apply to aspects.
6.1. Capturing When Advice Is Executing
You want to capture when any piece of advice is ...