SPR-9498: Add support for MultiValueMap to CollectionFactory

This turns out not to be the main problem exposed in SPR-9498
but it seems like a sensible addition anyway.
This commit is contained in:
Dave Syer
2012-06-14 11:42:23 +01:00
parent 8e754e9065
commit cd6f7de408
2 changed files with 13 additions and 0 deletions

View File

@@ -35,6 +35,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import org.springframework.util.LinkedCaseInsensitiveMap;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* Factory for collections, being aware of Java 5 and Java 6 collections.
@@ -305,6 +307,9 @@ public abstract class CollectionFactory {
else if (SortedMap.class.equals(mapType) || mapType.equals(navigableMapClass)) {
return new TreeMap();
}
else if (MultiValueMap.class.equals(mapType)) {
return new LinkedMultiValueMap();
}
else {
throw new IllegalArgumentException("Unsupported Map interface: " + mapType.getName());
}