Top Description Inners Fields Constructors Methods
org.springframework.aop.framework

public Class AdvisedSupport

extends ProxyConfig
implements Advised
Class Inheritance
All Implemented Interfaces
org.springframework.aop.framework.Advised, org.springframework.aop.TargetClassAware
Known Direct Subclasses
org.springframework.aop.framework.ProxyCreatorSupport
Imports
java.io.IOException, .ObjectInputStream, java.lang.reflect.Method, java.util.ArrayList, .Arrays, .Collection, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.aopalliance.aop.Advice, org.springframework.aop.Advisor, .DynamicIntroductionAdvice, .IntroductionAdvisor, .IntroductionInfo, .Pointcut, .PointcutAdvisor, .TargetSource, org.springframework.aop.support.DefaultIntroductionAdvisor, .DefaultPointcutAdvisor, org.springframework.aop.target.EmptyTargetSource, .SingletonTargetSource, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .CollectionUtils, .ObjectUtils

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.

Authors
Rod Johnson, Juergen Hoeller, Sam Brannen
See Also
org.springframework.aop.framework.AopProxy

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AdvisedSupport.AdvisorKeyEntry

Stub for an Advisor instance that is just needed for key purposes, allowing for efficient equals and hashCode comparisons against the advice class and the pointcut.

private static class
AdvisedSupport.MethodCacheKey

Simple wrapper class around a Method.

Field Summary

Modifier and TypeField and Description
private AdvisorChainFactory
advisorChainFactory

The AdvisorChainFactory to use.

private List<Advisor>
advisorKey

List of minimal AdvisorKeyEntry instances, to be assigned to the advisors field on reduction.

private List<Advisor>
advisors

List of Advisors.

private transient volatile List<Object>
cachedInterceptors

Cache with shared interceptors which are not method-specific.

public static final TargetSource
EMPTY_TARGET_SOURCE

Canonical TargetSource when there's no target, and behavior is supplied by the advisors.

private List<Class<?>>
interfaces

Interfaces to be implemented by the proxy.

private transient Map<AdvisedSupport.MethodCacheKey, List<Object>>
methodCache

Cache with Method as key and advisor chain List as value.

private boolean
preFiltered

Whether the Advisors are already filtered for the specific target class.

pack-priv transient volatile Object
proxyMetadataCache

Optional field for AopProxy implementations to store metadata in. Used by JdkDynamicAopProxy.

private static final long
serialVersionUID

Hides org.springframework.aop.framework.ProxyConfig.serialVersionUID.

use serialVersionUID from Spring 2.0 for interoperability.
pack-priv TargetSource
targetSource

Package-protected to allow direct access for efficiency.

Inherited from org.springframework.aop.framework.ProxyConfig:
exposeProxyopaque

Constructor Summary

AccessConstructor and Description
public
AdvisedSupport()

No-arg constructor for use as a JavaBean.

public
AdvisedSupport(Class<?>...
the proxied interfaces
interfaces
)

Create an AdvisedSupport instance with the given parameters.

Method Summary

Modifier and TypeMethod and Description
public void
addAdvice(Advice
the advice to add to the tail of the chain
advice
)

Implements org.springframework.aop.framework.Advised.addAdvice.

Add the given AOP Alliance advice to the tail of the advice (interceptor) chain.

public void
addAdvice(int
index from 0 (head)
pos
,
Advice
the advice to add at the specified position in the advice chain
advice
)

Implements org.springframework.aop.framework.Advised.addAdvice.

Cannot add introductions this way unless the advice implements IntroductionInfo.

public void
addAdvisor(Advisor
the advisor to add to the end of the chain
advisor
)

Implements org.springframework.aop.framework.Advised.addAdvisor.

Add an advisor at the end of the advisor chain.

public void
addAdvisor(int
position in chain (0 is head). Must be valid.
pos
,
Advisor
the advisor to add at the specified position in the chain
advisor
)

Implements org.springframework.aop.framework.Advised.addAdvisor.

Add an Advisor at the specified position in the chain.

private void
addAdvisorInternal(int pos, Advisor advisor)

public void
addAdvisors(Advisor...
the advisors to register
advisors
)

Add all the given advisors to this proxy configuration.

public void
addAdvisors(Collection<Advisor>
the advisors to register
advisors
)

Add all the given advisors to this proxy configuration.

public void
addInterface(Class<?>
the additional interface to proxy
intf
)

Add a new proxied interface.

protected void
adviceChanged()

Invoked when advice has changed.

public boolean

Returns:

whether this advice instance is included
adviceIncluded
(Advice
the advice to check inclusion of
advice
)

Is the given advice included in any advisor within this proxy configuration?

protected void
copyConfigurationFrom(AdvisedSupport
the AdvisedSupport object to copy configuration from
other
)

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.

protected void
copyConfigurationFrom(AdvisedSupport
the AdvisedSupport object to take proxy configuration from
other
,
TargetSource
the new TargetSource
targetSource
,
List<Advisor>
the Advisors for the chain
advisors
)

