Browse Source

Revise getElementTypeDescriptor javadoc (no IllegalStateException)

Closes gh-23996
pull/24047/head
Juergen Hoeller 5 years ago
parent
commit
830f81210f
  1. 14
      spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

14
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; 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 Keith Donald
* @author Andy Clement * @author Andy Clement
@ -45,6 +46,8 @@ import org.springframework.util.ObjectUtils;
* @author Sam Brannen * @author Sam Brannen
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 3.0 * @since 3.0
* @see ConversionService#canConvert(TypeDescriptor, TypeDescriptor)
* @see ConversionService#convert(Object, TypeDescriptor, TypeDescriptor)
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class TypeDescriptor implements Serializable { 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 {@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 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. * 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 * @return the array component type or Collection element type, or {@code null} if this type is not
* Collection but its element type is not parameterized * an array type or a {@code java.util.Collection} or if its element type is not parameterized
* @throws IllegalStateException if this type is not a {@code java.util.Collection} or array type * @see #elementTypeDescriptor(Object)
*/ */
@Nullable @Nullable
public TypeDescriptor getElementTypeDescriptor() { public TypeDescriptor getElementTypeDescriptor() {
@ -351,8 +354,7 @@ public class TypeDescriptor implements Serializable {
* TypeDescriptor that is returned. * TypeDescriptor that is returned.
* @param element the collection or array element * @param element the collection or array element
* @return a element type descriptor, narrowed to the type of the provided 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} * @see #getElementTypeDescriptor()
* or array type
* @see #narrow(Object) * @see #narrow(Object)
*/ */
@Nullable @Nullable

Loading…
Cancel
Save