public class AdviceBinding extends Object
AspectManager.addBinding(AdviceBinding)
,
AspectManager.removeBinding(String)
Modifier and Type | Field and Description |
---|---|
protected Map<Advisor,Boolean> |
advisors
Contains all the client advisors, mapped to a boolean value.
|
protected ASTCFlowExpression |
cflow
A control flow restriction (in its AST form).
|
protected String |
cflowString
A control flow restriction (in its string form).
|
protected InterceptorFactory[] |
interceptorFactories
The factories responsible for creating the bound interceptor instances.
|
protected String |
name
Name that identifies this binding in its
domain . |
protected Pointcut |
pointcut
Identifies when the advices/interceptors contained in this binding should
be invoked.
|
Constructor and Description |
---|
AdviceBinding() |
AdviceBinding(String name,
Pointcut p,
ASTCFlowExpression cflow,
String cflowString,
InterceptorFactory[] factories)
Constructor to be used internally.
|
AdviceBinding(String pointcutExpression,
String cflow)
This constructor is used for creation of advice bindings programmatically on
dynamic AOP operations.
|
AdviceBinding(String name,
String pointcutExpression,
String cflow)
This constructor is used for creation of advice bindings programmatically on
dynamic AOP operations.
|
Modifier and Type | Method and Description |
---|---|
void |
addAdvisor(Advisor advisor)
Adds an advisor as a client of this binding.
|
void |
addInterceptor(Class<?> clazz)
Adds an interceptor to the chain.
|
void |
addInterceptorFactory(InterceptorFactory factory)
Adds an interceptor to the chain.
|
void |
clearAdvisors()
Clears the list of the client advisors.
|
boolean |
equals(Object obj)
Compares this binding with
obj for equality. |
ArrayList<Advisor> |
getAdvisors()
Returns the list of the client advisors.
|
ASTCFlowExpression |
getCFlow()
Returns the cflow condition in the form an
AST parser. |
String |
getCFlowString()
Returns the cflow condition.
|
InterceptorFactory[] |
getInterceptorFactories()
Returns the interceptor factory chain.
|
String |
getName()
Returns the name of this binding.
|
Pointcut |
getPointcut()
Returns the pointcut that determines when the bound interceptor chain should
be invoked.
|
boolean |
hasAdvisors()
Indicates whether there are any advisors using this binding for interception.
|
int |
hashCode() |
void |
setCFlowExpression(String cflow)
Defines a control-flow restriction to this binding.
|
void |
setName(String name)
Defines the name of this binding.
|
void |
setPointcutExpression(String pointcutExpression)
Defines the pointcut expression to be used by this binding.
|
protected Pointcut pointcut
protected ASTCFlowExpression cflow
null
.protected String cflowString
null
protected Map<Advisor,Boolean> advisors
protected InterceptorFactory[] interceptorFactories
public AdviceBinding()
public AdviceBinding(String name, Pointcut p, ASTCFlowExpression cflow, String cflowString, InterceptorFactory[] factories) throws ParseException
name
- identifies this definition in its domain
p
- pointcut expression. Only the joinpoints that satisfy
this expression will be intercepted by the bound
interceptors.cflow
- a control flow condition in the form of an AST
parsercflowString
- a control flow expressionfactories
- creates the objects that will perform interception
on the matched joinpointsParseException
- when cflowString
is not null
and
contains a syntax errorpublic AdviceBinding(String pointcutExpression, String cflow) throws ParseException
The name
of the advice will be generated automatically.
Bound interceptors will be invoked only on the joinpoints that are matched
by pointcutExpression
, and that satisfy cflow
if it is not
null
.
pointcutExpression
- pointcut expression. Only the joinpoints that satisfy
this expression will be intercepted by the bound
interceptors.cflow
- a control flow expression. Can be null
if no
such condition is necessary. Notice that using
control flow conditions requires runtime checks and
may impact your system performance. Always prefer to
use pointcut expressions of the form call(...)
AND within(...)
or call(...) AND
withincode(...)
instead, whenever applicable.ParseException
- when cflow
is not null
and contains a
syntax errorpublic AdviceBinding(String name, String pointcutExpression, String cflow) throws ParseException
Bound interceptors will be invoked only on the joinpoints that are matched
by pointcutExpression
, and that satisfy cflow
if it is not
null
.
name
- identifies this binding in its domain
.pointcutExpression
- pointcut expression. Only the joinpoints that satisfy
this expression can be intercepted by the bound
interceptors.cflow
- a control flow expression. Can be null
if no
such condition is necessary. Notice that using
control flow conditions requires runtime checks and
may impact your system performance. Always prefer to
use pointcut expressions of the form call(...)
AND within(...)
or call(...) AND
withincode(...)
instead, whenever applicable.ParseException
- when cflow
is not null
and contains a
syntax errorpublic void setCFlowExpression(String cflow) throws ParseException
call(...) AND within(...)
or call(...) AND
withincode(...)
instead, whenever applicable.cflow
- a control flow expression.ParseException
- when cflow
is not null
and contains a
syntax errorpublic void setPointcutExpression(String pointcutExpression) throws ParseException
cflow
condition if there is
one.pointcutExpression
- pointcut expression. Only the joinpoints that satisfy
this expression can be intercepted by the bound
interceptors.ParseException
- when cflow
is not null
and contains a
syntax errorpublic void addInterceptorFactory(InterceptorFactory factory)
factory
- creates the interceptor instances that will be invoked during
interceptionpublic void addInterceptor(Class<?> clazz)
clazz
- the actual class that implements Interceptor
. This class
must provide a default constructor so it can be created.
A GenericInterceptorFactory
will be used to create the
interceptor instances.GenericInterceptorFactory
public String getName()
domain
.domain
public InterceptorFactory[] getInterceptorFactories()
For internal use only.
addInterceptor(Class)
,
addInterceptorFactory(InterceptorFactory)
public void setName(String name)
domain
.name
- the name that identifies this binding in its domain
public Pointcut getPointcut()
For internal use only.
public ASTCFlowExpression getCFlow()
AST
parser.
For internal use only.
public String getCFlowString()
public void addAdvisor(Advisor advisor)
For internal use only.
advisor
- manages one or more joinpoints that are matched by
the bound pointcut
.public boolean hasAdvisors()
true
if and only if there are one or more advisors that use
this binding for interceptionpublic ArrayList<Advisor> getAdvisors()
For internal use only.
public void clearAdvisors()
For internal use only.
public boolean equals(Object obj)
obj
for equality.Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.