added call to applyIndexedObject to build nested source element type descriptor from element value
This commit is contained in:
@@ -64,7 +64,7 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter {
|
|||||||
Object array = Array.newInstance(targetType.getElementType(), sourceCollection.size());
|
Object array = Array.newInstance(targetType.getElementType(), sourceCollection.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Object sourceElement : sourceCollection) {
|
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);
|
Array.set(array, i++, targetElement);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ final class CollectionToCollectionConverter implements ConditionalGenericConvert
|
|||||||
}
|
}
|
||||||
Collection target = CollectionFactory.createCollection(targetType.getType(), sourceCollection.size());
|
Collection target = CollectionFactory.createCollection(targetType.getType(), sourceCollection.size());
|
||||||
for (Object sourceElement : sourceCollection) {
|
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);
|
target.add(targetElement);
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class CollectionToObjectConverter implements ConditionalGenericConverter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Object firstElement = sourceCollection.iterator().next();
|
Object firstElement = sourceCollection.iterator().next();
|
||||||
return this.conversionService.convert(firstElement, sourceType.getElementTypeDescriptor(), targetType);
|
return this.conversionService.convert(firstElement, sourceType.getElementTypeDescriptor().applyIndexedObject(firstElement), targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,8 @@ final class MapToMapConverter implements ConditionalGenericConverter {
|
|||||||
Map.Entry sourceMapEntry = (Map.Entry) entry;
|
Map.Entry sourceMapEntry = (Map.Entry) entry;
|
||||||
Object sourceKey = sourceMapEntry.getKey();
|
Object sourceKey = sourceMapEntry.getKey();
|
||||||
Object sourceValue = sourceMapEntry.getValue();
|
Object sourceValue = sourceMapEntry.getValue();
|
||||||
Object targetKey = this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor(), targetType.getMapKeyTypeDescriptor());
|
Object targetKey = this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor().applyIndexedObject(sourceKey), targetType.getMapKeyTypeDescriptor());
|
||||||
Object targetValue = this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor(), targetType.getMapValueTypeDescriptor());
|
Object targetValue = this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor().applyIndexedObject(sourceValue), targetType.getMapValueTypeDescriptor());
|
||||||
targetMap.put(targetKey, targetValue);
|
targetMap.put(targetKey, targetValue);
|
||||||
}
|
}
|
||||||
return targetMap;
|
return targetMap;
|
||||||
|
|||||||
Reference in New Issue
Block a user