From bb4aa9cc39c67de1374e7e0214dc96af85bedabb Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Fri, 7 Jan 2011 04:41:21 +0000 Subject: [PATCH] added call to applyIndexedObject to build nested source element type descriptor from element value --- .../core/convert/support/CollectionToArrayConverter.java | 2 +- .../core/convert/support/CollectionToCollectionConverter.java | 2 +- .../core/convert/support/CollectionToObjectConverter.java | 2 +- .../core/convert/support/MapToMapConverter.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) 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 36e084ad951..a677f518bf6 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 @@ -64,7 +64,7 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter { Object array = Array.newInstance(targetType.getElementType(), sourceCollection.size()); int i = 0; for (Object sourceElement : sourceCollection) { - Object targetElement = this.conversionService.convert(sourceElement, sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor()); + Object targetElement = this.conversionService.convert(sourceElement, sourceType.getElementTypeDescriptor().applyIndexedObject(sourceElement), targetType.getElementTypeDescriptor()); Array.set(array, i++, targetElement); } return array; 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 2e2fcdc7520..1451376409c 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 @@ -67,7 +67,7 @@ final class CollectionToCollectionConverter implements ConditionalGenericConvert } Collection target = CollectionFactory.createCollection(targetType.getType(), sourceCollection.size()); for (Object sourceElement : sourceCollection) { - Object targetElement = this.conversionService.convert(sourceElement, sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor()); + Object targetElement = this.conversionService.convert(sourceElement, sourceType.getElementTypeDescriptor().applyIndexedObject(sourceElement), targetType.getElementTypeDescriptor()); target.add(targetElement); } return target; 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 d5785b2df56..acd947be56a 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 @@ -59,7 +59,7 @@ final class CollectionToObjectConverter implements ConditionalGenericConverter { return null; } Object firstElement = sourceCollection.iterator().next(); - return this.conversionService.convert(firstElement, sourceType.getElementTypeDescriptor(), targetType); + return this.conversionService.convert(firstElement, sourceType.getElementTypeDescriptor().applyIndexedObject(firstElement), targetType); } } \ No newline at end of file diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java index 6d675d67b00..95dd66c64f8 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java @@ -75,8 +75,8 @@ final class MapToMapConverter implements ConditionalGenericConverter { Map.Entry sourceMapEntry = (Map.Entry) entry; Object sourceKey = sourceMapEntry.getKey(); Object sourceValue = sourceMapEntry.getValue(); - Object targetKey = this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor(), targetType.getMapKeyTypeDescriptor()); - Object targetValue = this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor(), targetType.getMapValueTypeDescriptor()); + Object targetKey = this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor().applyIndexedObject(sourceKey), targetType.getMapKeyTypeDescriptor()); + Object targetValue = this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor().applyIndexedObject(sourceValue), targetType.getMapValueTypeDescriptor()); targetMap.put(targetKey, targetValue); } return targetMap;