Top Description Fields Constructors Methods
javax.xml.datatype

pack-priv Class FactoryFinder

extends Object
Class Inheritance
Imports
java.security.AccessController, .PrivilegedAction, java.util.Iterator, .ServiceConfigurationError, .ServiceLoader, java.util.function.Supplier, jdk.xml.internal.SecuritySupport

Implements pluggable Datatypes.

This class is duplicated for each JAXP subpackage so keep it in sync. It is package private for secure class loading.

Author
Santiago PericasGeertsen

Field Summary

Modifier and TypeField and Description
private static boolean
debug

Internal debug flag.

private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Returns:

Class object of factory, never null
find
(Class<T>
Base class / Service interface of the factory to find.
type
,
String
Implementation class name, if nothing else is found. Use null to mean no fallback. Package private so this code can be shared.
fallbackClassName
)

Finds the implementation Class object in the specified order.

private static <T> T
findServiceProvider(final Class<T> type)

private static Class<?>
getProviderClass(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader)

Attempt to load a class using the class loader supplied.

pack-priv static <T> T
newInstance(Class<T>
Base class / Service interface of the factory to instantiate.
type
,
String
Name of the concrete class corresponding to the service provider
className
,
ClassLoader
ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
cl
,
boolean
True if the current ClassLoader should be tried as a fallback if the class is not found using cl
doFallback
)

Create an instance of a class.

pack-priv static <T> T
newInstance(Class<T>
Base class / Service interface of the factory to instantiate.
type
,
String
Name of the concrete class corresponding to the service provider
className
,
ClassLoader
ClassLoader to use to load the class, null means to use the bootstrap ClassLoader
cl
,
boolean
True if the current ClassLoader should be tried as a fallback if the class is not found using cl
doFallback
,
boolean
True if cl=null actually meant bootstrap classLoader. This parameter is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.
useBSClsLoader
)

Create an instance of a class.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

debugback to summary
private static boolean debug

Internal debug flag.

DEFAULT_PACKAGEback to summary
private static final String DEFAULT_PACKAGE

Constructor Detail

FactoryFinderback to summary
pack-priv FactoryFinder()

Method Detail

dPrintback to summary
private static void dPrint(Supplier<String> msgGen)
findback to summary
pack-priv static <T> T find(Class<T> type, String fallbackClassName) throws DatatypeConfigurationException

Finds the implementation Class object in the specified order. Main entry point.

Parameters
type:Class<T>

Base class / Service interface of the factory to find.

fallbackClassName:String

Implementation class name, if nothing else is found. Use null to mean no fallback. Package private so this code can be shared.

Returns:T

Class object of factory, never null

findServiceProviderback to summary
private static <T> T findServiceProvider(final Class<T> type) throws DatatypeConfigurationException
Annotations
@SuppressWarnings:removal
getProviderClassback to summary
private static Class<?> getProviderClass(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException

Attempt to load a class using the class loader supplied. If that fails and fall back is enabled, the current (i.e. bootstrap) class loader is tried. If the class loader supplied is null, first try using the context class loader followed by the current (i.e. bootstrap) class loader. Use bootstrap classLoader if cl = null and useBSClsLoader is true

newInstanceback to summary
pack-priv static <T> T newInstance(Class<T> type, String className, ClassLoader cl, boolean doFallback) throws DatatypeConfigurationException

Create an instance of a class. Delegates to method getProviderClass() in order to load the class.

Parameters
type:Class<T>

Base class / Service interface of the factory to instantiate.

className:String

Name of the concrete class corresponding to the service provider

cl:ClassLoader

ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.

doFallback:boolean

True if the current ClassLoader should be tried as a fallback if the class is not found using cl

newInstanceback to summary
pack-priv static <T> T newInstance(Class<T> type, String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) throws DatatypeConfigurationException

Create an instance of a class. Delegates to method getProviderClass() in order to load the class.

Parameters
type:Class<T>

Base class / Service interface of the factory to instantiate.

className:String

Name of the concrete class corresponding to the service provider

cl:ClassLoader

ClassLoader to use to load the class, null means to use the bootstrap ClassLoader

doFallback:boolean

True if the current ClassLoader should be tried as a fallback if the class is not found using cl

useBSClsLoader:boolean

True if cl=null actually meant bootstrap classLoader. This parameter is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader.

Annotations
@SuppressWarnings:removal