diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
index 59a7d09ace..79c134e7cf 100644
--- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
+++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
@@ -35,6 +35,7 @@ import org.springframework.util.ObjectUtils;
* @author Andy Clement
* @author Juergen Hoeller
* @author Phillip Webb
+ * @author Sam Brannen
* @since 3.0
*/
public class TypeDescriptor {
@@ -77,7 +78,8 @@ public class TypeDescriptor {
/**
* Create a new type descriptor from a {@link MethodParameter}.
- * Use this constructor when a source or target conversion point is a constructor parameter, method parameter, or method return value.
+ *
Use this constructor when a source or target conversion point is a
+ * constructor parameter, method parameter, or method return value.
* @param methodParameter the method parameter
*/
public TypeDescriptor(MethodParameter methodParameter) {
@@ -86,7 +88,7 @@ public class TypeDescriptor {
/**
* Create a new type descriptor from a {@link Field}.
- * Use this constructor when source or target conversion point is a field.
+ *
Use this constructor when a source or target conversion point is a field.
* @param field the field
*/
public TypeDescriptor(Field field) {
@@ -95,7 +97,8 @@ public class TypeDescriptor {
/**
* Create a new type descriptor from a {@link Property}.
- * Use this constructor when a source or target conversion point is a property on a Java class.
+ *
Use this constructor when a source or target conversion point is a
+ * property on a Java class.
* @param property the property
*/
public TypeDescriptor(Property property) {
@@ -105,8 +108,11 @@ public class TypeDescriptor {
/**
* Create a new type descriptor from the given type.
- * Use this to instruct the conversion system to convert an object to a specific target type, when no type location such as a method parameter or field is available to provide additional conversion context.
- * Generally prefer use of {@link #forObject(Object)} for constructing type descriptors from source objects, as it handles the null object case.
+ *
Use this to instruct the conversion system to convert an object to a
+ * specific target type, when no type location such as a method parameter or
+ * field is available to provide additional conversion context.
+ *
Generally prefer use of {@link #forObject(Object)} for constructing type
+ * descriptors from source objects, as it handles the {@code null} object case.
* @param type the class
* @return the type descriptor
*/
@@ -116,12 +122,15 @@ public class TypeDescriptor {
}
/**
- * Create a new type descriptor from a java.util.Collection type.
- * Useful for converting to typed Collections.
- * For example, a List<String> could be converted to a List<EmailAddress> by converting to a targetType built with this method.
- * The method call to construct such a TypeDescriptor would look something like: collection(List.class, TypeDescriptor.valueOf(EmailAddress.class));
+ * Create a new type descriptor from a {@link java.util.Collection} type.
+ *
Useful for converting to typed Collections.
+ *
For example, a {@code List} could be converted to a
+ * {@code List} by converting to a targetType built with this method.
+ * The method call to construct such a {@code TypeDescriptor} would look something
+ * like: {@code collection(List.class, TypeDescriptor.valueOf(EmailAddress.class));}
* @param collectionType the collection type, which must implement {@link Collection}.
- * @param elementTypeDescriptor a descriptor for the collection's element type, used to convert collection elements
+ * @param elementTypeDescriptor a descriptor for the collection's element type,
+ * used to convert collection elements
* @return the collection type descriptor
*/
public static TypeDescriptor collection(Class> collectionType, TypeDescriptor elementTypeDescriptor) {
@@ -132,9 +141,9 @@ public class TypeDescriptor {
}
/**
- * Create a new type descriptor from a java.util.Map type.
- * Useful for Converting to typed Maps.
- * For example, a Map<String, String> could be converted to a Map<Id, EmailAddress> by converting to a targetType built with this method:
+ * Create a new type descriptor from a {@link java.util.Map} type.
+ * Useful for converting to typed Maps.
+ *
For example, a Map<String, String> could be converted to a Map<Id, EmailAddress> by converting to a targetType built with this method:
* The method call to construct such a TypeDescriptor would look something like: map(Map.class, TypeDescriptor.valueOf(Id.class), TypeDescriptor.valueOf(EmailAddress.class));
* @param mapType the map type, which must implement {@link Map}
* @param keyTypeDescriptor a descriptor for the map's key type, used to convert map keys
@@ -149,12 +158,12 @@ public class TypeDescriptor {
}
/**
- * Create a new type descriptor as an array of the specified type. For example to
- * create a {@code Map[]} use
+ * Create a new type descriptor as an array of the specified type.
+ * For example to create a {@code Map[]} use
* {@code TypeDescriptor.array(TypeDescriptor.map(Map.class, TypeDescriptor.value(String.class), TypeDescriptor.value(String.class)))}.
* @param elementTypeDescriptor the {@link TypeDescriptor} of the array element or {@code null}
* @return an array {@link TypeDescriptor} or {@code null} if {@code elementTypeDescriptor} is {@code null}
- * @since 3.2
+ * @since 3.2.1
*/
public static TypeDescriptor array(TypeDescriptor elementTypeDescriptor) {
if(elementTypeDescriptor == null) {
@@ -166,17 +175,26 @@ public class TypeDescriptor {
/**
* Creates a type descriptor for a nested type declared within the method parameter.
- * For example, if the methodParameter is a List<String> and the nestingLevel is 1, the nested type descriptor will be String.class.
- * If the methodParameter is a List> and the nestingLevel is 2, the nested type descriptor will also be a String.class.
- * If the methodParameter is a Map and the nesting level is 1, the nested type descriptor will be String, derived from the map value.
- * If the methodParameter is a List