36
36
import org .springframework .util .ObjectUtils ;
37
37
38
38
/**
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.
40
41
*
41
42
* @author Keith Donald
42
43
* @author Andy Clement
45
46
* @author Sam Brannen
46
47
* @author Stephane Nicoll
47
48
* @since 3.0
49
+ * @see ConversionService#canConvert(TypeDescriptor, TypeDescriptor)
50
+ * @see ConversionService#convert(Object, TypeDescriptor, TypeDescriptor)
48
51
*/
49
52
@ SuppressWarnings ("serial" )
50
53
public class TypeDescriptor implements Serializable {
@@ -323,9 +326,9 @@ public boolean isArray() {
323
326
* If this type is a {@code Stream}, returns the stream's component type.
324
327
* If this type is a {@link Collection} and it is parameterized, returns the Collection's element type.
325
328
* 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)
329
332
*/
330
333
public TypeDescriptor getElementTypeDescriptor () {
331
334
if (getResolvableType ().isArray ()) {
@@ -351,8 +354,7 @@ public TypeDescriptor getElementTypeDescriptor() {
351
354
* TypeDescriptor that is returned.
352
355
* @param element the collection or array element
353
356
* @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()
356
358
* @see #narrow(Object)
357
359
*/
358
360
public TypeDescriptor elementTypeDescriptor (Object element ) {
0 commit comments