public class FactoryCreator extends FactoryRegistry
This class maintains a cache of previously created factories, as weak references. Calls to getServiceProvider
first check if a
previously created factory can fit.
LOGGER
Constructor and 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.
|
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.
|
protected <T> T |
createServiceProvider(Class<T> category,
Class<?> implementation,
Hints hints)
Deprecated.
Replaced with
createFactory(Class, Class, 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).
|
<T> T |
getServiceProvider(Class<T> category,
ServiceRegistry.Filter filter,
Hints hints,
Hints.Key key)
Deprecated.
Replaced with
FactoryRegistry.getFactories(Class, Predicate, boolean) |
deregisterAll, deregisterAll, deregisterFactories, deregisterFactories, deregisterFactory, deregisterFactory, deregisterServiceProvider, deregisterServiceProvider, deregisterServiceProviders, finalize, getClassLoaders, getFactories, getFactories, getFactories, getFactoryByClass, getServiceProviderByClass, getServiceProviders, getServiceProviders, getServiceProviders, isAcceptable, lookupProviders, lookupProviders, registerFactories, registerFactories, registerFactory, registerFactory, registerServiceProvider, registerServiceProvider, registerServiceProviders, scanForPlugins, setOrdering, 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.@Deprecated public <T> T getServiceProvider(Class<T> category, ServiceRegistry.Filter filter, Hints hints, Hints.Key key) throws FactoryRegistryException
FactoryRegistry.getFactories(Class, Predicate, boolean)
getServiceProvider
in class FactoryRegistry
FactoryRegistryException
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)
@Deprecated protected <T> T createServiceProvider(Class<T> category, Class<?> implementation, Hints hints) throws FactoryRegistryException
createFactory(Class, Class, Hints)
FactoryRegistryException
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–2019 Geotools. All rights reserved.