Uses CGLIB to generate subclasses dynamically if methods need to be overridden by the container to implement Method Injection.
| Modifier and Type | Class and Description |
|---|---|
| private static class | CglibSubclassingInstantiationStrategy.CglibIdentitySupport
Class providing hashCode and equals methods required by CGLIB to ensure that CGLIB doesn't generate a distinct class per bean. |
| private static class | CglibSubclassingInstantiationStrategy.CglibSubclassCreator
An inner class created for historical reasons to avoid external CGLIB dependency in Spring versions earlier than 3.2. |
| private static class | CglibSubclassingInstantiationStrategy.LookupOverrideMethodInterceptor
CGLIB MethodInterceptor to override methods, replacing them with an implementation that returns a bean looked up in the container. |
| private static class | CglibSubclassingInstantiationStrategy.MethodOverrideCallbackFilter
CGLIB callback for filtering method interception behavior. |
| private static class | CglibSubclassingInstantiationStrategy.ReplaceOverrideMethodInterceptor
CGLIB MethodInterceptor to override methods, replacing them with a call to a generic MethodReplacer. |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | LOOKUP_OVERRIDE
Index in the CGLIB callback array for a method that should be overridden to provide method lookup. |
| private static final int | METHOD_REPLACER
Index in the CGLIB callback array for a method that should be overridden using generic method replacer functionality. |
| private static final int | PASSTHROUGH
Index in the CGLIB callback array for passthrough behavior, in which case the subclass won't override the original class. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Class | getActualBeanClass(RootBeanDefinition bd, String beanName, BeanFactory owner)
Overrides default org. |
| protected Object | instantiateWithMethodInjection(RootBeanDefinition bd, String beanName, BeanFactory owner)
Overrides org. |
| protected Object | instantiateWithMethodInjection(RootBeanDefinition bd, String beanName, BeanFactory owner, Constructor<?> ctor, Object... args)
Overrides org. |
| LOOKUP_OVERRIDE | back to summary |
|---|---|
| private static final int LOOKUP_OVERRIDE Index in the CGLIB callback array for a method that should be overridden to provide method lookup. | |
| METHOD_REPLACER | back to summary |
|---|---|
| private static final int METHOD_REPLACER Index in the CGLIB callback array for a method that should be overridden using generic method replacer functionality. | |
| PASSTHROUGH | back to summary |
|---|---|
| private static final int PASSTHROUGH Index in the CGLIB callback array for passthrough behavior, in which case the subclass won't override the original class. | |
| CglibSubclassingInstantiationStrategy | back to summary |
|---|---|
| public CglibSubclassingInstantiationStrategy() | |
| getActualBeanClass | back to summary |
|---|---|
| public Class Overrides default org. Doc from org. Determine the actual class for the given bean definition, as instantiated at runtime.
| |
| instantiateWithMethodInjection | back to summary |
|---|---|
| protected Object instantiateWithMethodInjection(RootBeanDefinition bd, String beanName, BeanFactory owner) Overrides org. Doc from org. Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition. Instantiation should use a no-arg constructor.
| |
| instantiateWithMethodInjection | back to summary |
|---|---|
| protected Object instantiateWithMethodInjection(RootBeanDefinition bd, String beanName, BeanFactory owner, Constructor<?> ctor, Object... args) Overrides org. Doc from org. Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition. Instantiation should use the given constructor and parameters.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final RootBeanDefinition |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public RootBeanDefinition | |
| public int |
| beanDefinition | back to summary |
|---|---|
| private final RootBeanDefinition beanDefinition | |
| CglibIdentitySupport | back to summary |
|---|---|
| public CglibIdentitySupport(RootBeanDefinition beanDefinition) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getBeanDefinition | back to summary |
|---|---|
| public RootBeanDefinition getBeanDefinition() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| Modifier and Type | Field and Description |
|---|---|
| private final RootBeanDefinition | |
| private static final Class | |
| private final BeanFactory |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Class | createEnhancedSubclass(RootBeanDefinition beanDefinition)
Create an enhanced subclass of the bean class for the provided bean definition, using CGLIB. |
| public Object | Returns: new instance of the dynamically generated subclassconstructor to use. If this is ctor, Object... null, use the
no-arg constructor (no parameterization, or Setter Injection)arguments to use for the constructor.
Ignored if the args)ctor parameter is null.Create a new instance of a dynamically generated subclass implementing the required lookups. |
| beanDefinition | back to summary |
|---|---|
| private final RootBeanDefinition beanDefinition | |
| CALLBACK_TYPES | back to summary |
|---|---|
| private static final Class<?>[] CALLBACK_TYPES | |
| owner | back to summary |
|---|---|
| private final BeanFactory owner | |
| CglibSubclassCreator | back to summary |
|---|---|
| pack-priv CglibSubclassCreator(RootBeanDefinition beanDefinition, BeanFactory owner) | |
| createEnhancedSubclass | back to summary |
|---|---|
| public Class Create an enhanced subclass of the bean class for the provided bean definition, using CGLIB. | |
| instantiate | back to summary |
|---|---|
| public Object instantiate(Constructor<?> ctor, Object... args) Create a new instance of a dynamically generated subclass implementing the required lookups.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final BeanFactory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | intercept(Object
"this", the enhanced object obj, Method intercepted Method method, Object[] argument array; primitive types are wrapped args, MethodProxy used to invoke super (non-intercepted method); may be called
as many times as needed mp)Implements org. |
| owner | back to summary |
|---|---|
| private final BeanFactory owner | |
| LookupOverrideMethodInterceptor | back to summary |
|---|---|
| public LookupOverrideMethodInterceptor(RootBeanDefinition beanDefinition, BeanFactory owner) | |
| intercept | back to summary |
|---|---|
| public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable Implements org. Doc from org. All generated proxied methods call this method instead of the original method. The original method may either be invoked by normal reflection using the Method object, or by using the MethodProxy (faster).
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | accept(Method
the intercepted method method)Implements org. |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| MethodOverrideCallbackFilter | back to summary |
|---|---|
| public MethodOverrideCallbackFilter(RootBeanDefinition beanDefinition) | |
| accept | back to summary |
|---|---|
| public int accept(Method method) Implements org. Doc from org. Map a method to a callback.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final BeanFactory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | intercept(Object
"this", the enhanced object obj, Method intercepted Method method, Object[] argument array; primitive types are wrapped args, MethodProxy used to invoke super (non-intercepted method); may be called
as many times as needed mp)Implements org. |
| owner | back to summary |
|---|---|
| private final BeanFactory owner | |
| ReplaceOverrideMethodInterceptor | back to summary |
|---|---|
| public ReplaceOverrideMethodInterceptor(RootBeanDefinition beanDefinition, BeanFactory owner) | |
| intercept | back to summary |
|---|---|
| public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable Implements org. Doc from org. All generated proxied methods call this method instead of the original method. The original method may either be invoked by normal reflection using the Method object, or by using the MethodProxy (faster).
| |