Module, which has API methods to access the exported view of classes and resources.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ModuleClassLoader.Configuration
An opaque configuration used internally to create a module class loader. |
| Modifier and Type | Field and Description |
|---|---|
| private final LocalLoader | |
| private final Module | |
| private final AtomicReference | |
| private final IdentityHashMap | |
| private final ClassTransformer |
| Access | Constructor and Description |
|---|---|
| protected | ModuleClassLoader(final ModuleClassLoader.
the module class loader configuration to use configurationConstruct a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public final void | clearAssertionStatus()
Overrides java. false and discards any package defaults or class assertion
status settings associated with the class loader.
|
| protected final Object | |
| private Class | Returns: the new classthe class name name, final ClassSpec the class spec classSpec, final ResourceLoader the resource loader of the class spec resourceLoader)Define a class from a class name and class spec. |
| pack-priv Class | defineClassInternal(final String className, ByteBuffer byteBuffer, final ProtectionDomain protectionDomain)
|
| pack-priv Class | defineClassInternal(final String className, byte[] bytes, int off, int len, final ProtectionDomain protectionDomain)
|
| private Package | Returns: the new packagethe package name name, final PackageSpec the package specification spec)Define a package from a package spec. |
| protected final Package | definePackage(final String
the package name name, final String the specification title specTitle, final String the specification version specVersion, final String the specification vendor specVendor, final String the implementation title implTitle, final String the implementation version implVersion, final String the implementation vendor implVendor, final URL if not sealBase)null, then this package is sealed with respect to the given code source URLOverrides org. |
| private Class | doDefineOrLoadClass(final String className, final byte[] bytes, final ByteBuffer byteBuffer, ProtectionDomain protectionDomain)
|
| public final boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| protected final void | finalize()
Overrides java. |
| protected final Class | findClass(String
the class name className, boolean true if only exported classes should be consideredtrue if the class should be linked after loadingOverrides org. |
| protected final String | Returns: the full absolute path to the librarythe library name libname)Overrides java. |
| public final URL | findResource(final String
the resource name name, final boolean true to consider only exported resources or false to consider all resourcesOverrides org. |
| public final InputStream | findResourceAsStream(final String
the resource name name, boolean true to consider only exported resources or false to consider all resourcesOverrides org. |
| public final Enumeration | findResources(final String
the resource name name, final boolean true to consider only exported resources or false to consider all resourcesOverrides org. |
| protected String | Returns: an exception message used when producing instances of ClassNotFoundExceptionthe name of the class which is missing className, Module the module from which the class could not be found fromModule)Returns an exception message used when producing instances of ClassNotFoundException. |
| pack-priv LocalLoader | Returns: the local loaderGet the local loader which refers to this module class loader. |
| public final Set | Returns: the set of local pathsGet the (unmodifiable) set of paths which are locally available in this module class loader. |
| public final Module | |
| public final String | Returns: the name of this moduleOverrides org. |
| protected final Package | getPackageByName(final String
the package name name)Overrides org. |
| protected final Package[] | getPackages()
Overrides org. |
| pack-priv Set | |
| private ProtectionDomain | |
| pack-priv ResourceLoader[] | |
| public final int | |
| public final Iterator | Returns: the resource iteratorthe directory name to search startName, final boolean true to recurse into subdirectories, false otherwiseIterate the resources within this module class loader. |
| public Class | Returns: the loaded class ornull if it was not foundthe class name to load className)Load a class from this class loader. |
| public Class | Returns: the loaded class ornull if it was not foundthe class name className, final boolean true to resolve the loaded classLoad a local class from this class loader. |
| pack-priv Resource | Returns: the resource, ornull if it was not foundthe root name root, final String the resource name name)
Deprecated
Load a local exported resource from a specific root from this module class loader.
|
| public List | Returns: the list of resourcesthe resource name name)Load a local exported resource from this class loader. |
| protected void | postDefine(ClassSpec
the class spec of the defined class classSpec, Class<?> the class that was defined definedClass)A hook which is invoked after a class is defined. |
| protected void | |
| pack-priv boolean | Returns: true if the paths were recalculated, or false if another thread finished recalculating
before the calling threadRecalculate the path maps for this module class loader. |
| public final void | setClassAssertionStatus(final String
The fully qualified class name of the top-level class whose
assertion status is to be set. className, final boolean true if the named class is to have assertions
enabled when (and if) it is initialized, false if the
class is to have assertions disabled. |
| public final void | setDefaultAssertionStatus(final boolean
true if classes loaded by this class loader will
henceforth have assertions enabled by default, false
if they will have assertions disabled by default. |
| public final void | setPackageAssertionStatus(final String
The name of the package whose package default assertion status
is to be set. A packageName, final boolean null value indicates the unnamed
package that is "current"
(see section 7.4.2 of
The Java Language Specification.)true if classes loaded by this classloader and
belonging to the named package or any of its subpackages will
have assertions enabled by default, false if they will
have assertions disabled by default. |
| pack-priv boolean | Returns: true if the paths were recalculated, or false if another thread finished recalculating
before the calling threadthe new resource loaders resourceLoaders)Change the set of resource loaders for this module class loader, and recalculate the path maps. |
| private boolean | setResourceLoaders(final Paths<ResourceLoader, ResourceLoaderSpec> paths, final ResourceLoaderSpec[] resourceLoaders)
|
| public final String | Returns: the stringOverrides java. |
| localLoader | back to summary |
|---|---|
| private final LocalLoader localLoader | |
| module | back to summary |
|---|---|
| private final Module module | |
| paths | back to summary |
|---|---|
| private final AtomicReference<Paths<ResourceLoader, ResourceLoaderSpec>> paths | |
| protectionDomains | back to summary |
|---|---|
| private final IdentityHashMap<CodeSource, ProtectionDomain> protectionDomains | |
| transformer | back to summary |
|---|---|
| private final ClassTransformer transformer | |
| ModuleClassLoader | back to summary |
|---|---|
| protected ModuleClassLoader(final ModuleClassLoader. Construct a new instance.
| |
| clearAssertionStatus | back to summary |
|---|---|
| public final void clearAssertionStatus() Overrides java. Doc from java. Sets the default assertion status for this class loader to
| |
| clone | back to summary |
|---|---|
| protected final Object clone() throws CloneNotSupportedException Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| defineClass | back to summary |
|---|---|
| private Class Define a class from a class name and class spec. Also defines any enclosing
| |
| defineClassInternal | back to summary |
|---|---|
| pack-priv Class | |
| defineClassInternal | back to summary |
|---|---|
| pack-priv Class | |
| definePackage | back to summary |
|---|---|
| private Package definePackage(final String name, final PackageSpec spec) Define a package from a package spec.
| |
| definePackage | back to summary |
|---|---|
| protected final Package definePackage(final String name, final String specTitle, final String specVersion, final String specVendor, final String implTitle, final String implVersion, final String implVendor, final URL sealBase) throws IllegalArgumentException Overrides org. Doc from org. Defines a package by name in this ConcurrentClassLoader. If the package was already defined, the existing package is returned instead.
| |
| doDefineOrLoadClass | back to summary |
|---|---|
| private Class | |
| equals | back to summary |
|---|---|
| public final boolean equals(final Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| finalize | back to summary |
|---|---|
| protected final void finalize() throws Throwable Overrides java. Doc from java. Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the
When running in a Java virtual machine in which finalization has been
disabled or removed, the garbage collector will never call
The general contract of
The
The Java programming language does not guarantee which thread will
invoke the
After the
The
Any exception thrown by the | |
| findClass | back to summary |
|---|---|
| protected final Class Overrides org. Doc from org. Find a class, possibly delegating to other loader(s). This method should never synchronize across a
delegation method call of any sort. The default implementation always throws
If a class is to be defined by this method, it should be done via one of the atomic
| |
| findLibrary | back to summary |
|---|---|
| protected final String findLibrary(final String libname) Overrides java. Find a library from one of the resource loaders. | |
| findResource | back to summary |
|---|---|
| public final URL findResource(final String name, final boolean exportsOnly) Overrides org. Doc from org. Find the resource with the given name and exported status. | |
| findResourceAsStream | back to summary |
|---|---|
| public final InputStream findResourceAsStream(final String name, boolean exportsOnly) Overrides org. Doc from org. Finds the resource with the given name and exported status, returning the resource content as a stream.
| |
| findResources | back to summary |
|---|---|
| public final Enumeration Overrides org. Doc from org. Finds the resources with the given name and exported status.
| |
| getClassNotFoundExceptionMessage | back to summary |
|---|---|
| protected String getClassNotFoundExceptionMessage(String className, Module fromModule) Returns an exception message used when producing instances of ClassNotFoundException. This can be overridden by subclasses to customise the error message. | |
| getLocalLoader | back to summary |
|---|---|
| pack-priv LocalLoader getLocalLoader() Get the local loader which refers to this module class loader.
| |
| getLocalPaths | back to summary |
|---|---|
| public final Set Get the (unmodifiable) set of paths which are locally available in this module class loader. The set will include all paths defined by the module's resource loaders, minus any paths excluded by filters. The set will generally always contain an empty entry (""). The set is unordered and unsorted, and is iterable in O(n) time and accessible in O(1) time. | |
| getModule | back to summary |
|---|---|
| public final Module getModule() Get the module for this class loader.
| |
| getName | back to summary |
|---|---|
| public final String getName() Overrides org. Get the name of this module. This method is used by Java 9 in debug output.
| |
| getPackageByName | back to summary |
|---|---|
| protected final Package getPackageByName(final String name) Overrides org. Doc from org. Perform the actual work to load a package which is visible to this class loader. By default, uses a simple parent-first delegation strategy. | |
| getPackages | back to summary |
|---|---|
| protected final Package[] getPackages() Overrides org. Doc from org. Get all defined packages which are visible to this class loader. | |
| getPaths | back to summary |
|---|---|
| pack-priv Set | |
| getProtectionDomain | back to summary |
|---|---|
| private ProtectionDomain getProtectionDomain(CodeSource codeSource) | |
| getResourceLoaders | back to summary |
|---|---|
| pack-priv ResourceLoader[] getResourceLoaders() | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| iterateResources | back to summary |
|---|---|
| public final Iterator Iterate the resources within this module class loader. Only resource roots which are inherently iterable will be checked, thus the result of this method may only be a subset of the actual loadable resources. The returned resources are not sorted or grouped in any particular way. | |
| loadClassLocal | back to summary |
|---|---|
| public Class Load a class from this class loader.
| |
| loadClassLocal | back to summary |
|---|---|
| public Class Load a local class from this class loader.
| |
| loadResourceLocal | back to summary |
|---|---|
| pack-priv Resource loadResourceLocal(final String root, final String name)
Deprecated
Load a local exported resource from a specific root from this module class loader.
| |
| loadResourceLocal | back to summary |
|---|---|
| public List Load a local exported resource from this class loader. | |
| postDefine | back to summary |
|---|---|
| protected void postDefine(ClassSpec classSpec, Class<?> definedClass) A hook which is invoked after a class is defined.
| |
| preDefine | back to summary |
|---|---|
| protected void preDefine(ClassSpec classSpec, String className) A hook which is invoked before a class is defined.
| |
| recalculate | back to summary |
|---|---|
| pack-priv boolean recalculate() Recalculate the path maps for this module class loader.
| |
| setClassAssertionStatus | back to summary |
|---|---|
| public final void setClassAssertionStatus(final String className, final boolean enabled) Overrides java. Doc from java. Sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein. This setting takes precedence over the class loader's default assertion status, and over any applicable per-package default. This method has no effect if the named class has already been initialized. (Once a class is initialized, its assertion status cannot change.) If the named class is not a top-level class, this invocation will have no effect on the actual assertion status of any class. | |
| setDefaultAssertionStatus | back to summary |
|---|---|
| public final void setDefaultAssertionStatus(final boolean enabled) Overrides java. Doc from java. Sets the default assertion status for this class loader. This setting
determines whether classes loaded by this class loader and initialized
in the future will have assertions enabled or disabled by default.
This setting may be overridden on a per-package or per-class basis by
invoking
| |
| setPackageAssertionStatus | back to summary |
|---|---|
| public final void setPackageAssertionStatus(final String packageName, final boolean enabled) Overrides java. Doc from java. Sets the package default assertion status for the named package. The package default assertion status determines the assertion status for classes initialized in the future that belong to the named package or any of its "subpackages". A subpackage of a package named p is any package whose name begins
with " In the event that multiple package defaults apply to a given class,
the package default pertaining to the most specific package takes
precedence over the others. For example, if Package defaults take precedence over the class loader's default
assertion status, and may be overridden on a per-class basis by invoking
| |
| setResourceLoaders | back to summary |
|---|---|
| pack-priv boolean setResourceLoaders(final ResourceLoaderSpec[] resourceLoaders) Change the set of resource loaders for this module class loader, and recalculate the path maps.
| |
| setResourceLoaders | back to summary |
|---|---|
| private boolean setResourceLoaders(final Paths<ResourceLoader, ResourceLoaderSpec> paths, final ResourceLoaderSpec[] resourceLoaders) | |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Get a string representation of this class loader. | |
| Modifier and Type | Field and Description |
|---|---|
| private final AssertionSetting | |
| private final Module | |
| private final ResourceLoaderSpec[] | |
| private final ClassTransformer |
| Access | Constructor and Description |
|---|---|
| pack-priv | Configuration(final Module module, final AssertionSetting assertionSetting, final ResourceLoaderSpec[] resourceLoaders, final ClassTransformer transformer)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv AssertionSetting | |
| pack-priv Module | |
| pack-priv ResourceLoaderSpec[] | |
| pack-priv ClassTransformer |
| assertionSetting | back to summary |
|---|---|
| private final AssertionSetting assertionSetting | |
| module | back to summary |
|---|---|
| private final Module module | |
| resourceLoaders | back to summary |
|---|---|
| private final ResourceLoaderSpec[] resourceLoaders | |
| transformer | back to summary |
|---|---|
| private final ClassTransformer transformer | |
| Configuration | back to summary |
|---|---|
| pack-priv Configuration(final Module module, final AssertionSetting assertionSetting, final ResourceLoaderSpec[] resourceLoaders, final ClassTransformer transformer) | |
| getAssertionSetting | back to summary |
|---|---|
| pack-priv AssertionSetting getAssertionSetting() | |
| getModule | back to summary |
|---|---|
| pack-priv Module getModule() | |
| getResourceLoaders | back to summary |
|---|---|
| pack-priv ResourceLoaderSpec[] getResourceLoaders() | |
| getTransformer | back to summary |
|---|---|
| pack-priv ClassTransformer getTransformer() | |