Spring Data Core

org.springframework.data.convert
Class CollectionFactory

java.lang.Object
  extended by org.springframework.data.convert.CollectionFactory

public class CollectionFactory
extends Object

Wrapper around Spring's CollectionFactory to add support for additional, sepcial collection types.

Author:
Oliver Gierke

Constructor Summary
CollectionFactory()
           
 
Method Summary
static Collection<Object> createCollection(Class<?> collectionType, Class<?> elementType, int size)
          Creates a new collection instance for the given collection type.
static Map<Object,Object> createMap(Class<?> mapType, Class<?> keyType, int size)
          Creates a new map instance for the given map type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionFactory

public CollectionFactory()
Method Detail

createCollection

public static Collection<Object> createCollection(Class<?> collectionType,
                                                  Class<?> elementType,
                                                  int size)
Creates a new collection instance for the given collection type. Might also inspect the element type in case special collections are requested (e.g. EnumSet).

Parameters:
collectionType - must not be null.
elementType - can be null.
size - the initial size of the collection to be created.
Returns:

createMap

public static Map<Object,Object> createMap(Class<?> mapType,
                                           Class<?> keyType,
                                           int size)
Creates a new map instance for the given map type. Might also inspect the key type in case special maps are requested (e.g. EnumMap).

Parameters:
mapType - must not be null.
keyType - can be null.
size - the initial size of the collection to be created.
Returns:

Spring Data Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.