Note that this method tries to set the constructor accessible if given a non-accessible (that is, non-public) constructor.
clazz class to instantiateBeanInstantiationException if the bean cannot be instantiatedNote that this method tries to set the constructor accessible if given a non-accessible (that is, non-public) constructor.
ctor the constructor to instantiateargs the constructor arguments to applyBeanInstantiationException if the bean cannot be instantiatedpublic static ObjectinstantiateClass(Constructor ctor, Object[] args) throws BeanInstantiationException {
Checks Class.getMethod first, falling back to
findDeclaredMethod. This allows to find public methods
without issues even in environments with restricted Java security settings.
clazz the class to checkmethodName the name of the method to findparamTypes the parameter types of the method to findnull if not foundjava.lang.Class.getMethod(java.lang.String,java.lang.Class[])findDeclaredMethod(java.lang.Class,java.lang.String,java.lang.Class[])Checks Class.getDeclaredMethod, cascading upwards to all superclasses.
clazz the class to checkmethodName the name of the method to findparamTypes the parameter types of the method to findnull if not foundjava.lang.Class.getDeclaredMethod(java.lang.String,java.lang.Class[])Checks Class.getMethods first, falling back to
findDeclaredMethodWithMinimalParameters. This allows to find public
methods without issues even in environments with restricted Java security settings.
clazz the class to checkmethodName the name of the method to findnull if not foundjava.lang.IllegalArgumentException if methods of the given name were found but
could not be resolved to a unique method with minimal parametersjava.lang.Class.getMethods()findDeclaredMethodWithMinimalParameters(java.lang.Class,java.lang.String)Method targetMethod = doFindMethodWithMinimalParameters(clazz.getDeclaredMethods(), methodName);
Checks Class.getDeclaredMethods, cascading upwards to all superclasses.
clazz the class to checkmethodName the name of the method to findnull if not foundjava.lang.IllegalArgumentException if methods of the given name were found but
could not be resolved to a unique method with minimal parametersjava.lang.Class.getDeclaredMethods()Method targetMethod = doFindMethodWithMinimalParameters(clazz.getDeclaredMethods(), methodName);
methods the methods to checkmethodName the name of the method to findnull if not foundjava.lang.IllegalArgumentException if methods of the given name were found but
could not be resolved to a unique method with minimal parametersmethodName[([arg_list])],
where arg_list is an optional, comma-separated list of fully-qualified
type names, and attempts to resolve that signature against the supplied Class.
When not supplying an argument list (methodName) the method whose name
matches and has the least number of parameters will be returned. When supplying an
argument type list, only the method whose name and argument types match will be returned.
Note then that methodName and methodName() are not
resolved in the same way. The signature methodName means the method called
methodName with the least number of arguments, whereas methodName()
means the method called methodName with exactly 0 arguments.
If no method can be found, then null is returned.
signature the method signature as String representationclazz the class to resolve the method signature againstfindMethod(java.lang.Class,java.lang.String,java.lang.Class[])findMethodWithMinimalParameters(java.lang.Class,java.lang.String)PropertyDescriptors of a given class.
clazz the Class to retrieve the PropertyDescriptors forPropertyDescriptors for the given classBeansException if PropertyDescriptor look failsPropertyDescriptors for the given property.
clazz the Class to retrieve the PropertyDescriptor forpropertyName the name of the propertynull if noneBeansException if PropertyDescriptor lookup failsPropertyDescriptor for the given method,
with the method either being the read method or the write method for
that bean property.
method the method to find a corresponding PropertyDescriptor fornull if noneBeansException if PropertyDescriptor lookup failsCompatible to the standard JavaBeans convention as implemented by
but isolated from the latter's
registered default editors for primitive types.
java.beans.PropertyEditorManager
targetType the type to find an editor fornull if none foundUsed to determine properties to check for a "simple" dependency-check.
clazz the type to checkorg.springframework.beans.factory.support.AbstractBeanDefinition.DEPENDENCY_CHECK_SIMPLEorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.checkDependencies(java.lang.String,org.springframework.beans.factory.support.AbstractBeanDefinition,java.beans.PropertyDescriptor[],org.springframework.beans.PropertyValues)return isSimpleValueType(clazz) || (clazz.isArray() && isSimpleValueType(clazz.getComponentType()));
ClassUtils.isAssignabletargetType the target typevalueType the value type that should be assigned to the target typeorg.springframework.util.ClassUtils.isAssignable(java.lang.Class,java.lang.Class)ClassUtils.isAssignableValuetype the target typevalue the value that should be assigned to the typeorg.springframework.util.ClassUtils.isAssignableValue(java.lang.Class,java.lang.Object)Note: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source the source beantarget the target beanBeansException if the copying failedBeanWrapperNote: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source the source beantarget the target beaneditable the class (or interface) to restrict property setting toBeansException if the copying failedBeanWrapperNote: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source the source beantarget the target beanignoreProperties array of property names to ignoreBeansException if the copying failedBeanWrapperNote: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
source the source beantarget the target beaneditable the class (or interface) to restrict property setting toignoreProperties array of property names to ignoreBeansException if the copying failedBeanWrapperprivate static voidcopyProperties(Object source, Object target, Class editable, String[] ignoreProperties)