|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Advised
Interface to be implemented by classes that hold the configuration of a factory of AOP proxies. This configuration includes the Interceptors and other advice, and Advisors, and the proxied interfaces.
Any AOP proxy obtained from Spring can be cast to this interface to allow manipulation of its AOP advice.
AdvisedSupport
Method Summary | |
---|---|
void |
addAdvice(Advice advice)
Add the given AOP Alliance advice to the tail of the advice (interceptor) chain. |
void |
addAdvice(int pos,
Advice advice)
Add the given AOP Alliance Advice at the specified position in the advice chain. |
void |
addAdvisor(Advisor advisor)
Add an Advisor at the end of the advisor chain. |
void |
addAdvisor(int pos,
Advisor advisor)
Add an Advisor at the specified position in the chain. |
Advisor[] |
getAdvisors()
Return the Advisors applying to this proxy. |
Class[] |
getProxiedInterfaces()
Return the interfaces proxied by the AOP proxy. |
TargetSource |
getTargetSource()
Return the TargetSource used by this Advised object. |
int |
indexOf(Advisor advisor)
Return the index (from 0) of the given advisor, or -1 if no such advisor applies to this proxy. |
boolean |
isExposeProxy()
Return whether the factory should expose the proxy as a ThreadLocal. |
boolean |
isFrozen()
Return whether the Advised configuration is frozen, and no advice changes can be made. |
boolean |
isInterfaceProxied(Class intf)
Return whether this interface is proxied. |
boolean |
isProxyTargetClass()
Should we proxy the target class as well as any interfaces? |
boolean |
removeAdvice(Advice advice)
Remove the Advisor containing the given advice. |
boolean |
removeAdvisor(Advisor advisor)
Remove the given advisor. |
void |
removeAdvisor(int index)
Remove the advisor at the given index. |
boolean |
replaceAdvisor(Advisor a,
Advisor b)
Replace the given advisor. |
void |
setExposeProxy(boolean exposeProxy)
Set whether the proxy should be exposed by the AOP framework as a ThreadLocal for retrieval via the AopContext class. |
void |
setTargetSource(TargetSource targetSource)
Change the TargetSource used by this Advised object. |
String |
toProxyConfigString()
As toString() will normally be delegated to the target, this returns the equivalent for the AOP proxy. |
Method Detail |
---|
void setTargetSource(TargetSource targetSource)
targetSource
- new TargetSource to useTargetSource getTargetSource()
void setExposeProxy(boolean exposeProxy)
this
, the invocation will not be advised).
Default is "false", for optimal performance.
boolean isExposeProxy()
this
no advice
will apply.) Getting the proxy is analogous to an EJB calling getEJBObject().
AopContext
boolean isProxyTargetClass()
Advisor[] getAdvisors()
Class[] getProxiedInterfaces()
boolean isInterfaceProxied(Class intf)
intf
- interface to testvoid addAdvice(Advice advice) throws AopConfigException
This will be wrapped in a DefaultPointcutAdvisor with a pointcut that always
applies, and returned from the getAdvisors()
method in this wrapped form.
Note that the given advice will apply to all invocations on the proxy,
even to the toString()
method! Use appropriate advice implementations
or specify appropriate pointcuts to apply to a narrower set of methods.
advice
- advice to add to the tail of the chain
AopConfigException
addAdvice(int, Advice)
,
DefaultPointcutAdvisor
void addAdvice(int pos, Advice advice) throws AopConfigException
This will be wrapped in a DefaultPointcutAdvisor with a pointcut that always
applies, and returned from the getAdvisors()
method in this wrapped form.
Note that the given advice will apply to all invocations on the proxy,
even to the toString()
method! Use appropriate advice implementations
or specify appropriate pointcuts to apply to a narrower set of methods.
pos
- index from 0 (head)advice
- advice to add at the specified position in the advice chain
AopConfigException
void addAdvisor(Advisor advisor) throws AopConfigException
The Advisor may be an IntroductionAdvisor, in which new interfaces will be available when a proxy is next obtained from the relevant factory.
advisor
- Advisor to add to the end of the chain
AopConfigException
void addAdvisor(int pos, Advisor advisor) throws AopConfigException
advisor
- advisor to add at the specified position in the chainpos
- position in chain (0 is head). Must be valid.
AopConfigException
int indexOf(Advisor advisor)
The return value of this method can be used to index into the Advisors array.
advisor
- advisor to search for
boolean removeAdvisor(Advisor advisor) throws AopConfigException
advisor
- advisor to remove
AopConfigException
void removeAdvisor(int index) throws AopConfigException
index
- index of advisor to remove
AopConfigException
- if the index is invalidboolean removeAdvice(Advice advice) throws AopConfigException
advice
- advice to remove
AopConfigException
boolean replaceAdvisor(Advisor a, Advisor b) throws AopConfigException
NB:If the advisor is an IntroductionAdvisor and the replacement is not or implements different interfaces, the proxy will need to be re-obtained or the old interfaces won't be supported and the new interface won't be implemented.
a
- advisor to replaceb
- advisor to replace it with
AopConfigException
boolean isFrozen()
String toProxyConfigString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |