private Object convertCollectionInternal( Class<?> collectionClass, Type targetElementType, Iterable<?> sourceObject, Action<? super SourceObjectMapping> mapping) { Collection<Object> convertedElements = collectionMapper.createEmptyCollection(collectionClass); convertCollectionInternal(convertedElements, targetElementType, sourceObject, mapping); if (collectionClass.equals(DomainObjectSet.class)) { return new ImmutableDomainObjectSet(convertedElements); } else { return convertedElements; } }
private Map<Object, Object> convertMap( Class<?> mapClass, Type targetKeyType, Type targetValueType, Map<?, ?> sourceObject, Action<? super SourceObjectMapping> mapping) { Map<Object, Object> convertedElements = collectionMapper.createEmptyMap(mapClass); for (Map.Entry<?, ?> entry : sourceObject.entrySet()) { convertedElements.put( convert(targetKeyType, entry.getKey(), mapping), convert(targetValueType, entry.getValue(), mapping)); } return convertedElements; }