Copy the AOP configuration from the given AdvisedSupport object, but allow substitution of a fresh TargetSource and a given interceptor chain.

public int

Returns:

the count of the interceptors of this class or subclasses
countAdvicesOfType
(Class<?>
the advice class to check
adviceClass
)

Count advices of the given class.

public AdvisorChainFactory
getAdvisorChainFactory()

Return the advisor chain factory to use (never null).

public int
getAdvisorCount()

Overrides default org.springframework.aop.framework.Advised.getAdvisorCount.

Return the number of advisors applying to this proxy.

pack-priv Object
public final Advisor[]
getAdvisors()

Implements org.springframework.aop.framework.Advised.getAdvisors.

Return the advisors applying to this proxy.

protected final List<Advisor>
getAdvisorsInternal()

Allows uncontrolled access to the List of Advisors.

pack-priv AdvisedSupport
getConfigurationOnlyCopy()

Build a configuration-only copy of this AdvisedSupport, replacing the TargetSource.

public List<Object>

Returns:

a List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
getInterceptorsAndDynamicInterceptionAdvice
(Method
the proxied method
method
,
Class<?>
the target class
targetClass
)

Determine a list of org.aopalliance.intercept.MethodInterceptor objects for the given method, based on this configuration.

public Class<?>[]
getProxiedInterfaces()

Implements org.springframework.aop.framework.Advised.getProxiedInterfaces.

Return the interfaces proxied by the AOP proxy.

public Class<?>
getTargetClass()

Implements org.springframework.aop.TargetClassAware.getTargetClass.

Return the target class behind the implementing object (typically a proxy configuration or an actual proxy).

public TargetSource
getTargetSource()

Implements org.springframework.aop.framework.Advised.getTargetSource.

Return the TargetSource used by this Advised object.

public int
indexOf(Advisor
the advisor to search for
advisor
)

Implements org.springframework.aop.framework.Advised.indexOf.

Return the index (from 0) of the given advisor, or -1 if no such advisor applies to this proxy.

public int
indexOf(Advice
the AOP Alliance advice to search for
advice
)

Implements org.springframework.aop.framework.Advised.indexOf.

Return the index (from 0) of the given AOP Alliance Advice, or -1 if no such advice is an advice for this proxy.

public boolean
isInterfaceProxied(Class<?>
the interface to check
intf
)

Implements org.springframework.aop.framework.Advised.isInterfaceProxied.

Determine whether the given interface is proxied.

public boolean
isPreFiltered()

Implements org.springframework.aop.framework.Advised.isPreFiltered.

Return whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).

private void
pack-priv void
public boolean
removeAdvice(Advice
the advice to remove
advice
)

Implements org.springframework.aop.framework.Advised.removeAdvice.

Remove the Advisor containing the given advice.

public boolean
removeAdvisor(Advisor
the advisor to remove
advisor
)

Implements org.springframework.aop.framework.Advised.removeAdvisor.

Remove the given advisor.

public void
removeAdvisor(int
the index of advisor to remove
index
)

Implements org.springframework.aop.framework.Advised.removeAdvisor.

Remove the advisor at the given index.

public boolean

Returns:

true if the interface was removed; false if the interface was not found and hence could not be removed
removeInterface
(Class<?>
the interface to remove from the proxy
intf
)

Remove a proxied interface.

public boolean
replaceAdvisor(Advisor
the advisor to replace
a
,
Advisor
the advisor to replace it with
b
)

Implements org.springframework.aop.framework.Advised.replaceAdvisor.

Replace the given advisor.

public void
setAdvisorChainFactory(AdvisorChainFactory advisorChainFactory)

Set the advisor chain factory to use.

public void
setInterfaces(Class<?>... interfaces)

Set the interfaces to be proxied.

public void
setPreFiltered(boolean preFiltered)

Implements org.springframework.aop.framework.Advised.setPreFiltered.

Set whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).

public void
setTarget(Object target)

Set the given object as target.

public void
setTargetClass(Class<?> targetClass)

Set a target class to be proxied, indicating that the proxy should be castable to the given class.

public void
setTargetSource(TargetSource
new TargetSource to use
targetSource
)

Implements org.springframework.aop.framework.Advised.setTargetSource.

Change the TargetSource used by this Advised object.

public String
toProxyConfigString()

Implements org.springframework.aop.framework.Advised.toProxyConfigString.

As toString() will normally be delegated to the target, this returns the equivalent for the AOP proxy.

public String
toString()

Overrides org.springframework.aop.framework.ProxyConfig.toString.

For debugging/diagnostic use.

private void
Inherited from org.springframework.aop.framework.ProxyConfig:
copyFromisExposeProxyisFrozenisOpaqueisOptimizeisProxyTargetClasssetExposeProxysetFrozensetOpaquesetOptimizesetProxyTargetClass