T - The type of the object Factory to locate.public class FactoryFinder<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FactoryFinder.ObjectFactory
The strategy that the FactoryFinder uses to find load and instantiate Objects can be
changed out by calling the
setObjectFactory(org.apache.qpid.jms.util.FactoryFinder.ObjectFactory)
method with a custom implementation of ObjectFactory. |
protected static class |
FactoryFinder.StandaloneObjectFactory
The default implementation of Object factory which works well in stand-alone applications.
|
| Constructor and Description |
|---|
FactoryFinder(Class<T> factoryType,
String path)
Creates a new instance of the FactoryFinder using the given search path.
|
| Modifier and Type | Method and Description |
|---|---|
static FactoryFinder.ObjectFactory |
getObjectFactory() |
T |
newInstance(String key)
Creates a new instance of the given key.
|
void |
registerProviderFactory(String scheme,
T factory)
Allow registration of a Provider factory without wiring via META-INF classes
|
static void |
setObjectFactory(FactoryFinder.ObjectFactory objectFactory)
Sets the ObjectFactory instance to use when searching for the Factory class.
|
public static FactoryFinder.ObjectFactory getObjectFactory()
public static void setObjectFactory(FactoryFinder.ObjectFactory objectFactory)
objectFactory - the new object factory to use when searching for a Factory instance.public T newInstance(String key) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException, ClassCastException, ResourceNotFoundException, InvocationTargetException, NoSuchMethodException, SecurityException
key - is the key to add to the path to find a text file containing the factory nameIllegalAccessException - if an error occurs while accessing the search path.InstantiationException - if the factory object fails on create.ResourceNotFoundException - if the resource with the given key does not exist.IOException - if the search encounter an IO error.ClassNotFoundException - if the class that is to be loaded cannot be found.ClassCastException - if the found object is not assignable to the request factory type.InvocationTargetException - if the constructor of the found factory throws an exceptionNoSuchMethodException - if the factory class found does not have a suitable constructorSecurityException - if a security error occurs trying to create the factory instance.Copyright © 2013–2019 The Apache Software Foundation. All rights reserved.