public class DefaultFactoryFinder extends Object implements FactoryFinder
Modifier and Type | Class and Description |
---|---|
protected static interface |
DefaultFactoryFinder.ClassSupplier |
Constructor and Description |
---|
DefaultFactoryFinder(ClassResolver classResolver,
String resourcePath) |
Modifier and Type | Method and Description |
---|---|
protected Class<?> |
addToClassMap(String key,
DefaultFactoryFinder.ClassSupplier mappingFunction) |
Class<?> |
findClass(String key)
Finds the given factory class using the key to lookup.
|
Class<?> |
findClass(String key,
String propertyPrefix)
Finds the given factory class using the key to lookup.
|
Class<?> |
findClass(String key,
String propertyPrefix,
Class<?> clazz)
Finds the given factory class using the key to lookup.
|
String |
getResourcePath()
Gets the resource classpath.
|
Object |
newInstance(String key)
Creates a new class instance using the key to lookup
|
<T> List<T> |
newInstances(String key,
Injector injector,
Class<T> type)
Creates a new class instance using the key to lookup
|
public DefaultFactoryFinder(ClassResolver classResolver, String resourcePath)
public String getResourcePath()
FactoryFinder
getResourcePath
in interface FactoryFinder
public Object newInstance(String key) throws NoFactoryAvailableException
FactoryFinder
newInstance
in interface FactoryFinder
key
- is the key to add to the path to find a text file containing the factory nameNoFactoryAvailableException
- is thrown if no factories exist for the given keypublic <T> List<T> newInstances(String key, Injector injector, Class<T> type) throws ClassNotFoundException, IOException
FactoryFinder
newInstances
in interface FactoryFinder
key
- is the key to add to the path to find a text file containing the factory nameinjector
- injector to usetype
- expected typeClassNotFoundException
- is thrown if not foundIOException
- is thrown if loading the class or META-INF file not foundpublic Class<?> findClass(String key) throws ClassNotFoundException, IOException
FactoryFinder
findClass
in interface FactoryFinder
key
- is the key to add to the path to find a text file containing the factory nameClassNotFoundException
- is thrown if class not foundIOException
- is thrown if loading the class or META-INF file not foundpublic Class<?> findClass(String key, String propertyPrefix) throws ClassNotFoundException, IOException
FactoryFinder
findClass
in interface FactoryFinder
key
- is the key to add to the path to find a text file containing the factory namepropertyPrefix
- prefix on keyClassNotFoundException
- is thrown if not foundIOException
- is thrown if loading the class or META-INF file not foundpublic Class<?> findClass(String key, String propertyPrefix, Class<?> clazz) throws ClassNotFoundException, IOException
FactoryFinder
findClass
in interface FactoryFinder
key
- is the key to add to the path to find a text file containing the factory namepropertyPrefix
- prefix on keyclazz
- the class which is used for checking compatibleClassNotFoundException
- is thrown if not foundIOException
- is thrown if loading the class or META-INF file not foundprotected Class<?> addToClassMap(String key, DefaultFactoryFinder.ClassSupplier mappingFunction) throws ClassNotFoundException, IOException
ClassNotFoundException
IOException
Apache Camel