public class CollectionFactoryManagerImpl extends AbstractComponent implements CollectionFactoryManager
CollectionFactoryManager interface.| Modifier and Type | Field and Description |
|---|---|
private static Class<?>[] |
CAPACITY_CONSTRUCTOR_ARGS |
private Map<Class<? extends Collection>,CollectionFactory> |
collectionFactoryMap |
private static CollectionFactoryManager |
instance |
private static org.slf4j.Logger |
LOG |
private Map<Class<? extends Map>,MapFactory> |
mapFactoryMap |
| Constructor and Description |
|---|
CollectionFactoryManagerImpl()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<C extends Collection> |
create(Class<C> type)
This method creates a
Collection implementing the given type. |
<C extends Collection> |
create(Class<C> type,
int capacity)
This method creates a
Collection implementing the given type. |
protected <C extends Collection<?>> |
create(Class<C> type,
Integer capacity) |
<C extends Map> |
createMap(Class<C> type)
This method creates a
Map implementing the given type. |
<C extends Map> |
createMap(Class<C> type,
int capacity)
This method creates a
Map implementing the given type. |
protected <C extends Map<?,?>> |
createMap(Class<C> type,
Integer capacity) |
protected void |
doInitialize() |
protected Class<? extends Collection> |
findCollectionInterface(Class<? extends Collection> type) |
protected Class<? extends Map> |
findMapInterface(Class<? extends Map> type) |
<C extends Collection> |
getCollectionFactory(Class<C> collectionType)
This method gets the
CollectionFactory for the given collectionType. |
static CollectionFactoryManager |
getInstance()
This method gets the singleton instance of this
CollectionFactoryManager implementation. |
<MAP extends Map> |
getMapFactory(Class<MAP> mapType)
This method gets the
MapFactory for the given mapType. |
protected CollectionFactory |
registerCollectionFactory(CollectionFactory factory)
This method registers the given
factory using its collection-interface. |
protected <COLLECTION extends Collection> |
registerCollectionFactory(CollectionFactory<? extends COLLECTION> factory,
Class<COLLECTION> collectionInterface)
This method registers the given
factory for the given collectionInterface. |
protected MapFactory |
registerMapFactory(MapFactory factory)
This method registers the given
factory using its map-interface. |
protected <MAP extends Map> |
registerMapFactory(MapFactory<? extends MAP> factory,
Class<MAP> mapInterface)
This method registers the given
factory for the given mapInterface. |
doInitialized, getInitializationState, initializeprivate static final org.slf4j.Logger LOG
private static final Class<?>[] CAPACITY_CONSTRUCTOR_ARGS
private static CollectionFactoryManager instance
private final Map<Class<? extends Collection>,CollectionFactory> collectionFactoryMap
private final Map<Class<? extends Map>,MapFactory> mapFactoryMap
public CollectionFactoryManagerImpl()
protected void doInitialize()
doInitialize in class AbstractComponentpublic static CollectionFactoryManager getInstance()
CollectionFactoryManager implementation. public <C extends Collection> CollectionFactory<C> getCollectionFactory(Class<C> collectionType)
CollectionFactoryManagerCollectionFactory for the given collectionType.getCollectionFactory in interface CollectionFactoryManagerC - is the generic type of the Collection.collectionType - is the type of the Collection. This should be the Collection
interface such as List.class.CollectionFactory for the given collectionType. The collectionType
has to be assignable from
CollectionFactory.getCollectionInterface() of the returned instance. Typically it will be
equal.public <MAP extends Map> MapFactory getMapFactory(Class<MAP> mapType)
CollectionFactoryManagerMapFactory for the given mapType.getMapFactory in interface CollectionFactoryManagerMAP - is the generic type of the Map.mapType - is the type of the Map. This should be the interface such as Map.class or
SortedMap.class.MapFactory for the given mapType. The mapType has to be
assignable from MapFactory.getMapInterface() of the
returned instance. Typically it will be equal.protected MapFactory registerMapFactory(MapFactory factory)
factory using its map-interface.factory - is the MapFactory to register.MapFactory that has been replaced with factory or null if none was replaced.registerMapFactory(MapFactory, Class)protected <MAP extends Map> MapFactory registerMapFactory(MapFactory<? extends MAP> factory, Class<MAP> mapInterface)
factory for the given mapInterface.MAP - is the generic type of the mapInterface.factory - is the MapFactory to register.mapInterface - is the interface of the associated Map. It has to be
assignable from the map-interface
of the given factory.MapFactory that was registered for the given mapInterface before and has now been
replaced with factory or null if none was replaced.protected CollectionFactory registerCollectionFactory(CollectionFactory factory)
factory using its collection-interface.factory - is the CollectionFactory to register.CollectionFactory that has been replaced with factory or null if none was
replaced.registerCollectionFactory(CollectionFactory, Class)protected <COLLECTION extends Collection> CollectionFactory registerCollectionFactory(CollectionFactory<? extends COLLECTION> factory, Class<COLLECTION> collectionInterface)
factory for the given collectionInterface.COLLECTION - is the generic type of the collectionInterface.factory - is the CollectionFactory to register.collectionInterface - is the interface of the associated Collection. It has to be
assignable from the collection-interface of the given factory.CollectionFactory that was registered for the given collectionInterface before and has
now been replaced with factory or null if none was replaced.public <C extends Collection> C create(Class<C> type)
CollectionFactoryManagerCollection implementing the given type.create in interface CollectionFactoryManagerC - is the generic type of the Collection.type - is the type of Collection to create. This is either an interface
(List, Set, Queue, etc.) or a non-abstract
implementation of a Collection.type.public <C extends Collection> C create(Class<C> type, int capacity)
CollectionFactoryManagerCollection implementing the given type.create in interface CollectionFactoryManagerC - is the generic type of the Collection.type - is the type of Collection to create. This is either an interface
(List, Set, Queue, etc.) or a non-abstract
implementation of a Collection.capacity - is the initial capacity of the Collection.type.protected <C extends Collection<?>> C create(Class<C> type, Integer capacity)
C - is the generic type of the collection.type - is the type of collection to create. This is either an interface (List,
Set, Queue, etc.) or a non-abstract implementation of a
Collection.capacity - is the initial capacity of the collection or null if unspecified.type.create(Class, int)protected Class<? extends Collection> findCollectionInterface(Class<? extends Collection> type)
type - Class reflecting the Collection.Collection interface
assignable from the given type.public <C extends Map> C createMap(Class<C> type)
CollectionFactoryManagerMap implementing the given type.createMap in interface CollectionFactoryManagerC - is the generic type of the Map.type - is the type of Map to create. This is either an interface (Map,
ConcurrentMap, NavigableMap, etc.) or a
non-abstract implementation of a Map.type.public <C extends Map> C createMap(Class<C> type, int capacity)
CollectionFactoryManagerMap implementing the given type.createMap in interface CollectionFactoryManagerC - is the generic type of the Map.type - is the type of Map to create. This is either an interface (Map,
ConcurrentMap, NavigableMap, etc.) or a
non-abstract implementation of a Map.capacity - is the initial capacity of the Map.type.protected <C extends Map<?,?>> C createMap(Class<C> type, Integer capacity)
C - is the generic type of the collection.type - is the type of collection to create. This is either an interface (List,
Set, Queue, etc.) or a non-abstract implementation of a
Collection.capacity - is the initial capacity of the collection or null if unspecified.type.create(Class, int)Copyright © 2001–2019 mmm-Team. All rights reserved.