Skip to content

Commit 41072e3

Browse files
committed
Revise getElementTypeDescriptor javadoc (no IllegalStateException)
Closes gh-23996
1 parent a20d7fa commit 41072e3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
import org.springframework.util.ObjectUtils;
3737

3838
/**
39-
* Context about a type to convert from or to.
39+
* Contextual descriptor about a type to convert from or to.
40+
* Capable of representing arrays and generic collection types.
4041
*
4142
* @author Keith Donald
4243
* @author Andy Clement
@@ -45,6 +46,8 @@
4546
* @author Sam Brannen
4647
* @author Stephane Nicoll
4748
* @since 3.0
49+
* @see ConversionService#canConvert(TypeDescriptor, TypeDescriptor)
50+
* @see ConversionService#convert(Object, TypeDescriptor, TypeDescriptor)
4851
*/
4952
@SuppressWarnings("serial")
5053
public class TypeDescriptor implements Serializable {
@@ -321,9 +324,9 @@ public boolean isArray() {
321324
* If this type is a {@code Stream}, returns the stream's component type.
322325
* If this type is a {@link Collection} and it is parameterized, returns the Collection's element type.
323326
* If the Collection is not parameterized, returns {@code null} indicating the element type is not declared.
324-
* @return the array component type or Collection element type, or {@code null} if this type is a
325-
* Collection but its element type is not parameterized
326-
* @throws IllegalStateException if this type is not a {@code java.util.Collection} or array type
327+
* @return the array component type or Collection element type, or {@code null} if this type is not
328+
* an array type or a {@code java.util.Collection} or if its element type is not parameterized
329+
* @see #elementTypeDescriptor(Object)
327330
*/
328331
@Nullable
329332
public TypeDescriptor getElementTypeDescriptor() {
@@ -350,8 +353,7 @@ public TypeDescriptor getElementTypeDescriptor() {
350353
* TypeDescriptor that is returned.
351354
* @param element the collection or array element
352355
* @return a element type descriptor, narrowed to the type of the provided element
353-
* @throws IllegalStateException if this type is not a {@code java.util.Collection}
354-
* or array type
356+
* @see #getElementTypeDescriptor()
355357
* @see #narrow(Object)
356358
*/
357359
@Nullable

0 commit comments

Comments
 (0)