diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
index 628ee8e78a5..16992e2e16b 100644
--- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
+++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
* @return the type of the wrapped bean instance,
* or {@code null} if no wrapped object has been set
*/
- Class getWrappedClass();
+ Class> getWrappedClass();
/**
* Obtain the PropertyDescriptors for the wrapped object
@@ -79,11 +79,13 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
PropertyDescriptor getPropertyDescriptor(String propertyName) throws InvalidPropertyException;
/**
- * Set whether this BeanWrapper should attempt to "auto-grow" a nested path that contains a null value.
- *
If "true", a null path location will be populated with a default object value and traversed
- * instead of resulting in a {@link NullValueInNestedPathException}. Turning this flag on also
- * enables auto-growth of collection elements when accessing an out-of-bounds index.
- *
Default is "false" on a plain BeanWrapper.
+ * Set whether this BeanWrapper should attempt to "auto-grow" a
+ * nested path that contains a {@code null} value.
+ *
If {@code true}, a {@code null} path location will be populated
+ * with a default object value and traversed instead of resulting in a
+ * {@link NullValueInNestedPathException}. Turning this flag on also enables
+ * auto-growth of collection elements when accessing an out-of-bounds index.
+ *
Default is {@code false} on a plain BeanWrapper.
*/
void setAutoGrowNestedPaths(boolean autoGrowNestedPaths);
diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
index df5def12a8d..48782fc084d 100644
--- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
+++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -223,7 +223,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
return this.object;
}
- public final Class getWrappedClass() {
+ public final Class> getWrappedClass() {
return (this.object != null ? this.object.getClass() : null);
}
@@ -246,7 +246,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
* Return the class of the root object at the top of the path of this BeanWrapper.
* @see #getNestedPath
*/
- public final Class getRootClass() {
+ public final Class> getRootClass() {
return (this.rootObject != null ? this.rootObject.getClass() : null);
}
@@ -304,7 +304,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
* Needs to be called when the target object changes.
* @param clazz the class to introspect
*/
- protected void setIntrospectionClass(Class clazz) {
+ protected void setIntrospectionClass(Class> clazz) {
if (this.cachedIntrospectionResults != null &&
!clazz.equals(this.cachedIntrospectionResults.getBeanClass())) {
this.cachedIntrospectionResults = null;
@@ -352,7 +352,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
@Override
- public Class getPropertyType(String propertyName) throws BeansException {
+ public Class> getPropertyType(String propertyName) throws BeansException {
try {
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
if (pd != null) {
@@ -366,7 +366,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
// Check to see if there is a custom editor,
// which might give an indication on the desired target type.
- Class editorType = guessPropertyTypeFromEditors(propertyName);
+ Class> editorType = guessPropertyTypeFromEditors(propertyName);
if (editorType != null) {
return editorType;
}
@@ -485,13 +485,13 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"No property '" + propertyName + "' found");
}
- return convertForProperty(propertyName, null, value, pd);
+ return convertForProperty(propertyName, null, value, new TypeDescriptor(property(pd)));
}
- private Object convertForProperty(String propertyName, Object oldValue, Object newValue, PropertyDescriptor pd)
+ private Object convertForProperty(String propertyName, Object oldValue, Object newValue, TypeDescriptor td)
throws TypeMismatchException {
- return convertIfNecessary(propertyName, oldValue, newValue, pd.getPropertyType(), new TypeDescriptor(property(pd)));
+ return convertIfNecessary(propertyName, oldValue, newValue, td.getType(), td);
}
private Property property(PropertyDescriptor pd) {
@@ -699,7 +699,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
return nestedBw.getPropertyValue(tokens);
}
- private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
+ @SuppressWarnings("unchecked")
+ private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
String propertyName = tokens.canonicalName;
String actualName = tokens.actualName;
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
@@ -766,20 +767,20 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
else if (value instanceof List) {
int index = Integer.parseInt(key);
- List list = (List) value;
+ List