From 85471d05871ee8461b5f196ed26ffeb866d76cb2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 14 Nov 2019 18:31:32 +0100 Subject: [PATCH] Revise getElementTypeDescriptor javadoc (no IllegalStateException) Closes gh-23996 --- .../core/convert/TypeDescriptor.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 a5d1555730..07d48d7301 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 @@ -36,7 +36,8 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; /** - * Context about a type to convert from or to. + * Contextual descriptor about a type to convert from or to. + * Capable of representing arrays and generic collection types. * * @author Keith Donald * @author Andy Clement @@ -45,6 +46,8 @@ import org.springframework.util.ObjectUtils; * @author Sam Brannen * @author Stephane Nicoll * @since 3.0 + * @see ConversionService#canConvert(TypeDescriptor, TypeDescriptor) + * @see ConversionService#convert(Object, TypeDescriptor, TypeDescriptor) */ @SuppressWarnings("serial") public class TypeDescriptor implements Serializable { @@ -322,9 +325,9 @@ public class TypeDescriptor implements Serializable { * If this type is a {@code Stream}, returns the stream's component type. * If this type is a {@link Collection} and it is parameterized, returns the Collection's element type. * If the Collection is not parameterized, returns {@code null} indicating the element type is not declared. - * @return the array component type or Collection element type, or {@code null} if this type is a - * Collection but its element type is not parameterized - * @throws IllegalStateException if this type is not a {@code java.util.Collection} or array type + * @return the array component type or Collection element type, or {@code null} if this type is not + * an array type or a {@code java.util.Collection} or if its element type is not parameterized + * @see #elementTypeDescriptor(Object) */ @Nullable public TypeDescriptor getElementTypeDescriptor() { @@ -351,8 +354,7 @@ public class TypeDescriptor implements Serializable { * TypeDescriptor that is returned. * @param element the collection or array element * @return a element type descriptor, narrowed to the type of the provided element - * @throws IllegalStateException if this type is not a {@code java.util.Collection} - * or array type + * @see #getElementTypeDescriptor() * @see #narrow(Object) */ @Nullable -- GitLab