Introduction


The pointcuts covered in this chapter enable you to examine the type of the this reference, the optional target reference or arguments at a particular join point.

The this([Type | Identifier]) examines the type of the object that is referenced by this at the captured join point. The target of a join point, specified by the target([Type | Identifier]) pointcut, differs depending on the join point type but is commonly the object upon which a method is being called, or an attribute that is being accessed in some way where the join point is encountered. The args of a join point, specified by the args([Types | Identifiers]) pointcut, are the arguments, if any, available at the captured join point.

The types of the this, target, and args references can be examined in one of two ways: using static Type specifications, or by using an Identifier that references an actual runtime object.

A Type specification provides a static compile-time evaluation of the object type at the join point and takes the form of a fully qualified class name (for example, com.oreilly.Foo is acceptable, but Foo or Foo.class is not).

An Identifier provides a means by which the actual types of runtime objects at the captured join point can be evaluated rather than just static types. An Identifier is dynamically assigned to the appropriate object at runtime.



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