java.lang.Object | ||
↳ | org.springframework.aop.framework.ProxyConfig | |
↳ | org.springframework.aop.framework.AdvisedSupport |
Known Direct Subclasses |
Known Indirect Subclasses |
Base class 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.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EMPTY_TARGET_SOURCE | Canonical TargetSource when there's no target, and behavior is supplied by the advisors. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
No-arg constructor for use as a JavaBean.
| |||||||||||
Create a AdvisedSupport instance with the given parameters.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Cannot add introductions this way unless the advice implements IntroductionInfo.
| |||||||||||
Add the given AOP Alliance advice to the tail of the advice (interceptor) chain.
| |||||||||||
Add an advisor at the end of the advisor chain.
| |||||||||||
Add an Advisor at the specified position in the chain.
| |||||||||||
Add all of the given advisors to this proxy configuration.
| |||||||||||
Add all of the given advisors to this proxy configuration.
| |||||||||||
This method is deprecated.
as of Spring 3.0, in favor of
addAdvisors(Collection
| |||||||||||
Add a new proxied interface.
| |||||||||||
Is the given advice included in any advisor within this proxy configuration?
| |||||||||||
Count advices of the given class.
| |||||||||||
Return the advisor chain factory to use (never
null ). | |||||||||||
Return the advisors applying to this proxy.
| |||||||||||
Determine a list of org.aopalliance.intercept.MethodInterceptor objects
for the given method, based on this configuration.
| |||||||||||
Return the interfaces proxied by the AOP proxy.
| |||||||||||
Return the target class behind the implementing object
(typically a proxy configuration or an actual proxy).
| |||||||||||
Return the TargetSource used by this Advised object.
| |||||||||||
Return the index (from 0) of the given advisor,
or -1 if no such advisor applies to this proxy.
| |||||||||||
Return the index (from 0) of the given AOP Alliance Advice,
or -1 if no such advice is an advice for this proxy.
| |||||||||||
Determine whether the given interface is proxied.
| |||||||||||
Return whether this proxy configuration is pre-filtered so that it only
contains applicable advisors (matching this proxy's target class).
| |||||||||||
Remove the Advisor containing the given advice.
| |||||||||||
Remove the advisor at the given index.
| |||||||||||
Remove the given advisor.
| |||||||||||
Remove a proxied interface.
| |||||||||||
Replace the given advisor.
| |||||||||||
Set the advisor chain factory to use.
| |||||||||||
Set the interfaces to be proxied.
| |||||||||||
Set whether this proxy configuration is pre-filtered so that it only
contains applicable advisors (matching this proxy's target class).
| |||||||||||
Set the given object as target.
| |||||||||||
Set a target class to be proxied, indicating that the proxy
should be castable to the given class.
| |||||||||||
Change the TargetSource used by this Advised object.
| |||||||||||
As
toString() will normally be delegated to the target,
this returns the equivalent for the AOP proxy. | |||||||||||
For debugging/diagnostic use.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked when advice has changed.
| |||||||||||
Copy the AOP configuration from the given AdvisedSupport object,
but allow substitution of a fresh TargetSource and a given interceptor chain.
| |||||||||||
Call this method on a new instance created by the no-arg constructor
to create an independent copy of the configuration from the given object.
| |||||||||||
Bring the array up to date with the list.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.aop.framework.ProxyConfig
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.aop.TargetClassAware
| |||||||||||
From interface
org.springframework.aop.framework.Advised
|
Canonical TargetSource when there's no target, and behavior is supplied by the advisors.
No-arg constructor for use as a JavaBean.
Create a AdvisedSupport instance with the given parameters.
interfaces | the proxied interfaces |
---|
Cannot add introductions this way unless the advice implements IntroductionInfo.
pos | index from 0 (head) |
---|---|
advice | advice to add at the specified position in the advice chain |
AopConfigException |
---|
Add the given AOP Alliance advice to the tail of the advice (interceptor) chain.
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 |
---|
Add an advisor at the end of the advisor chain.
The Advisor may be an IntroductionAdvisor
,
in which new interfaces will be available when a proxy is next obtained
from the relevant factory.
advisor | the advisor to add to the end of the chain |
---|
Add an Advisor at the specified position in the chain.
pos | position in chain (0 is head). Must be valid. |
---|---|
advisor | the advisor to add at the specified position in the chain |
AopConfigException |
---|
Add all of the given advisors to this proxy configuration.
advisors | the advisors to register |
---|
Add all of the given advisors to this proxy configuration.
advisors | the advisors to register |
---|
This method is deprecated.
as of Spring 3.0, in favor of addAdvisors(Collection
Add all of the given advisors to this proxy configuration.
advisors | the advisors to register |
---|
Add a new proxied interface.
intf | the additional interface to proxy |
---|
Is the given advice included in any advisor within this proxy configuration?
advice | the advice to check inclusion of |
---|
Count advices of the given class.
adviceClass | the advice class to check |
---|
Return the advisor chain factory to use (never null
).
Return the advisors applying to this proxy.
null
)
Determine a list of org.aopalliance.intercept.MethodInterceptor objects for the given method, based on this configuration.
method | the proxied method |
---|---|
targetClass | the target class |
Return the interfaces proxied by the AOP proxy. Will not include the target class, which may also be proxied.
Return the target class behind the implementing object (typically a proxy configuration or an actual proxy).
null
if not known
Return the index (from 0) of the given advisor, or -1 if no such advisor applies to this proxy.
The return value of this method can be used to index into the advisors array.
advisor | the advisor to search for |
---|
Return the index (from 0) of the given AOP Alliance Advice, or -1 if no such advice is an advice for this proxy.
The return value of this method can be used to index into the advisors array.
advice | AOP Alliance advice to search for |
---|
Determine whether the given interface is proxied.
intf | the interface to check |
---|
Return whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).
Remove the Advisor containing the given advice.
advice | the advice to remove |
---|
true
of the advice was found and removed;
false
if there was no such advice
AopConfigException |
---|
Remove the advisor at the given index.
index | index of advisor to remove |
---|
AopConfigException |
---|
Remove the given advisor.
advisor | the advisor to remove |
---|
true
if the advisor was removed; false
if the advisor was not found and hence could not be removed
Remove a proxied interface.
Does nothing if the given interface isn't proxied.
intf | the interface to remove from the proxy |
---|
true
if the interface was removed; false
if the interface was not found and hence could not be removed
Replace the given advisor.
Note: 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 | the advisor to replace |
---|---|
b | the advisor to replace it with |
false
and does nothing.AopConfigException |
---|
Set the advisor chain factory to use.
Default is a DefaultAdvisorChainFactory
.
Set whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).
Default is "false". Set this to "true" if the advisors have been pre-filtered already, meaning that the ClassFilter check can be skipped when building the actual advisor chain for proxy invocations.
Set the given object as target. Will create a SingletonTargetSource for the object.
Set a target class to be proxied, indicating that the proxy should be castable to the given class.
Internally, an EmptyTargetSource
for the given target class will be used. The kind of proxy needed
will be determined on actual creation of the proxy.
This is a replacement for setting a "targetSource" or "target", for the case where we want a proxy based on a target class (which can be an interface or a concrete class) without having a fully capable TargetSource available.
Change the TargetSource used by this Advised object. Only works if the configuration isn't frozen.
targetSource | new TargetSource to use |
---|
As toString()
will normally be delegated to the target,
this returns the equivalent for the AOP proxy.
Invoked when advice has changed.
Copy the AOP configuration from the given AdvisedSupport object, but allow substitution of a fresh TargetSource and a given interceptor chain.
other | the AdvisedSupport object to take proxy configuration from |
---|---|
targetSource | the new TargetSource |
advisors | the Advisors for the chain |
Call this method on a new instance created by the no-arg constructor to create an independent copy of the configuration from the given object.
other | the AdvisedSupport object to copy configuration from |
---|
Allows uncontrolled access to the List
of Advisors
.
Use with care, and remember to refresh the advisor array
and fire advice changed events
when making any modifications.
Bring the array up to date with the list.