Package org.geotools.util.factory
Class FactoryCreator
- Object
- 
- FactoryRegistry
- 
- FactoryCreator
 
 
- 
 public class FactoryCreator extends FactoryRegistry A factory registry capable to creates factories if no appropriate instance was found in the registry.This class maintains a cache of previously created factories, as weak references. Calls to getFactory(Class, Predicate, Hints, Hints.Key)} first check if a previously created factory can fit.- Since:
- 2.1
- Author:
- Martin Desruisseaux, Jody Garnett
 
- 
- 
Field Summary- 
Fields inherited from class FactoryRegistryLOGGER
 
- 
 - 
Constructor SummaryConstructors Constructor Description FactoryCreator(Class<?> category)Constructs a new registry for the specified category.FactoryCreator(Class<?>... categories)Constructs a new registry for the specified categories.FactoryCreator(Collection<Class<?>> categories)Constructs a new registry for the specified categories.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> TcreateFactory(Class<T> category, Class<?> implementation, Hints hints)Creates a new instance of the specified factory using the specified hints.<T> TgetFactory(Class<T> category, Predicate<? super T> filter, Hints hints, Hints.Key key)Factory for the specified category, using the specified map of hints (if any).- 
Methods inherited from class FactoryRegistryderegisterAll, deregisterAll, deregisterFactories, deregisterFactories, deregisterFactory, deregisterFactory, finalize, getClassLoaders, getFactories, getFactories, getFactories, getFactoryByClass, isAcceptable, registerFactories, registerFactories, registerFactory, registerFactory, scanForPlugins, setOrdering, setOrdering, setOrdering, streamCategories, unsetOrdering
 
- 
 
- 
- 
- 
Constructor Detail- 
FactoryCreatorpublic FactoryCreator(Class<?> category) Constructs a new registry for the specified category.- Parameters:
- category- The single category.
- Since:
- 2.4
 
 - 
FactoryCreatorpublic FactoryCreator(Class<?>... categories) Constructs a new registry for the specified categories.- Parameters:
- categories- The categories.
- Since:
- 2.4
 
 - 
FactoryCreatorpublic FactoryCreator(Collection<Class<?>> categories) Constructs a new registry for the specified categories.- Parameters:
- categories- The categories.
 
 
- 
 - 
Method Detail- 
getFactorypublic <T> T getFactory(Class<T> category, Predicate<? super T> filter, Hints hints, Hints.Key key) throws FactoryRegistryException Factory for the specified category, using the specified map of hints (if any). If a provider matching the requirements is found in the registry, it is returned. Otherwise, a new provider is created and returned. This creation step is the only difference between this method and the FactoryRegistry.getFactory(Class, Predicate, Hints, Hints.Key) super-class method}.- Overrides:
- getFactoryin class- FactoryRegistry
- Type Parameters:
- T- The class represented by the- categoryargument.
- Parameters:
- category- The category to look for.
- filter- Optional predicate, or- nullif none.
- hints- A map of hints, or- nullif none.
- key- The key to use for looking for a user-provided instance in the hints, or- nullif none.
- Returns:
- A factory for the specified category and hints (never null).
- Throws:
- FactoryNotFoundException- if no factory was found, and the specified hints don't provide suffisient information for creating a new factory.
- FactoryRegistryException- if the factory can't be created for some other reason.
- See Also:
- FactoryRegistry.getFactories(Class, Predicate, Hints),- getFactory(java.lang.Class<T>, java.util.function.Predicate<? super T>, org.geotools.util.factory.Hints, org.geotools.util.factory.Hints.Key)
 
 - 
createFactoryprotected <T> T createFactory(Class<T> category, Class<?> implementation, Hints hints) throws FactoryRegistryException Creates a new instance of the specified factory using the specified hints. The default implementation tries to instantiate the given implementation class using the first of the following constructor found:- Constructor with a single Hintsargument.
- No-argument constructor.
 - Parameters:
- category- The category to instantiate.
- implementation- The factory class to instantiate.
- hints- The implementation hints.
- Returns:
- The factory.
- Throws:
- FactoryRegistryException- if the factory creation failed.
 
- Constructor with a single 
 
- 
 
-