Introduction


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 solitary adviceexecution() pointcut for this purpose.

Introducing the adviceexecution( ) pointcut's syntax and a simple example of its use, this chapter then shows how the adviceexecution( ) 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.

The 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.



AspectJ Cookbook
Aspectj Cookbook
ISBN: 0596006543
EAN: 2147483647
Year: 2006
Pages: 203
Authors: Russ Miles

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net