public interface FactoryCollection extends Factory<Object,Configuration,Dependencies>
A collection of factories. It supports the full Factory interface but
instead of trying to instantiate objects from one factory, it automatically
forwards calls to all registered factories.
| Modifier and Type | Method and Description |
|---|---|
void |
register(Factory<?,?,?> factory)
Registers a new factory for this collection.
|
void |
replace(Configuration configuration,
Factory<?,?,?> factory)
Attempts to find a factory in this collection, which is capable of
instantiating the provided configuration.
|
canInstantiate, createvoid register(Factory<?,?,?> factory)
Registers a new factory for this collection.
If a
The collection will always use the first factory registered to
instantate objects. Configuration compatible with this factory is passed to
subsequent calls of FactoryCollection#create(Configuration,
Dependencies), this factory will be used to instantiate the object.
factory - The factory to be added to the collection.void replace(Configuration configuration, Factory<?,?,?> factory)
Attempts to find a factory in this collection, which is capable of instantiating the provided configuration.
If such a factory is found, it is replaced with the provided factory.
factory - Copyright © 2018. All rights reserved.