Top Fields Constructors Methods
jakarta.activation

pack-priv Class FactoryFinder

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, java.security.AccessController, .PrivilegedAction, java.util.Iterator, java.util.logging.Level, .Logger

Field Summary

Modifier and TypeField and Description
private static final ServiceLoaderUtil.ExceptionHandler<RuntimeException>
private static final Logger
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static <T> T

Returns:

the Class object of the specified message factory; may not be null
find
(Class<T>
factory abstract class or interface to be found
factoryClass
,
String
the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no default class name
defaultClassName
,
boolean
whether to try the default class as a fallback
tryFallback
)

Finds the implementation Class object for the given factory type.

private static String
private static String
getSystemProperty(final String property)

private static boolean
private static void
private static <T> T
private static <T> T
newInstance(String className, String defaultClassName, ClassLoader tccl)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EXCEPTION_HANDLERback to summary
private static final ServiceLoaderUtil.ExceptionHandler<RuntimeException> EXCEPTION_HANDLER
loggerback to summary
private static final Logger logger
OSGI_SERVICE_LOADER_CLASS_NAMEback to summary
private static final String OSGI_SERVICE_LOADER_CLASS_NAME

Constructor Detail

FactoryFinderback to summary
pack-priv FactoryFinder()

Method Detail

findback to summary
pack-priv static <T> T find(Class<T> factoryClass, String defaultClassName, boolean tryFallback) throws RuntimeException

Finds the implementation Class object for the given factory type. If it fails and tryFallback is true finds the Class object for the given default class name. The arguments supplied must be used in order Note the default class name may be needed even if fallback is not to be attempted in order to check if requested type is fallback.

This method is package private so that this code can be shared.

Parameters
factoryClass:Class<T>

factory abstract class or interface to be found

defaultClassName:String

the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no default class name

tryFallback:boolean

whether to try the default class as a fallback

Returns:T

the Class object of the specified message factory; may not be null

Exceptions
RuntimeException:
if there is no factory found
fromSystemPropertyback to summary
private static String fromSystemProperty(String factoryId)
getSystemPropertyback to summary
private static String getSystemProperty(final String property)
isOsgiback to summary
private static boolean isOsgi()
logFoundback to summary
private static void logFound(String value)
lookupUsingOSGiServiceLoaderback to summary
private static <T> T lookupUsingOSGiServiceLoader(String factoryId)
Annotations
@SuppressWarnings:unchecked
newInstanceback to summary
private static <T> T newInstance(String className, String defaultClassName, ClassLoader tccl) throws RuntimeException