Package org.apache.activemq.util
Class FactoryFinder<T>
java.lang.Object
org.apache.activemq.util.FactoryFinder<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe strategy that the FactoryFinder uses to find load and instantiate Objects can be changed out by calling thesetObjectFactory(org.apache.activemq.util.FactoryFinder.ObjectFactory)method with a custom implementation of ObjectFactory.protected static classThe default implementation of Object factory which works well in standalone applications. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildAllowedImpls(Class<?>... classes) static booleanstatic FactoryFinder.ObjectFactorynewInstance(String key) Creates a new instance of the given keystatic voidsetObjectFactory(FactoryFinder.ObjectFactory objectFactory) static <T> voidvalidateClass(Class<?> clazz, Class<T> requiredType, Set<Class<? extends T>> allowedImpls)
-
Constructor Details
-
FactoryFinder
- Parameters:
path- The path to search for implsrequiredType- Required interface type that any impl must implementallowedImpls- The list of allowed implementations. If null or asterisk then all impls of the requiredType are allowed.
-
-
Method Details
-
getObjectFactory
-
setObjectFactory
-
newInstance
public T newInstance(String key) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException Creates a new instance of the given key- Parameters:
key- is the key to add to the path to find a text file containing the factory name- Returns:
- a newly created instance
- Throws:
IllegalAccessExceptionInstantiationExceptionIOExceptionClassNotFoundException
-
containsPathSeparators
-
buildAllowedImpls
-
validateClass
public static <T> void validateClass(Class<?> clazz, Class<T> requiredType, Set<Class<? extends T>> allowedImpls) throws InstantiationException - Throws:
InstantiationException
-