public class FactoryCreator extends FactoryRegistry
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.
LOGGER
Constructor and Description |
---|
FactoryCreator(Class<?>... categories)
Constructs a new registry for the specified categories.
|
FactoryCreator(Class<?> category)
Constructs a new registry for the specified category.
|
FactoryCreator(Collection<Class<?>> categories)
Constructs a new registry for the specified categories.
|
Modifier and Type | Method and Description |
---|---|
protected <T> T |
createFactory(Class<T> category,
Class<?> implementation,
Hints hints)
Creates a new instance of the specified factory using the specified hints.
|
<T> T |
getFactory(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).
|
deregisterAll, deregisterAll, deregisterFactories, deregisterFactories, deregisterFactory, deregisterFactory, finalize, getClassLoaders, getFactories, getFactories, getFactories, getFactoryByClass, isAcceptable, registerFactories, registerFactories, registerFactory, registerFactory, scanForPlugins, setOrdering, setOrdering, setOrdering, streamCategories, unsetOrdering
public FactoryCreator(Class<?> category)
category
- The single category.public FactoryCreator(Class<?>... categories)
categories
- The categories.public FactoryCreator(Collection<Class<?>> categories)
categories
- The categories.public <T> T getFactory(Class<T> category, Predicate<? super T> filter, Hints hints, Hints.Key key) throws FactoryRegistryException
getFactory
in class FactoryRegistry
T
- The class represented by the category
argument.category
- The category to look for.filter
- Optional predicate, or null
if none.hints
- A map of hints, or null
if none.key
- The key to use for looking for a user-provided instance in the hints, or null
if none.null
).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.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)
protected <T> T createFactory(Class<T> category, Class<?> implementation, Hints hints) throws FactoryRegistryException
Hints
argument.
category
- The category to instantiate.implementation
- The factory class to instantiate.hints
- The implementation hints.FactoryRegistryException
- if the factory creation failed.Copyright © 1996–2023 Geotools. All rights reserved.