Package io.fluentlenium.configuration
Class AbstractFactoryRegistryImpl<T
extends Factory,
R extends ReflectiveFactory>
java.lang.Object
io.fluentlenium.configuration.AbstractFactoryRegistryImpl<T,
R>
- Type Parameters:
T
- type of factoriesR
- type of reflective factories
- Direct Known Subclasses:
CapabilitiesRegistryImpl
,WebDriversRegistryImpl
public abstract class AbstractFactoryRegistryImpl<T extends Factory,R extends ReflectiveFactory>
extends Object
Abstract registry of FluentLenium factories.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFactoryRegistryImpl
(Class<T> factoryType, Class<R> reflectiveFactoryType) Creates a new factory registry. -
Method Summary
Modifier and TypeMethodDescriptionGet the factory registered under the given name.Get the default factory.protected abstract T
getDefault
(List<T> filteredFactories) Get the default factory from given list of available factories.protected abstract void
handleNoFactoryAvailable
(String name) Handle the case when no factory is available for given nameprotected abstract R
newReflectiveInstance
(String name) Creates an instance of reflective factory.final void
Register a new factory.
-
Field Details
-
factoryType
-
reflectiveFactoryType
-
factories
-
-
Constructor Details
-
AbstractFactoryRegistryImpl
Creates a new factory registry.- Parameters:
factoryType
- type of factoriesreflectiveFactoryType
- type of reflective factories
-
-
Method Details
-
getDefault
Get the default factory.- Returns:
- default factory
-
getDefault
Get the default factory from given list of available factories.- Parameters:
filteredFactories
- available factories- Returns:
- default factory
-
get
Get the factory registered under the given name.- Parameters:
name
- name of the factory- Returns:
- factory
-
handleNoFactoryAvailable
Handle the case when no factory is available for given name- Parameters:
name
- request factory name
-
newReflectiveInstance
Creates an instance of reflective factory.- Parameters:
name
- name of the instance to create.- Returns:
- new instance
-
register
Register a new factory.It will use
FactoryName
value as the default name.It will also register the factory under names returned by
FactoryNames.getNames()
} if it implementsFactoryNames
.- Parameters:
factory
- factory to register
-