Information Technology Reference
In-Depth Information
Table 3.2.
Pointcuts supported by JBoss AOP.
Pointcut Type
Description
execution(method
Specifies that an interception occurs whenever a
or constructor)
specified method or constructor is called.
get(field expression)
Specifies that an interception occurs when a
specified field is accessed to be read.
set(field expression)
Specifies that an interception occurs when a
field
specified field is accessed to be written to.
field(field expression)
Specifies that an interception occurs when a
specified field is accessed to be read from or written
to.
all(type expression)
Specifies that calls to a specified constructor,
method or field of a particular class will be inter-
cepted.
call(method
Specifies that calls to a specified constructor or
or constructor)
method will be intercepted.
within(type expression)
Matches any join point (method or constructor
call) within any code within a particular call.
withincode(method
Matches any join point (method or constructor
or constructor)
call) within a particular method or constructor.
has(method
Used as an additional requirement for matching.
or constructor)
If a join point is matched, its class must also have a
constructor or method that matches the has ex-
pression.
hasfield(field expression)
Used as an additional requirement for matching. If
a join point is matched, its class must also have a
constructor or method that matches the hasfield
expression.
the next advice in the chain (if there is more than one) or the actual method or
constructor invocation is called. Failure to adhere to this protocol results in the
failure to call other advice and/or the method or constructor.
The framework also supports other invocation types such as all invocations,
public Object trace(Invocation invocation) , and constructor invocations,
public Object trace(ConstructorInvocation invocation) .
XML files are used by the framework to describe pointcuts and the attach-
ment of pointcuts to aspects. Table 3.2 lists the types of pointcuts supported by
the JBoss AOP framework [54].
For example, the XML constructs used to trace all calls to the withdraw
method on any object that has a parameter of double using the MyAspect aspect
example presented in Figure 3.3 is:
 
Search WWH ::




Custom Search