Introduction


This chapter examines how pointcuts can be combined and evaluated as Boolean expressions. Pointcut logic is evaluated to determine whether a particular join point is caught. The Boolean nature of pointcut logic allows for pointcut declarations to be combined using traditional Boolean expressions such as logical AND, logical OR, and logical NOT.

Conditional logic can also be expressed in pointcut declarations using an if statement. An if statement is used to compare expressions that contain values other than Booleans. The if statement evaluates the values passed to it at runtime to come to a true or false result.

Anonymous pointcuts are the building blocks of more complexly named pointcut declarations. Anonymous pointcuts can be declared as part of compound-named pointcuts or as part of an advice declaration. Named pointcuts are then, in turn, the building blocks of pointcut logic reuse. Pointcut reuse allows efficient management of the complex logic that can be defined using the available pointcut within AspectJ. This chapter closes by examining how to declare anonymous pointcuts and combine those pointcuts into reusable named pointcuts.



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