Introduction


A common approach in the design of pointcut definitions is to limit the range of join points captured based on the programmatic scope of interest. This gives you some immediate control over what join points are going to be involved in further pointcut definitions.

This chapter describes the set of pointcuts that allow to you explicitly limit the join points captured based upon their programmatic scope. These pointcuts enable you to specify a method right through to package scope.

The pointcuts in this chapter are fairly simple to master, and they are some of the most commonly used elements of AspectJ. For example, a popular use of the within(TypePattern) pointcut (discussed in Recipe 5.1) is to use it in the !within(%THIS_ASPECT%) form. This AspectJ idiom limits the scope to every join point outside of the current aspect, providing protection against the advice triggering a recursive call to the same advice block and resulting in an infinite loop. The concepts in this chapter are basic to AspectJ programming and form the backbone of many of the operations detailed later in the book.



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