diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java index ac929280095ca7875d0d35805215cf9ed8c212ae..d721304e570a7439ce95fbe27710eb9c09af331c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java @@ -25,8 +25,9 @@ import org.springframework.core.convert.converter.GenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts from a source array to a target array type. - * + * Converts an Array to another Array. + * First adapts the source array to a List, then delegates to {@link CollectionToArrayConverter} to perform the target array conversion. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java index 087b77adbbe7c3afe895d8e67951a5aa10643462..0e630d910bd7954cce22ae9c60f9075b19fc8260 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java @@ -30,8 +30,11 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.core.convert.converter.GenericConverter; /** - * Converts from an array to a collection. - * + * Converts an Array to a Collection. + * First, creates a new Collection of the requested targetType. + * Then adds each array element to the target collection. + * Will perform an element conversion from the source component type to the collection's parameterized type if necessary. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToMapConverter.java index 6789ef66d365199ea88ce027aa34e602699377c9..347e2bc4b421cbfdc801a8639f049a16c72c6d66 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToMapConverter.java @@ -26,8 +26,9 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts from an array to a Map. - * + * Converts an Array to a Map. + * First adapts the source Array to a List, then delegates to {@link CollectionToMapConverter} to perform the target Map conversion. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java index c3b8a5c636666842385dbedbc0ed7155f0897217..6f8bc42c570d6afe17cd82a7c157214f5cd675bb 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java @@ -25,8 +25,9 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts from an array to a single Object. - * + * Converts an Array to an Object by returning the first array element after converting it to the desired targetType. + * This implementation first adapts the source Array to a List, then delegates to {@link CollectionToObjectConverter} to perform the target Object conversion. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java index 722b2d466b79c60557ad3fbf7c71606ffb484bff..cad162e24370bc789ef4ae9544c59d67931c2a1c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java @@ -25,8 +25,9 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts from an array to a String. - * + * Converts an Array to a comma-delimited String. + * This implementation first adapts the source Array to a List, then delegates to {@link CollectionToStringConverter} to perform the target String conversion. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java index acaa18b802ab3c276c00fcf2feede657c0c88224..0e18f79daf282dab103af9122a0a1311a7cae6e1 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java @@ -31,8 +31,11 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.core.convert.converter.GenericConverter; /** - * Converts from a Collection to an array. - * + * Converts a Collection to an Array. + * First, creates a new Array of the requested targetType with a length equal to the size of the source Collection. + * Then sets collection element into the array. + * Will perform an element conversion from the collection's parameterized type to the array's component type if necessary. + * * @author Keith Donald * @since 3.0 */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java index 8227385fb8e7b4b3676aad83ba6ad91e104421dd..084b32654fc35202e60e09e33b51af352f0d1507 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java @@ -28,7 +28,10 @@ import org.springframework.core.convert.converter.GenericConverter; import static org.springframework.core.convert.support.ConversionUtils.*; /** - * Converts from a source Collection to target Collection type. + * Converts from a Collection to another Collection. + * First, creates a new Collection of the requested targetType with a size equal to the size of the source Collection. + * Then copies each element in the source collection to the target collection. + * Will perform an element conversion from the source collection's parameterized type to the target collection's parameterized type if necessary. * * @author Keith Donald * @since 3.0 diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java index 1c33db2117d437407de73c76ffd4f179c1515774..0d7fb4d1d21c43671ab01b8585a1c31075d6c9ab 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java @@ -28,7 +28,12 @@ import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; /** - * Converts from a Collection to a Map. + * Converts a Collection to a Map. + * First, creates a new Map of the requested targetType with a size equal to the size of the source Collection. + * Then copies each element in the source collection to the target map. + * During the copy process, if an element is a String, that String is treated as a "key=value" pair, parsed, and a corresponding entry is created in the target map. + * If an element is another Object type, an entry is created in the targetMap with this Object as both the key and value. + * Will perform an element conversion from the source collection's parameterized type to the target map's parameterized K,V types if necessary. * * @author Keith Donald * @since 3.0 diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java index 1f9fcbcdf3b5ae4369a0873c3316b81b2ca48955..5285095b4be2696d5ab34a42690f795c1ae61943 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java @@ -28,7 +28,7 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.core.convert.converter.GenericConverter; /** - * Converts from a Collection to a single Object. + * Converts a Collection to an Object by returning the first collection element after converting it to the desired targetType. * * @author Keith Donald * @since 3.0 diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToStringConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToStringConverter.java index 24a9a914b28360494968a873be4f135d301f8014..fc6f3c091f9c78936efeb1c9489b636939065820 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToStringConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToStringConverter.java @@ -29,7 +29,7 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.core.convert.converter.GenericConverter; /** - * Converts from a Collection to a String. + * Converts a Collection to a comma-delimited String. * * @author Keith Donald * @since 3.0