parent
249d8379ae
commit
bf31f7178d
|
|
@ -57,7 +57,7 @@ public abstract class BeanUtils {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(BeanUtils.class);
|
private static final Log logger = LogFactory.getLog(BeanUtils.class);
|
||||||
|
|
||||||
// using WeakHashMap as a Set
|
// Effectively using a WeakHashMap as a Set
|
||||||
private static final Map<Class<?>, Boolean> unknownEditorTypes =
|
private static final Map<Class<?>, Boolean> unknownEditorTypes =
|
||||||
Collections.synchronizedMap(new WeakHashMap<Class<?>, Boolean>());
|
Collections.synchronizedMap(new WeakHashMap<Class<?>, Boolean>());
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ public abstract class BeanUtils {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo) throws BeanInstantiationException {
|
public static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo) throws BeanInstantiationException {
|
||||||
Assert.isAssignable(assignableTo, clazz);
|
Assert.isAssignable(assignableTo, clazz);
|
||||||
return (T)instantiateClass(clazz);
|
return (T) instantiateClass(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -281,7 +281,7 @@ public abstract class BeanUtils {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (targetMethod.getParameterTypes().length == numParams) {
|
if (targetMethod.getParameterTypes().length == numParams) {
|
||||||
// Additional candidate with same length.
|
// Additional candidate with same length
|
||||||
numMethodsFoundWithCurrentMinimumArgs++;
|
numMethodsFoundWithCurrentMinimumArgs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -317,10 +317,8 @@ public abstract class BeanUtils {
|
||||||
public static Method resolveSignature(String signature, Class<?> clazz) {
|
public static Method resolveSignature(String signature, Class<?> clazz) {
|
||||||
Assert.hasText(signature, "'signature' must not be empty");
|
Assert.hasText(signature, "'signature' must not be empty");
|
||||||
Assert.notNull(clazz, "Class must not be null");
|
Assert.notNull(clazz, "Class must not be null");
|
||||||
|
|
||||||
int firstParen = signature.indexOf("(");
|
int firstParen = signature.indexOf("(");
|
||||||
int lastParen = signature.indexOf(")");
|
int lastParen = signature.indexOf(")");
|
||||||
|
|
||||||
if (firstParen > -1 && lastParen == -1) {
|
if (firstParen > -1 && lastParen == -1) {
|
||||||
throw new IllegalArgumentException("Invalid method signature '" + signature +
|
throw new IllegalArgumentException("Invalid method signature '" + signature +
|
||||||
"': expected closing ')' for args list");
|
"': expected closing ')' for args list");
|
||||||
|
|
@ -336,7 +334,7 @@ public abstract class BeanUtils {
|
||||||
String methodName = signature.substring(0, firstParen);
|
String methodName = signature.substring(0, firstParen);
|
||||||
String[] parameterTypeNames =
|
String[] parameterTypeNames =
|
||||||
StringUtils.commaDelimitedListToStringArray(signature.substring(firstParen + 1, lastParen));
|
StringUtils.commaDelimitedListToStringArray(signature.substring(firstParen + 1, lastParen));
|
||||||
Class<?>[] parameterTypes = new Class[parameterTypeNames.length];
|
Class<?>[] parameterTypes = new Class<?>[parameterTypeNames.length];
|
||||||
for (int i = 0; i < parameterTypeNames.length; i++) {
|
for (int i = 0; i < parameterTypeNames.length; i++) {
|
||||||
String parameterTypeName = parameterTypeNames[i].trim();
|
String parameterTypeName = parameterTypeNames[i].trim();
|
||||||
try {
|
try {
|
||||||
|
|
@ -475,8 +473,7 @@ public abstract class BeanUtils {
|
||||||
*/
|
*/
|
||||||
public static MethodParameter getWriteMethodParameter(PropertyDescriptor pd) {
|
public static MethodParameter getWriteMethodParameter(PropertyDescriptor pd) {
|
||||||
if (pd instanceof GenericTypeAwarePropertyDescriptor) {
|
if (pd instanceof GenericTypeAwarePropertyDescriptor) {
|
||||||
return new MethodParameter(
|
return new MethodParameter(((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter());
|
||||||
((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter());
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new MethodParameter(pd.getWriteMethod(), 0);
|
return new MethodParameter(pd.getWriteMethod(), 0);
|
||||||
|
|
@ -545,9 +542,7 @@ public abstract class BeanUtils {
|
||||||
* @throws BeansException if the copying failed
|
* @throws BeansException if the copying failed
|
||||||
* @see BeanWrapper
|
* @see BeanWrapper
|
||||||
*/
|
*/
|
||||||
public static void copyProperties(Object source, Object target, Class<?> editable)
|
public static void copyProperties(Object source, Object target, Class<?> editable) throws BeansException {
|
||||||
throws BeansException {
|
|
||||||
|
|
||||||
copyProperties(source, target, editable, (String[]) null);
|
copyProperties(source, target, editable, (String[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,9 +560,7 @@ public abstract class BeanUtils {
|
||||||
* @throws BeansException if the copying failed
|
* @throws BeansException if the copying failed
|
||||||
* @see BeanWrapper
|
* @see BeanWrapper
|
||||||
*/
|
*/
|
||||||
public static void copyProperties(Object source, Object target, String... ignoreProperties)
|
public static void copyProperties(Object source, Object target, String... ignoreProperties) throws BeansException {
|
||||||
throws BeansException {
|
|
||||||
|
|
||||||
copyProperties(source, target, null, ignoreProperties);
|
copyProperties(source, target, null, ignoreProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue