Class AbstractFactoryRegistryImpl<T extends Factory, R extends ReflectiveFactory>

java.lang.Object
io.fluentlenium.configuration.AbstractFactoryRegistryImpl<T, R>
Type Parameters:
T - type of factories
R - 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 Details

  • Constructor Details

    • AbstractFactoryRegistryImpl

      public AbstractFactoryRegistryImpl (Class<T> factoryType, Class<R> reflectiveFactoryType)
      Creates a new factory registry.
      Parameters:
      factoryType - type of factories
      reflectiveFactoryType - type of reflective factories
  • Method Details

    • getDefault

      public T getDefault()
      Get the default factory.
      Returns:
      default factory
    • getDefault

      protected abstract T getDefault (List<T> filteredFactories)
      Get the default factory from given list of available factories.
      Parameters:
      filteredFactories - available factories
      Returns:
      default factory
    • get

      public T get (String name)
      Get the factory registered under the given name.
      Parameters:
      name - name of the factory
      Returns:
      factory
    • handleNoFactoryAvailable

      protected abstract void handleNoFactoryAvailable (String name)
      Handle the case when no factory is available for given name
      Parameters:
      name - request factory name
    • newReflectiveInstance

      protected abstract R newReflectiveInstance (String name)
      Creates an instance of reflective factory.
      Parameters:
      name - name of the instance to create.
      Returns:
      new instance
    • register

      public final void register (T factory)
      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 implements FactoryNames.

      Parameters:
      factory - factory to register