Top Description Fields Constructors Methods
javax.xml.xpath

pack-priv Class XPathFactoryFinder

extends Object
Class Inheritance
Imports
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl, java.lang.reflect.InvocationTargetException, java.security.AccessControlContext, .AccessController, .PrivilegedAction, java.util.Properties, .ServiceConfigurationError, .ServiceLoader, java.util.function.Supplier, jdk.xml.internal.SecuritySupport

Implementation of XPathFactory#newInstance(String).
Author
Kohsuke Kawaguchi
Since
1.5

Field Summary

Modifier and TypeField and Description
private static final Properties
cacheProps

Cache properties for performance.

private final ClassLoader
classLoader

ClassLoader to use to find XPathFactory.

private static boolean
debug

debug support code.

private static final String
private static volatile boolean
firstTime

First time requires initialization overhead.

private static final Class<XPathFactory>

Constructor Summary

AccessConstructor and Description
public
XPathFactoryFinder(ClassLoader
to be used to load resource and XPathFactory implementations during the resolution process. If this parameter is null, the default system class loader will be used.
loader
)

Constructor that specifies ClassLoader to use to find XPathFactory.

Method Summary

Modifier and TypeMethod and Description
private XPathFactory

Returns:

XPathFactory for the given object model.
_newFactory
(String
identifies the object model.
uri
)

Lookup a XPathFactory for the given object model.

private Class<?>

Returns:

Created class or null.
createClass
(String
Name of class to create.
className
)

Create class using appropriate ClassLoader.

pack-priv XPathFactory

Returns:

null if it fails. Error messages will be printed by this method.
createInstance
(String
fully qualified class name to be instantiated.
className
)

Creates an instance of the specified and returns it.

private void
private static void
debugPrintln(Supplier<String>
Supplier function that returns debug message
msgGen
)

Conditional debug printing.

private XPathFactory

Returns:

An XPathFactory supporting the specified object model, or null if none is found.
findServiceProvider
(final String
URI of object model to support.
objectModel
)

Finds a service provider subclass of XPathFactory that supports the given object model using the ServiceLoader.

private boolean
isObjectModelSupportedBy(final XPathFactory factory, final String objectModel, AccessControlContext acc)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

public XPathFactory

Returns:

null if the callee fails to create one.
newFactory
(String
Identifies the underlying object model.
uri
)

Creates a new XPathFactory object for the specified object model.

private static String
which(Class<?> clazz)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachePropsback to summary
private static final Properties cacheProps

Cache properties for performance.

classLoaderback to summary
private final ClassLoader classLoader

ClassLoader to use to find XPathFactory.

debugback to summary
private static boolean debug

debug support code.

DEFAULT_PACKAGEback to summary
private static final String DEFAULT_PACKAGE
firstTimeback to summary
private static volatile boolean firstTime

First time requires initialization overhead.

SERVICE_CLASSback to summary
private static final Class<XPathFactory> SERVICE_CLASS

Constructor Detail

XPathFactoryFinderback to summary
public XPathFactoryFinder(ClassLoader loader)

Constructor that specifies ClassLoader to use to find XPathFactory.

Parameters
loader:ClassLoader

to be used to load resource and XPathFactory implementations during the resolution process. If this parameter is null, the default system class loader will be used.

Method Detail

_newFactoryback to summary
private XPathFactory _newFactory(String uri) throws XPathFactoryConfigurationException

Lookup a XPathFactory for the given object model.

Parameters
uri:String

identifies the object model.

Returns:XPathFactory

XPathFactory for the given object model.

createClassback to summary
private Class<?> createClass(String className)

Create class using appropriate ClassLoader.

Parameters
className:String

Name of class to create.

Returns:Class<?>

Created class or null.

Annotations
@SuppressWarnings:removal
createInstanceback to summary
pack-priv XPathFactory createInstance(String className) throws XPathFactoryConfigurationException

Creates an instance of the specified and returns it.

Parameters
className:String

fully qualified class name to be instantiated.

Returns:XPathFactory

null if it fails. Error messages will be printed by this method.

debugDisplayClassLoaderback to summary
private void debugDisplayClassLoader()
debugPrintlnback to summary
private static void debugPrintln(Supplier<String> msgGen)

Conditional debug printing.

Parameters
msgGen:Supplier<String>

Supplier function that returns debug message

findServiceProviderback to summary
private XPathFactory findServiceProvider(final String objectModel) throws XPathFactoryConfigurationException

Finds a service provider subclass of XPathFactory that supports the given object model using the ServiceLoader.

Parameters
objectModel:String

URI of object model to support.

Returns:XPathFactory

An XPathFactory supporting the specified object model, or null if none is found.

Annotations
@SuppressWarnings:removal
Exceptions
XPathFactoryConfigurationException:
if a configuration error is found.
isObjectModelSupportedByback to summary
private boolean isObjectModelSupportedBy(final XPathFactory factory, final String objectModel, AccessControlContext acc)

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@SuppressWarnings:removal
newFactoryback to summary
public XPathFactory newFactory(String uri) throws XPathFactoryConfigurationException

Creates a new XPathFactory object for the specified object model.

Parameters
uri:String

Identifies the underlying object model.

Returns:XPathFactory

null if the callee fails to create one.

Exceptions
NullPointerException:
If the parameter is null.
whichback to summary
private static String which(Class<?> clazz)