Package org.apache.activemq.util
Interface FactoryFinder.ObjectFactory
- All Known Implementing Classes:
FactoryFinder.StandaloneObjectFactory
- Enclosing class:
- FactoryFinder<T>
public static interface FactoryFinder.ObjectFactory
The strategy that the FactoryFinder uses to find load and instantiate Objects
can be changed out by calling the
FactoryFinder.setObjectFactory(org.apache.activemq.util.FactoryFinder.ObjectFactory)
method with a custom implementation of ObjectFactory.
The default ObjectFactory is typically changed out when running in a specialized container
environment where service discovery needs to be done via the container system. For example,
in an OSGi scenario.-
Method Summary
-
Method Details
-
create
Object create(String path) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException - Parameters:
path- the full service path- Returns:
- Throws:
IllegalAccessExceptionInstantiationExceptionIOExceptionClassNotFoundException
-
create
default <T> T create(String path, Class<T> requiredType, Set<Class<? extends T>> allowedImpls) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException This method loads objects by searching for classes in the given path. A requiredType and Set of allowed implementations are provided for implementations to use for validation. Note is up to the actual implementations that implementFactoryFinder.ObjectFactoryto decide how to use both parameters. By default, the method just delegates tocreate(String)- Parameters:
path- the full service pathrequiredType- the requiredType any objects must implementallowedImpls- The set of allowed impls- Returns:
- Throws:
IllegalAccessExceptionInstantiationExceptionIOExceptionClassNotFoundException
-