- java.lang.Object
-
- jakarta.activation.FactoryFinder
-
class FactoryFinder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static ServiceLoaderUtil.ExceptionHandler<java.lang.RuntimeException>
EXCEPTION_HANDLER
private static java.util.logging.Logger
logger
-
Constructor Summary
Constructors Constructor Description FactoryFinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <T> T
find(java.lang.Class<T> factoryClass)
Finds the implementationClass
object for the given factory type.(package private) static <T> T
find(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader)
private static java.lang.String
fromSystemProperty(java.lang.String factoryId)
private static java.lang.ClassLoader[]
getClassLoaders(java.lang.Class<?>... classes)
private static java.lang.Class<?>[]
getHk2ServiceLoaderTargets(java.lang.Class<?> factoryClass)
private static java.lang.String
getSystemProperty(java.lang.String property)
private static void
logFound(java.lang.String value)
private static <T> T
lookupUsingHk2ServiceLoader(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader)
private static <T> T
newInstance(java.lang.String className, java.lang.Class<? extends T> service, java.lang.ClassLoader loader)
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
EXCEPTION_HANDLER
private static final ServiceLoaderUtil.ExceptionHandler<java.lang.RuntimeException> EXCEPTION_HANDLER
-
-
Method Detail
-
find
static <T> T find(java.lang.Class<T> factoryClass) throws java.lang.RuntimeException
Finds the implementationClass
object for the given factory type.This method is package private so that this code can be shared.
- Parameters:
factoryClass
- factory abstract class or interface to be found- Returns:
- the
Class
object of the specified message factory; may not benull
- Throws:
java.lang.IllegalStateException
- if there is no factory foundjava.lang.RuntimeException
-
find
static <T> T find(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader) throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
newInstance
private static <T> T newInstance(java.lang.String className, java.lang.Class<? extends T> service, java.lang.ClassLoader loader) throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
fromSystemProperty
private static java.lang.String fromSystemProperty(java.lang.String factoryId)
-
getSystemProperty
private static java.lang.String getSystemProperty(java.lang.String property)
-
logFound
private static void logFound(java.lang.String value)
-
getHk2ServiceLoaderTargets
private static java.lang.Class<?>[] getHk2ServiceLoaderTargets(java.lang.Class<?> factoryClass)
-
lookupUsingHk2ServiceLoader
private static <T> T lookupUsingHk2ServiceLoader(java.lang.Class<T> factoryClass, java.lang.ClassLoader loader)
-
getClassLoaders
private static java.lang.ClassLoader[] getClassLoaders(java.lang.Class<?>... classes)
-
-