public class CollectionFactoryManagerImpl extends AbstractLoggableComponent implements CollectionFactoryManager
CollectionFactoryManager
interface.Modifier and Type | Field and Description |
---|---|
private Map<Class<? extends Collection>,CollectionFactory> |
collectionFactoryMap |
private static CollectionFactoryManager |
instance |
private Map<Class<? extends Map>,MapFactory> |
mapFactoryMap |
Constructor and Description |
---|
CollectionFactoryManagerImpl()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doInitialize()
This method performs the actual
initialization . |
<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 . |
createLogger, getLogger
doInitialized, getInitializationState, initialize
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()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
public static CollectionFactoryManager getInstance()
CollectionFactoryManager
implementation. Cdi.GET_INSTANCE
before using.public <C extends Collection> CollectionFactory<C> getCollectionFactory(Class<C> collectionType)
CollectionFactoryManager
CollectionFactory
for the given collectionType
.getCollectionFactory
in interface CollectionFactoryManager
C
- 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)
CollectionFactoryManager
MapFactory
for the given mapType
.getMapFactory
in interface CollectionFactoryManager
MAP
- 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.Copyright © 2001–2016 mmm-Team. All rights reserved.