Skip to content

Commit f190168

Browse files
committed
Revise getElementTypeDescriptor javadoc (no IllegalStateException)
Closes gh-23996
1 parent e1f9507 commit f190168

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 {
@@ -323,9 +326,9 @@ public boolean isArray() {
323326
* If this type is a {@code Stream}, returns the stream's component type.
324327
* If this type is a {@link Collection} and it is parameterized, returns the Collection's element type.
325328
* If the Collection is not parameterized, returns {@code null} indicating the element type is not declared.
326-
* @return the array component type or Collection element type, or {@code null} if this type is a
327-
* Collection but its element type is not parameterized
328-
* @throws IllegalStateException if this type is not a {@code java.util.Collection} or array type
329+
* @return the array component type or Collection element type, or {@code null} if this type is not
330+
* an array type or a {@code java.util.Collection} or if its element type is not parameterized
331+
* @see #elementTypeDescriptor(Object)
329332
*/
330333
public TypeDescriptor getElementTypeDescriptor() {
331334
if (getResolvableType().isArray()) {
@@ -351,8 +354,7 @@ public TypeDescriptor getElementTypeDescriptor() {
351354
* TypeDescriptor that is returned.
352355
* @param element the collection or array element
353356
* @return a element type descriptor, narrowed to the type of the provided element
354-
* @throws IllegalStateException if this type is not a {@code java.util.Collection}
355-
* or array type
357+
* @see #getElementTypeDescriptor()
356358
* @see #narrow(Object)
357359
*/
358360
public TypeDescriptor elementTypeDescriptor(Object element) {

0 commit comments

Comments
 (0)