|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.framework.ProxyConfig org.springframework.aop.framework.AdvisedSupport
Superclass for AOP proxy configuration managers. These are not themselves AOP proxies, but subclasses of this class are normally factories from which AOP proxy instances are obtained directly.
This class frees subclasses of the housekeeping of Advices and Advisors, but doesn't actually implement proxy creation methods, which are provided by subclasses.
This class is serializable; subclasses need not be. This class is used to hold snapshots of proxies.
AopProxy
,
Serialized FormField Summary | |
(package private) AdvisorChainFactory |
advisorChainFactory
|
static TargetSource |
EMPTY_TARGET_SOURCE
Canonical TargetSource when there's no target, and behavior is supplied by the advisors. |
(package private) TargetSource |
targetSource
Package-protected to allow direct access for efficiency |
Fields inherited from class org.springframework.aop.framework.ProxyConfig |
exposeProxy, logger |
Constructor Summary | |
AdvisedSupport()
No arg constructor to allow use as a JavaBean. |
|
AdvisedSupport(Class[] interfaces)
Create a DefaultProxyConfig with the given parameters. |
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)
Cannot add introductions this way unless the advice implements IntroductionInfo. |
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. |
void |
addAdvisor(int pos,
IntroductionAdvisor advisor)
|
void |
addAfterReturningAdvice(AfterReturningAdvice ara)
Add an AfterReturningAdvice to the tail of the advice chain. |
void |
addBeforeAdvice(MethodBeforeAdvice ba)
Add a MethodBeforeAdvice to the tail of the advice chain. |
void |
addInterceptor(Interceptor interceptor)
Add the given AOP Alliance interceptor to the tail of the advice (interceptor) chain. |
void |
addInterceptor(int pos,
Interceptor interceptor)
Add the given AOP Alliance interceptor at the specified position in the interceptor chain. |
void |
addInterface(Class newInterface)
Add a new proxied interface. |
void |
addListener(AdvisedSupportListener listener)
|
void |
addThrowsAdvice(ThrowsAdvice throwsAdvice)
Add a ThrowsAdvice to the tail of the advice chain. |
boolean |
adviceIncluded(Advice advice)
Is this advice included in any advisor? |
protected void |
copyConfigurationFrom(AdvisedSupport other)
Call this method on a new instance created by the no-arg constructor to create an independent copy of the configuration from the other. |
protected void |
copyConfigurationFrom(AdvisedSupport other,
TargetSource ts,
List pAdvisors)
Take interfaces and ProxyConfig configuration from the other AdvisedSupport, but allow substitution of a fresh TargetSource and interceptor chain |
int |
countAdvicesOfType(Class interceptorClass)
Count advices of the given class |
int |
countInterceptorsOfType(Class interceptorClass)
Deprecated. in favor of countAdvicesOfType |
protected AopProxy |
createAopProxy()
Subclasses should call this to get a new AOP proxy. |
AdvisorChainFactory |
getAdvisorChainFactory()
|
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(Advice advice)
Return the index (from 0) of the given AOP Alliance Advice, or -1 if no such advice is an advice for this proxy. |
int |
indexOf(Advisor advisor)
Return the index (from 0) of the given advisor, or -1 if no such advisor applies to this proxy. |
int |
indexOf(Interceptor interceptor)
Deprecated. in favor of indexOf(Advice) |
boolean |
interceptorIncluded(Interceptor mi)
Deprecated. in favor of adviceIncluded |
protected boolean |
isActive()
Subclasses can call this to check whether any AOP proxies have been created yet. |
boolean |
isInterfaceProxied(Class intf)
Return whether this interface is proxied. |
protected Object |
readResolve()
Used to initialize transient state. |
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 |
removeInterceptor(Interceptor interceptor)
Deprecated. in favor or removeAdvice |
boolean |
removeInterface(Class intf)
Remove a proxied interface. |
void |
removeListener(AdvisedSupportListener listener)
|
boolean |
replaceAdvisor(Advisor a,
Advisor b)
Replace the given advisor. |
void |
setAdvisorChainFactory(AdvisorChainFactory advisorChainFactory)
|
void |
setInterfaces(Class[] interfaces)
Set the interfaces to be proxied. |
void |
setTarget(Object target)
Set the given object as target. |
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. |
String |
toString()
For debugging/diagnostic use. |
protected Object |
writeReplace()
Serialize a copy of the state of this class, ignoring subclass state. |
Methods inherited from class org.springframework.aop.framework.ProxyConfig |
copyFrom, getAopProxyFactory, getExposeProxy, getOpaque, getOptimize, getProxyTargetClass, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setAopProxyFactory, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.aop.framework.Advised |
getExposeProxy, getProxyTargetClass, isExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy |
Field Detail |
public static final TargetSource EMPTY_TARGET_SOURCE
TargetSource targetSource
transient AdvisorChainFactory advisorChainFactory
Constructor Detail |
public AdvisedSupport()
public AdvisedSupport(Class[] interfaces)
interfaces
- the proxied interfacesMethod Detail |
public void addListener(AdvisedSupportListener listener)
public void removeListener(AdvisedSupportListener listener)
public void setTarget(Object target)
setTargetSource(org.springframework.aop.TargetSource)
,
SingletonTargetSource
public void setTargetSource(TargetSource targetSource)
Advised
setTargetSource
in interface Advised
targetSource
- new TargetSource to usepublic TargetSource getTargetSource()
Advised
getTargetSource
in interface Advised
public void setAdvisorChainFactory(AdvisorChainFactory advisorChainFactory)
public AdvisorChainFactory getAdvisorChainFactory()
protected void copyConfigurationFrom(AdvisedSupport other)
other
- AdvisedSupport to copy configuration fromprotected void copyConfigurationFrom(AdvisedSupport other, TargetSource ts, List pAdvisors)
other
- other AdvisedSupport object to take
interfaces and ProxyConfig superclass configuration fromts
- new TargetSourcepAdvisors
- new Advisor chainpublic void setInterfaces(Class[] interfaces)
public void addInterface(Class newInterface)
newInterface
- additional interface to proxypublic Class[] getProxiedInterfaces()
Advised
getProxiedInterfaces
in interface Advised
public boolean removeInterface(Class intf)
public void addInterceptor(Interceptor interceptor) throws AopConfigException
Advised
Use the addAdvice
method instead.
addInterceptor
in interface Advised
interceptor
- to add to the tail of the chain
AopConfigException
addAdvice(org.aopalliance.aop.Advice)
,
Advised.addInterceptor(org.aopalliance.intercept.Interceptor)
public void addAdvice(Advice advice) throws AopConfigException
Advised
addAdvice
in interface Advised
advice
- advice to add to the tail of the chain
AopConfigException
Advised.addAdvice(int, Advice)
,
DefaultPointcutAdvisor
public boolean isInterfaceProxied(Class intf)
Advised
isInterfaceProxied
in interface Advised
intf
- interface to testpublic void addInterceptor(int pos, Interceptor interceptor) throws AopConfigException
Advised
Use the addAdvice
method instead.
addInterceptor
in interface Advised
pos
- index from 0 (head)interceptor
- interceptor to add at the specified position in the
interceptor chain
AopConfigException
addAdvice(int, org.aopalliance.aop.Advice)
,
Advised.addInterceptor(int, org.aopalliance.intercept.Interceptor)
public void addAdvice(int pos, Advice advice) throws AopConfigException
addAdvice
in interface Advised
pos
- index from 0 (head)advice
- advice to add at the specified position in the advice chain
AopConfigException
public final boolean removeInterceptor(Interceptor interceptor) throws AopConfigException
AopConfigException
removeAdvice(org.aopalliance.aop.Advice)
public final boolean removeAdvice(Advice advice) throws AopConfigException
removeAdvice
in interface Advised
advice
- advice to remove
AopConfigException
public void addAfterReturningAdvice(AfterReturningAdvice ara) throws AopConfigException
Advised
Use the addAdvice
method instead.
addAfterReturningAdvice
in interface Advised
ara
- AfterReturningAdvice to add
AopConfigException
- if the advice cannot be added
(for example, because the proxy configuration is frozen)addAdvice(org.aopalliance.aop.Advice)
,
Advised.addAfterReturningAdvice(org.springframework.aop.AfterReturningAdvice)
public void addBeforeAdvice(MethodBeforeAdvice ba) throws AopConfigException
Advised
Use the addAdvice
method instead.
addBeforeAdvice
in interface Advised
ba
- MethodBeforeAdvice to add
AopConfigException
- if the advice cannot be added
(for example, because the proxy configuration is frozen)addAdvice(org.aopalliance.aop.Advice)
,
Advised.addBeforeAdvice(org.springframework.aop.MethodBeforeAdvice)
public void addThrowsAdvice(ThrowsAdvice throwsAdvice) throws AopConfigException
Advised
Use the addAdvice
method instead.
addThrowsAdvice
in interface Advised
throwsAdvice
- ThrowsAdvice to add
AopConfigException
- if the advice cannot be added
(for example, because the proxy configuration is frozen)addAdvice(org.aopalliance.aop.Advice)
,
Advised.addThrowsAdvice(org.springframework.aop.ThrowsAdvice)
public int indexOf(Interceptor interceptor)
interceptor
- AOP Alliance interceptor to search for
indexOf(org.aopalliance.aop.Advice)
public int indexOf(Advice advice)
advice
- AOP Alliance advice to search for
public int indexOf(Advisor advisor)
indexOf
in interface Advised
advisor
- advisor to search for
public final boolean removeAdvisor(Advisor advisor)
Advised
removeAdvisor
in interface Advised
advisor
- advisor to remove
public void removeAdvisor(int index) throws AopConfigException
Advised
removeAdvisor
in interface Advised
index
- index of advisor to remove
AopConfigException
- if the index is invalidpublic void addAdvisor(int pos, IntroductionAdvisor advisor) throws AopConfigException
AopConfigException
public void addAdvisor(int pos, Advisor advisor) throws AopConfigException
Advised
addAdvisor
in interface Advised
advisor
- advisor to add at the specified position in the chainpos
- position in chain (0 is head). Must be valid.
AopConfigException
public void addAdvisor(Advisor advisor)
Advised
The Advisor may be an IntroductionAdvisor, in which new interfaces will be available when a proxy is next obtained from the relevant factory.
addAdvisor
in interface Advised
advisor
- Advisor to add to the end of the chainpublic final Advisor[] getAdvisors()
Advised
getAdvisors
in interface Advised
public final 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.
replaceAdvisor
in interface Advised
a
- advisor to replaceb
- advisor to replace it with
AopConfigException
public final boolean interceptorIncluded(Interceptor mi)
mi
- interceptor to check inclusion of
adviceIncluded(org.aopalliance.aop.Advice)
public final boolean adviceIncluded(Advice advice)
advice
- advice to check inclusion of
public final int countInterceptorsOfType(Class interceptorClass)
interceptorClass
- class of the interceptor to check
countAdvicesOfType(java.lang.Class)
public final int countAdvicesOfType(Class interceptorClass)
interceptorClass
- class of the interceptor to check
protected AopProxy createAopProxy()
protected final boolean isActive()
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
protected Object readResolve() throws ObjectStreamException
ObjectStreamException
public String toProxyConfigString()
Advised
toProxyConfigString
in interface Advised
public String toString()
toString
in class ProxyConfig
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |