abstract class AutowireUtils
extends java.lang.Object
AbstractAutowireCapableBeanFactory
Modifier and Type | Class and Description |
---|---|
private static class |
AutowireUtils.ObjectFactoryDelegatingInvocationHandler
Reflective InvocationHandler for lazy access to the current target object.
|
Constructor and Description |
---|
AutowireUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isExcludedFromDependencyCheck(java.beans.PropertyDescriptor pd)
Determine whether the given bean property is excluded from dependency checks.
|
static boolean |
isSetterDefinedInInterface(java.beans.PropertyDescriptor pd,
java.util.Set<java.lang.Class<?>> interfaces)
Return whether the setter method of the given bean property is defined
in any of the given interfaces.
|
static java.lang.Object |
resolveAutowiringValue(java.lang.Object autowiringValue,
java.lang.Class<?> requiredType)
Resolve the given autowiring value against the given required type,
e.g.
|
static java.lang.Class<?> |
resolveReturnTypeForFactoryMethod(java.lang.reflect.Method method,
java.lang.Object[] args,
java.lang.ClassLoader classLoader)
Determine the target type for the generic return type of the given
generic factory method, where formal type variables are declared
on the given method itself.
|
static void |
sortConstructors(java.lang.reflect.Constructor<?>[] constructors)
Sort the given constructors, preferring public constructors and "greedy" ones with
a maximum number of arguments.
|
static void |
sortFactoryMethods(java.lang.reflect.Method[] factoryMethods)
Sort the given factory methods, preferring public methods and "greedy" ones
with a maximum of arguments.
|
public static void sortConstructors(java.lang.reflect.Constructor<?>[] constructors)
constructors
- the constructor array to sortpublic static void sortFactoryMethods(java.lang.reflect.Method[] factoryMethods)
factoryMethods
- the factory method array to sortpublic static boolean isExcludedFromDependencyCheck(java.beans.PropertyDescriptor pd)
This implementation excludes properties defined by CGLIB.
pd
- the PropertyDescriptor of the bean propertypublic static boolean isSetterDefinedInInterface(java.beans.PropertyDescriptor pd, java.util.Set<java.lang.Class<?>> interfaces)
pd
- the PropertyDescriptor of the bean propertyinterfaces
- the Set of interfaces (Class objects)public static java.lang.Object resolveAutowiringValue(java.lang.Object autowiringValue, java.lang.Class<?> requiredType)
ObjectFactory
value to its actual object result.autowiringValue
- the value to resolverequiredType
- the type to assign the result topublic static java.lang.Class<?> resolveReturnTypeForFactoryMethod(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.ClassLoader classLoader)
For example, given a factory method with the following signature,
if resolveReturnTypeForFactoryMethod()
is invoked with the reflected
method for creatProxy()
and an Object[]
array containing
MyService.class
, resolveReturnTypeForFactoryMethod()
will
infer that the target return type is MyService
.
public static <T> T createProxy(Class<T> clazz)
method
does not declare any formal type variablesnull
, if the length of the given arguments array is shorter
than the length of the formal argument list for the given
methodmethod
- the method to introspect (never null
)args
- the arguments that will be supplied to the method when it is
invoked (never null
)classLoader
- the ClassLoader to resolve class names against, if necessary
(never null
)null