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

pack-priv Class CglibAopProxy

extends Object
implements AopProxy, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.aop.framework.AopProxy
Known Direct Subclasses
org.springframework.aop.framework.ObjenesisCglibAopProxy
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.lang.reflect.Method, .Modifier, .UndeclaredThrowableException, java.util.ArrayList, .Collections, .List, .Map, .Set, .WeakHashMap, org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log, .LogFactory, org.springframework.aop.AopInvocationException, .RawTargetAccess, .TargetSource, org.springframework.aop.support.AopUtils, org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy, .CodeGenerationException, .SpringNamingPolicy, org.springframework.cglib.proxy.Callback, .CallbackFilter, .Dispatcher, .Enhancer, .Factory, .MethodInterceptor, .MethodProxy, .NoOp, org.springframework.core.KotlinDetector, .MethodParameter, .SmartClassLoader, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .CollectionUtils, .ObjectUtils, .ReflectionUtils

CGLIB-based AopProxy implementation for the Spring AOP framework.

Objects of this type should be obtained through proxy factories, configured by an AdvisedSupport object. This class is internal to Spring's AOP framework and need not be used directly by client code.

DefaultAopProxyFactory will automatically create CGLIB-based proxies if necessary, for example in case of proxying a target class (see the attendant javadoc for details).

Proxies created using this class are thread-safe if the underlying (target) class is thread-safe.

Authors
Rod Johnson, Rob Harrop, Juergen Hoeller, Ramnivas Laddad, Chris Beams, Dave Syer, Sebastien Deleuze
See Also
org.springframework.cglib.proxy.Enhancer, AdvisedSupport#setProxyTargetClass, DefaultAopProxyFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
CglibAopProxy.AdvisedDispatcher

Dispatcher for any methods declared on the Advised class.

private static class
CglibAopProxy.CglibMethodInvocation

Implementation of AOP Alliance MethodInvocation used by this AOP proxy.

private static class
CglibAopProxy.DynamicAdvisedInterceptor

General purpose AOP callback.

private static class
CglibAopProxy.DynamicUnadvisedExposedInterceptor

Interceptor for unadvised dynamic targets when the proxy needs exposing.

private static class
CglibAopProxy.DynamicUnadvisedInterceptor

Interceptor used to invoke a dynamic target without creating a method invocation or evaluating an advice chain.

private static class
CglibAopProxy.EqualsInterceptor

Dispatcher for the equals method.

private static class
CglibAopProxy.FixedChainStaticTargetInterceptor

Interceptor used specifically for advised methods on a frozen, static proxy.

private static class
CglibAopProxy.HashCodeInterceptor

Dispatcher for the hashCode method.

private static class
CglibAopProxy.ProxyCallbackFilter

CallbackFilter to assign Callbacks to methods.

public static class
CglibAopProxy.SerializableNoOp

Serializable replacement for CGLIB's NoOp interface.

private static class
CglibAopProxy.StaticDispatcher

Dispatcher for a static target.

private static class
CglibAopProxy.StaticUnadvisedExposedInterceptor

Method interceptor used for static targets with no advice chain, when the proxy is to be exposed.

private static class
CglibAopProxy.StaticUnadvisedInterceptor

Method interceptor used for static targets with no advice chain.

Field Summary

Modifier and TypeField and Description
protected final AdvisedSupport
advised

The configuration used to configure this proxy.

private final transient CglibAopProxy.AdvisedDispatcher
advisedDispatcher

Dispatcher used for methods on Advised.

private static final int
protected Object[]
protected Class<?>[]
private static final String
private static final int
private static final int
private transient Map<Method, Integer>
private transient int
private static final int
private static final int
private static final int
protected static final Log
logger

Logger available to subclasses; static to optimize serialization.

private static final int
private static final Map<Class<?>, Boolean>
validatedClasses

Keeps track of the Classes that we have validated for final methods.

Constructor Summary

AccessConstructor and Description
public
CglibAopProxy(AdvisedSupport
the AOP configuration as AdvisedSupport object
config
)

Create a new CglibAopProxy for the given AOP configuration.

Method Summary

Modifier and TypeMethod and Description
private Object
buildProxy(ClassLoader classLoader, boolean classOnly)

protected Enhancer
createEnhancer()

Creates the CGLIB Enhancer.

protected Class<?>
protected Object
private void
doValidateClass(Class<?> proxySuperClass, ClassLoader proxyClassLoader, Set<Class<?>> ifcs)

Checks for final methods on the given Class, as well as package-visible methods across ClassLoaders, and writes warnings to the log for each one found.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private Callback[]
getCallbacks(Class<?> rootClass)

public Object
getProxy()

Implements org.springframework.aop.framework.AopProxy.getProxy.

Create a new proxy object.

public Object
getProxy(ClassLoader
the class loader to create the proxy with (or null for the low-level proxy facility's default)
classLoader
)

Implements org.springframework.aop.framework.AopProxy.getProxy.

Create a new proxy object.

public Class<?>
getProxyClass(ClassLoader
the class loader to create the proxy class with (or null for the low-level proxy facility's default)
classLoader
)

Implements org.springframework.aop.framework.AopProxy.getProxyClass.

Determine the proxy class.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private static boolean
implementsInterface(Method method, Set<Class<?>> ifcs)

Check whether the given method is declared on any of the given interfaces.

private static Object
processReturnType(Object proxy, Object target, Method method, Object[] arguments, Object returnValue)

Process a return value.

public void
setConstructorArguments(Object[]
the constructor argument values
constructorArgs
,
Class<?>[]
the constructor argument types
constructorArgTypes
)

Set constructor arguments to use for creating the proxy.

private void
validateClassIfNecessary(Class<?> proxySuperClass, ClassLoader proxyClassLoader)

Checks to see whether the supplied Class has already been validated and validates it if not.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait