APIdia Launch Partner
Top Description Fields Constructors Methods
javax.xml.validation

pack-priv Class SchemaFactoryFinder

extends Object
Class Inheritance
Imports
com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory, java.lang.reflect.InvocationTargetException, java.util.ServiceConfigurationError, .ServiceLoader, java.util.function.Supplier, jdk.xml.internal.SecuritySupport

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

Field Summary

Modifier and TypeField and Description
private final ClassLoader
classLoader

ClassLoader to use to find SchemaFactory.

private static boolean
debug

debug support code.

private static final String
private static final Class<SchemaFactory>

Constructor Summary

AccessConstructor and Description
public
SchemaFactoryFinder(ClassLoader
to be used to load resource, SchemaFactory, and SchemaFactoryLoader 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 SchemaFactory.

Method Summary

Modifier and TypeMethod and Description
private SchemaFactory

Returns:

SchemaFactory for the given schemaLanguage.
_newFactory
(String
Schema language to lookup SchemaFactory for.
schemaLanguage
)

Lookup a SchemaFactory for the given schemaLanguage.

private Class<?>

Returns:

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

Create class using appropriate ClassLoader.

pack-priv SchemaFactory

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 SchemaFactory

Returns:

A SchemaFactory supporting the specified schema language, or null if none is found.
findServiceProvider
(final String
The schema language for which we seek a factory.
schemaLanguage
)

Finds a service provider subclass of SchemaFactory that supports the given schema language using the ServiceLoader.

public SchemaFactory

Returns:

null if the callee fails to create one.
newFactory
(String
See Schema Language table in SchemaFactory for the list of available schema languages.
schemaLanguage
)

Creates a new SchemaFactory object for the specified schema language.

private static String
which(Class<?> clazz)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classLoaderback to summary
private final ClassLoader classLoader

ClassLoader to use to find SchemaFactory.

debugback to summary
private static boolean debug

debug support code.

DEFAULT_PACKAGEback to summary
private static final String DEFAULT_PACKAGE
SERVICE_CLASSback to summary
private static final Class<SchemaFactory> SERVICE_CLASS

Constructor Detail

SchemaFactoryFinderback to summary
public SchemaFactoryFinder(ClassLoader loader)

Constructor that specifies ClassLoader to use to find SchemaFactory.

Parameters
loader:ClassLoader

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

Method Detail

_newFactoryback to summary
private SchemaFactory _newFactory(String schemaLanguage)

Lookup a SchemaFactory for the given schemaLanguage.

Parameters
schemaLanguage:String

Schema language to lookup SchemaFactory for.

Returns:SchemaFactory

SchemaFactory for the given schemaLanguage.

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.

createInstanceback to summary
pack-priv SchemaFactory createInstance(String className)

Creates an instance of the specified and returns it.

Parameters
className:String

fully qualified class name to be instantiated.

Returns:SchemaFactory

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 SchemaFactory findServiceProvider(final String schemaLanguage)

Finds a service provider subclass of SchemaFactory that supports the given schema language using the ServiceLoader.

Parameters
schemaLanguage:String

The schema language for which we seek a factory.

Returns:SchemaFactory

A SchemaFactory supporting the specified schema language, or null if none is found.

Exceptions
SchemaFactoryConfigurationError:
if a configuration error is found.
newFactoryback to summary
public SchemaFactory newFactory(String schemaLanguage)

Creates a new SchemaFactory object for the specified schema language.

Parameters
schemaLanguage:String

See Schema Language table in SchemaFactory for the list of available schema languages.

Returns:SchemaFactory

null if the callee fails to create one.

Exceptions
NullPointerException:
If the schemaLanguage parameter is null.
SchemaFactoryConfigurationError:
If a configuration error is encountered.
whichback to summary
private static String which(Class<?> clazz)