From e07fcfeba25863d350fe53079f7ac99b32f63b3b Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Fri, 11 Dec 2009 16:55:33 +0000 Subject: [PATCH] javadoc git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2625 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../core/convert/support/ArrayToArrayConverter.java | 5 +++-- .../core/convert/support/ArrayToCollectionConverter.java | 7 +++++-- .../core/convert/support/ArrayToMapConverter.java | 5 +++-- .../core/convert/support/ArrayToObjectConverter.java | 5 +++-- .../core/convert/support/ArrayToStringConverter.java | 5 +++-- .../core/convert/support/CollectionToArrayConverter.java | 7 +++++-- .../convert/support/CollectionToCollectionConverter.java | 5 ++++- .../core/convert/support/CollectionToMapConverter.java | 7 ++++++- .../core/convert/support/CollectionToObjectConverter.java | 2 +- .../core/convert/support/CollectionToStringConverter.java | 2 +- 10 files changed, 34 insertions(+), 16 deletions(-) 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 ac929280095..d721304e570 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 087b77adbbe..0e630d910bd 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 6789ef66d36..347e2bc4b42 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 c3b8a5c6366..6f8bc42c570 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 722b2d466b7..cad162e2437 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 acaa18b802a..0e18f79daf2 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 8227385fb8e..084b32654fc 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 1c33db2117d..0d7fb4d1d21 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 1f9fcbcdf3b..5285095b4be 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 24a9a914b28..fc6f3c091f9 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