You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns true if objects of sourceType can be converted to the targetType.
45
-
* The TypeDescriptors provide additional context about the source and target locations where conversion would occur, often object fields or property locations.
46
-
* If this method returns true, it means {@link #convert(Object, TypeDescriptor, TypeDescriptor)} is capable of converting an instance of sourceType to targetType.
47
-
* Special note on collections, arrays, and maps types:
48
-
* For conversion between collection, array, and map types, this method will return 'true'
49
-
* even though a convert invocation may still generate a {@link ConversionException} if the underlying elements are not convertible.
50
-
* Callers are expected to handle this exceptional case when working with collections and maps.
51
-
* @param sourceType context about the source type to convert from (may be null if source is null)
46
+
* Return {@code true} if objects of {@code sourceType} can be converted to the {@code targetType}.
47
+
* The TypeDescriptors provide additional context about the source and target locations
48
+
* where conversion would occur, often object fields or property locations.
49
+
* <p>If this method returns {@code true}, it means {@link #convert(Object, TypeDescriptor, TypeDescriptor)}
50
+
* is capable of converting an instance of {@code sourceType} to {@code targetType}.
51
+
* <p>Special note on collections, arrays, and maps types:
52
+
* For conversion between collection, array, and map types, this method will return {@code true}
53
+
* even though a convert invocation may still generate a {@link ConversionException} if the
54
+
* underlying elements are not convertible. Callers are expected to handle this exceptional case
55
+
* when working with collections and maps.
56
+
* @param sourceType context about the source type to convert from
57
+
* (may be {@code null} if source is {@code null})
52
58
* @param targetType context about the target type to convert to (required)
53
-
* @return true if a conversion can be performed between the source and target types, false if not
54
-
* @throws IllegalArgumentException if targetType is null
59
+
* @return {@code true} if a conversion can be performed between the source and target types,
60
+
* {@code false} if not
61
+
* @throws IllegalArgumentException if {@code targetType} is {@code null}
* Convert the given {@code source} to the specified {@code targetType}.
60
67
* @param source the source object to convert (may be null)
61
68
* @param targetType the target type to convert to (required)
62
69
* @return the converted object, an instance of targetType
@@ -66,15 +73,17 @@ public interface ConversionService {
66
73
<T> Tconvert(Objectsource, Class<T> targetType);
67
74
68
75
/**
69
-
* Convert the source to targetType.
70
-
* The TypeDescriptors provide additional context about the source and target locations where conversion will occur, often object fields or property locations.
76
+
* Convert the given {@code source} to the specified {@code targetType}.
77
+
* The TypeDescriptors provide additional context about the source and target locations
78
+
* where conversion will occur, often object fields or property locations.
71
79
* @param source the source object to convert (may be null)
72
-
* @param sourceType context about the source type converting from (may be null if source is null)
80
+
* @param sourceType context about the source type to convert from
81
+
* (may be {@code null} if source is {@code null})
73
82
* @param targetType context about the target type to convert to (required)
74
-
* @return the converted object, an instance of {@link TypeDescriptor#getObjectType() targetType}</code>
83
+
* @return the converted object, an instance of {@link TypeDescriptor#getObjectType() targetType}
75
84
* @throws ConversionException if a conversion exception occurred
76
-
* @throws IllegalArgumentException if targetType is null
77
-
* @throws IllegalArgumentException if sourceType is null but source is not null
85
+
* @throws IllegalArgumentException if targetType is {@code null},
86
+
* or {@code sourceType} is {@code null} but source is not {@code null}
0 commit comments