public class ModuleClassLoader extends ConcurrentClassLoader
Module, which has API methods to access the exported view of classes and resources.| Modifier and Type | Class | Description |
|---|---|---|
static class |
ModuleClassLoader.Configuration |
An opaque configuration used internally to create a module class loader.
|
EMPTY_ENUMERATION| Modifier | Constructor | Description |
|---|---|---|
protected |
ModuleClassLoader(ModuleClassLoader.Configuration configuration) |
Construct a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
clearAssertionStatus() |
|
protected java.lang.Object |
clone() |
|
protected java.lang.Package |
definePackage(java.lang.String name,
java.lang.String specTitle,
java.lang.String specVersion,
java.lang.String specVendor,
java.lang.String implTitle,
java.lang.String implVersion,
java.lang.String implVendor,
java.net.URL sealBase) |
Defines a package by name in this ConcurrentClassLoader.
|
boolean |
equals(java.lang.Object obj) |
|
protected void |
finalize() |
|
protected java.lang.Class<?> |
findClass(java.lang.String className,
boolean exportsOnly,
boolean resolve) |
Find a class, possibly delegating to other loader(s).
|
protected java.lang.String |
findLibrary(java.lang.String libname) |
Find a library from one of the resource loaders.
|
java.net.URL |
findResource(java.lang.String name,
boolean exportsOnly) |
Find the resource with the given name and exported status.
|
java.io.InputStream |
findResourceAsStream(java.lang.String name,
boolean exportsOnly) |
Finds the resource with the given name and exported status, returning the resource content as a stream.
|
java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name,
boolean exportsOnly) |
Finds the resources with the given name and exported status.
|
protected java.lang.String |
getClassNotFoundExceptionMessage(java.lang.String className,
Module fromModule) |
Returns an exception message used when producing instances of ClassNotFoundException.
|
java.util.Set<java.lang.String> |
getLocalPaths() |
Get the (unmodifiable) set of paths which are locally available in this module class loader.
|
Module |
getModule() |
Get the module for this class loader.
|
java.lang.String |
getName() |
Get the name of this module.
|
protected java.lang.Package |
getPackageByName(java.lang.String name) |
Perform the actual work to load a package which is visible to this class loader.
|
protected java.lang.Package[] |
getPackages() |
Get all defined packages which are visible to this class loader.
|
int |
hashCode() |
|
java.util.Iterator<Resource> |
iterateResources(java.lang.String startName,
boolean recurse) |
Iterate the resources within this module class loader.
|
java.lang.Class<?> |
loadClassLocal(java.lang.String className) |
Load a class from this class loader.
|
java.lang.Class<?> |
loadClassLocal(java.lang.String className,
boolean resolve) |
Load a local class from this class loader.
|
java.util.List<Resource> |
loadResourceLocal(java.lang.String name) |
Load a local exported resource from this class loader.
|
protected void |
postDefine(ClassSpec classSpec,
java.lang.Class<?> definedClass) |
A hook which is invoked after a class is defined.
|
protected void |
preDefine(ClassSpec classSpec,
java.lang.String className) |
A hook which is invoked before a class is defined.
|
void |
setClassAssertionStatus(java.lang.String className,
boolean enabled) |
|
void |
setDefaultAssertionStatus(boolean enabled) |
|
void |
setPackageAssertionStatus(java.lang.String packageName,
boolean enabled) |
|
java.lang.String |
toString() |
Get a string representation of this class loader.
|
defineClass, defineClass, defineClass, defineClass, findLoadedClass, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setSignersdefineOrLoadClass, defineOrLoadClass, findClass, findClass, findLoadedPackage, findResource, findResource, findResources, getPackage, getResource, getResourceAsStream, getResources, loadClass, loadClass, loadExportedClass, loadExportedClassprotected ModuleClassLoader(ModuleClassLoader.Configuration configuration)
configuration - the module class loader configuration to useprotected final java.lang.Class<?> findClass(java.lang.String className,
boolean exportsOnly,
boolean resolve)
throws java.lang.ClassNotFoundException
ClassNotFoundException.
If a class is to be defined by this method, it should be done via one of the atomic defineOrLoadClass
methods rather than defineClass() in order to avoid spurious exceptions.
findClass in class ConcurrentClassLoaderclassName - the class nameexportsOnly - true if only exported classes should be consideredresolve - true if the class should be linked after loadingjava.lang.ClassNotFoundException - if the class is not foundprotected java.lang.String getClassNotFoundExceptionMessage(java.lang.String className,
Module fromModule)
className - the name of the class which is missingfromModule - the module from which the class could not be foundpublic java.lang.Class<?> loadClassLocal(java.lang.String className)
throws java.lang.ClassNotFoundException
className - the class name to loadnull if it was not foundjava.lang.ClassNotFoundException - if an exception occurs while loading the class or its dependenciespublic java.lang.Class<?> loadClassLocal(java.lang.String className,
boolean resolve)
throws java.lang.ClassNotFoundException
className - the class nameresolve - true to resolve the loaded classnull if it was not foundjava.lang.ClassNotFoundException - if an error occurs while loading the classpublic java.util.List<Resource> loadResourceLocal(java.lang.String name)
name - the resource nameprotected void preDefine(ClassSpec classSpec, java.lang.String className)
classSpec - the class spec of the defined classclassName - the class to be definedprotected void postDefine(ClassSpec classSpec, java.lang.Class<?> definedClass)
classSpec - the class spec of the defined classdefinedClass - the class that was definedprotected final java.lang.String findLibrary(java.lang.String libname)
findLibrary in class java.lang.ClassLoaderlibname - the library namepublic final java.net.URL findResource(java.lang.String name,
boolean exportsOnly)
findResource in class ConcurrentClassLoadername - the resource nameexportsOnly - true to consider only exported resources or false to consider all resourcesConcurrentClassLoader.getResource(String)public final java.util.Enumeration<java.net.URL> findResources(java.lang.String name,
boolean exportsOnly)
findResources in class ConcurrentClassLoadername - the resource nameexportsOnly - true to consider only exported resources or false to consider all resourcesConcurrentClassLoader.getResources(String)public final java.io.InputStream findResourceAsStream(java.lang.String name,
boolean exportsOnly)
findResourceAsStream in class ConcurrentClassLoadername - the resource nameexportsOnly - true to consider only exported resources or false to consider all resourcesnull if the resource is not foundpublic final Module getModule()
public final java.lang.String getName()
getName in class NamedClassLoaderpublic final java.lang.String toString()
toString in class java.lang.Objectprotected final java.lang.Package definePackage(java.lang.String name,
java.lang.String specTitle,
java.lang.String specVersion,
java.lang.String specVendor,
java.lang.String implTitle,
java.lang.String implVersion,
java.lang.String implVendor,
java.net.URL sealBase)
throws java.lang.IllegalArgumentException
definePackage in class ConcurrentClassLoadername - the package namespecTitle - the specification titlespecVersion - the specification versionspecVendor - the specification vendorimplTitle - the implementation titleimplVersion - the implementation versionimplVendor - the implementation vendorsealBase - if not null, then this package is sealed with respect to the given code source URLjava.lang.IllegalArgumentExceptionprotected final java.lang.Package getPackageByName(java.lang.String name)
getPackageByName in class ConcurrentClassLoadername - the package namenull if no such package is visible to this class loaderprotected final java.lang.Package[] getPackages()
getPackages in class ConcurrentClassLoaderpublic final void setDefaultAssertionStatus(boolean enabled)
setDefaultAssertionStatus in class java.lang.ClassLoaderpublic final void setPackageAssertionStatus(java.lang.String packageName,
boolean enabled)
setPackageAssertionStatus in class java.lang.ClassLoaderpublic final void setClassAssertionStatus(java.lang.String className,
boolean enabled)
setClassAssertionStatus in class java.lang.ClassLoaderpublic final void clearAssertionStatus()
clearAssertionStatus in class java.lang.ClassLoaderpublic final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectprotected final java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionprotected final void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic final java.util.Iterator<Resource> iterateResources(java.lang.String startName, boolean recurse)
startName - the directory name to searchrecurse - true to recurse into subdirectories, false otherwisepublic final java.util.Set<java.lang.String> getLocalPaths()
Copyright © 2022 JBoss by Red Hat. All rights reserved.