Top Description Inners Fields Constructors Methods
org.jboss.modules

public Class ModuleClassLoader

extends ConcurrentClassLoader
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, java.nio.ByteBuffer, java.security.PermissionCollection, .ProtectionDomain, .CodeSource, java.util.IdentityHashMap, .Iterator, .NoSuchElementException, .ArrayList, .Collections, .Enumeration, .HashMap, .List, .Map, .Set, org.jboss.modules.filter.PathFilter, .PathFilters, org.jboss.modules.log.ModuleLogger, org.jboss.modules.security.ModularProtectionDomain, java.io.IOException, .InputStream, java.net.URL, java.util.concurrent.atomic.AtomicReference

A module classloader. Instances of this class implement the complete view of classes and resources available in a module. Contrast with Module, which has API methods to access the exported view of classes and resources.
Authors
John Bailey, David M. Lloyd, Richard Opalka, [email protected]

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ModuleClassLoader.Configuration

An opaque configuration used internally to create a module class loader.

Field Summary

Modifier and TypeField and Description
private final LocalLoader
private final Module
private final AtomicReference<Paths<ResourceLoader, ResourceLoaderSpec>>
private final IdentityHashMap<CodeSource, ProtectionDomain>
private final ClassTransformer
Inherited from org.jboss.modules.ConcurrentClassLoader:
EMPTY_ENUMERATION

Constructor Summary

AccessConstructor and Description
protected
ModuleClassLoader(final ModuleClassLoader.Configuration
the module class loader configuration to use
configuration
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public final void
clearAssertionStatus()

Overrides java.lang.ClassLoader.clearAssertionStatus.

Sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader.
protected final Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
private Class<?>

Returns:

the new class
defineClass
(final String
the 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 package
definePackage
(final String
the 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 null, then this package is sealed with respect to the given code source URL
sealBase
)

Overrides org.jboss.modules.ConcurrentClassLoader.definePackage.

Defines a package by name in this ConcurrentClassLoader.
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.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
protected final void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
protected final Class<?>
findClass(String
the class name
className
,
boolean
true if only exported classes should be considered
exportsOnly
,
final boolean
true if the class should be linked after loading
resolve
)

Overrides org.jboss.modules.ConcurrentClassLoader.findClass.

Find a class, possibly delegating to other loader(s).
protected final String

Returns:

the full absolute path to the library
findLibrary
(final String
the library name
libname
)

Overrides java.lang.ClassLoader.findLibrary.

Find a library from one of the resource loaders.
public final URL
findResource(final String
the resource name
name
,
final boolean
true to consider only exported resources or false to consider all resources
exportsOnly
)

Overrides org.jboss.modules.ConcurrentClassLoader.findResource.

Find the resource with the given name and exported status.
public final InputStream
findResourceAsStream(final String
the resource name
name
,
boolean
true to consider only exported resources or false to consider all resources
exportsOnly
)

Overrides org.jboss.modules.ConcurrentClassLoader.findResourceAsStream.

Finds the resource with the given name and exported status, returning the resource content as a stream.
public final Enumeration<URL>
findResources(final String
the resource name
name
,
final boolean
true to consider only exported resources or false to consider all resources
exportsOnly
)

Overrides org.jboss.modules.ConcurrentClassLoader.findResources.

Finds the resources with the given name and exported status.
protected String

Returns:

an exception message used when producing instances of ClassNotFoundException
getClassNotFoundExceptionMessage
(String
the 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 loader
getLocalLoader
()

Get the local loader which refers to this module class loader.

public final Set<String>

Returns:

the set of local paths
getLocalPaths
()

Get the (unmodifiable) set of paths which are locally available in this module class loader.

public final Module

Returns:

the module
getModule
()

Get the module for this class loader.

public final String

Returns:

the name of this module
getName
()

Overrides org.jboss.modules.NamedClassLoader.getName.

Get the name of this module.
protected final Package
getPackageByName(final String
the package name
name
)

Overrides org.jboss.modules.ConcurrentClassLoader.getPackageByName.

Perform the actual work to load a package which is visible to this class loader.
protected final Package[]
getPackages()

Overrides org.jboss.modules.ConcurrentClassLoader.getPackages.

Get all defined packages which are visible to this class loader.
pack-priv Set<String>
private ProtectionDomain
pack-priv ResourceLoader[]
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public final Iterator<Resource>

Returns:

the resource iterator
iterateResources
(final String
the directory name to search
startName
,
final boolean
true to recurse into subdirectories, false otherwise
recurse
)

Iterate the resources within this module class loader.

public Class<?>

Returns:

the loaded class or null if it was not found
loadClassLocal
(String
the class name to load
className
)

Load a class from this class loader.

public Class<?>

Returns:

the loaded class or null if it was not found
loadClassLocal
(final String
the class name
className
,
final boolean
true to resolve the loaded class
resolve
)

Load a local class from this class loader.

pack-priv Resource

Returns:

the resource, or null if it was not found
loadResourceLocal
(final String
the 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<Resource>

Returns:

the list of resources
loadResourceLocal
(final String
the 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
preDefine(ClassSpec
the class spec of the defined class
classSpec
,
String
the class to be defined
className
)

A hook which is invoked before a class is defined.

pack-priv boolean

Returns:

true if the paths were recalculated, or false if another thread finished recalculating before the calling thread
recalculate
()

Recalculate 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.
enabled
)

Overrides java.lang.ClassLoader.setClassAssertionStatus.

Sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein.
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.
enabled
)

Overrides java.lang.ClassLoader.setDefaultAssertionStatus.

Sets the default assertion status for this class loader.
public final void
setPackageAssertionStatus(final String
The name of the package whose package default assertion status is to be set. A null value indicates the unnamed package that is "current" (see section 7.4.2 of The Java Language Specification.)
packageName
,
final boolean
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.
enabled
)

Overrides java.lang.ClassLoader.setPackageAssertionStatus.

Sets the package default assertion status for the named package.
pack-priv boolean

Returns:

true if the paths were recalculated, or false if another thread finished recalculating before the calling thread
setResourceLoaders
(final ResourceLoaderSpec[]
the new resource loaders
resourceLoaders
)

Change the set of resource loaders for this module class loader, and recalculate the path maps.

private boolean
public final String

Returns:

the string
toString
()

Overrides java.lang.Object.toString.

Get a string representation of this class loader.
Inherited from org.jboss.modules.ConcurrentClassLoader:
defineOrLoadClassdefineOrLoadClassfindClassfindClassfindLoadedPackagefindResourcefindResourcefindResourcesfindSystemClassInternalgetLockForClassgetPackagegetResourcegetResourceAsStreamgetResourcesloadClassloadClassloadExportedClassloadExportedClass

Field Detail

localLoaderback to summary
private final LocalLoader localLoader
moduleback to summary
private final Module module
pathsback to summary
private final AtomicReference<Paths<ResourceLoader, ResourceLoaderSpec>> paths
protectionDomainsback to summary
private final IdentityHashMap<CodeSource, ProtectionDomain> protectionDomains
transformerback to summary
private final ClassTransformer transformer

Constructor Detail

ModuleClassLoaderback to summary
protected ModuleClassLoader(final ModuleClassLoader.Configuration configuration)

Construct a new instance.

Parameters
configuration:ModuleClassLoader.Configuration

the module class loader configuration to use

Method Detail

clearAssertionStatusback to summary
public final void clearAssertionStatus()

Overrides java.lang.ClassLoader.clearAssertionStatus.

Doc from java.lang.ClassLoader.clearAssertionStatus.

Sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader. This method is provided so that class loaders can be made to ignore any command line or persistent assertion status settings and "start with a clean slate."

Annotations
@Override
cloneback to summary
protected final Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

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 x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

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 super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
defineClassback to summary
private Class<?> defineClass(final String name, final ClassSpec classSpec, final ResourceLoader resourceLoader)

Define a class from a class name and class spec. Also defines any enclosing Package instances, and performs any sealed-package checks.

Parameters
name:String

the class name

classSpec:ClassSpec

the class spec

resourceLoader:ResourceLoader

the resource loader of the class spec

Returns:Class<?>

the new class

defineClassInternalback to summary
pack-priv Class<?> defineClassInternal(final String className, ByteBuffer byteBuffer, final ProtectionDomain protectionDomain)
defineClassInternalback to summary
pack-priv Class<?> defineClassInternal(final String className, byte[] bytes, int off, int len, final ProtectionDomain protectionDomain)
definePackageback to summary
private Package definePackage(final String name, final PackageSpec spec)

Define a package from a package spec.

Parameters
name:String

the package name

spec:PackageSpec

the package specification

Returns:Package

the new package

definePackageback 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.jboss.modules.ConcurrentClassLoader.definePackage.

Doc from org.jboss.modules.ConcurrentClassLoader.definePackage.

Defines a package by name in this ConcurrentClassLoader. If the package was already defined, the existing package is returned instead.

Parameters
name:String

the package name

specTitle:String

the specification title

specVersion:String

the specification version

specVendor:String

the specification vendor

implTitle:String

the implementation title

implVersion:String

the implementation version

implVendor:String

the implementation vendor

sealBase:URL

if not null, then this package is sealed with respect to the given code source URL

Returns:Package

the newly defined package, or the existing one if one was already defined

Annotations
@Override
Exceptions
IllegalArgumentException:

Doc from java.lang.ClassLoader.definePackage.

if a package of the given name is already defined by this class loader

doDefineOrLoadClassback to summary
private Class<?> doDefineOrLoadClass(final String className, final byte[] bytes, final ByteBuffer byteBuffer, ProtectionDomain protectionDomain)
equalsback to summary
public final boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
finalizeback to summary
protected final void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

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 finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
findClassback to summary
protected final Class<?> findClass(String className, boolean exportsOnly, final boolean resolve) throws ClassNotFoundException

Overrides org.jboss.modules.ConcurrentClassLoader.findClass.

Doc from org.jboss.modules.ConcurrentClassLoader.findClass.

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 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.

Parameters
className:String

the class name

exportsOnly:boolean

true if only exported classes should be considered

resolve:boolean

true if the class should be linked after loading

Returns:Class<?>

the class

Annotations
@Override
Exceptions
ClassNotFoundException:
if the class is not found
findLibraryback to summary
protected final String findLibrary(final String libname)

Overrides java.lang.ClassLoader.findLibrary.

Find a library from one of the resource loaders.

Parameters
libname:String

the library name

Returns:String

the full absolute path to the library

Annotations
@Override
findResourceback to summary
public final URL findResource(final String name, final boolean exportsOnly)

Overrides org.jboss.modules.ConcurrentClassLoader.findResource.

Doc from org.jboss.modules.ConcurrentClassLoader.findResource.

Find the resource with the given name and exported status.

Parameters
name:String

the resource name

exportsOnly:boolean

true to consider only exported resources or false to consider all resources

Returns:URL

the resource URL

Annotations
@Override
findResourceAsStreamback to summary
public final InputStream findResourceAsStream(final String name, boolean exportsOnly)

Overrides org.jboss.modules.ConcurrentClassLoader.findResourceAsStream.

Doc from org.jboss.modules.ConcurrentClassLoader.findResourceAsStream.

Finds the resource with the given name and exported status, returning the resource content as a stream.

Parameters
name:String

the resource name

exportsOnly:boolean

true to consider only exported resources or false to consider all resources

Returns:InputStream

the resource stream, or null if the resource is not found

Annotations
@Override
findResourcesback to summary
public final Enumeration<URL> findResources(final String name, final boolean exportsOnly)

Overrides org.jboss.modules.ConcurrentClassLoader.findResources.

Doc from org.jboss.modules.ConcurrentClassLoader.findResources.

Finds the resources with the given name and exported status.

Parameters
name:String

the resource name

exportsOnly:boolean

true to consider only exported resources or false to consider all resources

Returns:Enumeration<URL>

the resource enumeration

Annotations
@Override
getClassNotFoundExceptionMessageback 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.

Parameters
className:String

the name of the class which is missing

fromModule:Module

the module from which the class could not be found

Returns:String

an exception message used when producing instances of ClassNotFoundException

getLocalLoaderback to summary
pack-priv LocalLoader getLocalLoader()

Get the local loader which refers to this module class loader.

Returns:LocalLoader

the local loader

getLocalPathsback to summary
public final Set<String> getLocalPaths()

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.

Returns:Set<String>

the set of local paths

getModuleback to summary
public final Module getModule()

Get the module for this class loader.

Returns:Module

the module

getNameback to summary
public final String getName()

Overrides org.jboss.modules.NamedClassLoader.getName.

Get the name of this module. This method is used by Java 9 in debug output.

Returns:String

the name of this module

getPackageByNameback to summary
protected final Package getPackageByName(final String name)

Overrides org.jboss.modules.ConcurrentClassLoader.getPackageByName.

Doc from org.jboss.modules.ConcurrentClassLoader.getPackageByName.

Perform the actual work to load a package which is visible to this class loader. By default, uses a simple parent-first delegation strategy.

Parameters
name:String

the package name

Returns:Package

the package, or null if no such package is visible to this class loader

Annotations
@Override
getPackagesback to summary
protected final Package[] getPackages()

Overrides org.jboss.modules.ConcurrentClassLoader.getPackages.

Doc from org.jboss.modules.ConcurrentClassLoader.getPackages.

Get all defined packages which are visible to this class loader.

Returns:Package[]

the packages

Annotations
@Override
getPathsback to summary
pack-priv Set<String> getPaths()
getProtectionDomainback to summary
private ProtectionDomain getProtectionDomain(CodeSource codeSource)
getResourceLoadersback to summary
pack-priv ResourceLoader[] getResourceLoaders()
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
iterateResourcesback to summary
public final Iterator<Resource> iterateResources(final String startName, final boolean recurse)

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.

Parameters
startName:String

the directory name to search

recurse:boolean

true to recurse into subdirectories, false otherwise

Returns:Iterator<Resource>

the resource iterator

loadClassLocalback to summary
public Class<?> loadClassLocal(String className) throws ClassNotFoundException

Load a class from this class loader.

Parameters
className:String

the class name to load

Returns:Class<?>

the loaded class or null if it was not found

Exceptions
ClassNotFoundException:
if an exception occurs while loading the class or its dependencies
loadClassLocalback to summary
public Class<?> loadClassLocal(final String className, final boolean resolve) throws ClassNotFoundException

Load a local class from this class loader.

Parameters
className:String

the class name

resolve:boolean

true to resolve the loaded class

Returns:Class<?>

the loaded class or null if it was not found

Exceptions
ClassNotFoundException:
if an error occurs while loading the class
loadResourceLocalback 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.

Parameters
root:String

the root name

name:String

the resource name

Returns:Resource

the resource, or null if it was not found

Annotations
@Deprecated
loadResourceLocalback to summary
public List<Resource> loadResourceLocal(final String name)

Load a local exported resource from this class loader.

Parameters
name:String

the resource name

Returns:List<Resource>

the list of resources

postDefineback to summary
protected void postDefine(ClassSpec classSpec, Class<?> definedClass)

A hook which is invoked after a class is defined.

Parameters
classSpec:ClassSpec

the class spec of the defined class

definedClass:Class<?>

the class that was defined

Annotations
@SuppressWarnings:unused
preDefineback to summary
protected void preDefine(ClassSpec classSpec, String className)

A hook which is invoked before a class is defined.

Parameters
classSpec:ClassSpec

the class spec of the defined class

className:String

the class to be defined

Annotations
@SuppressWarnings:unused
recalculateback to summary
pack-priv boolean recalculate()

Recalculate the path maps for this module class loader.

Returns:boolean

true if the paths were recalculated, or false if another thread finished recalculating before the calling thread

setClassAssertionStatusback to summary
public final void setClassAssertionStatus(final String className, final boolean enabled)

Overrides java.lang.ClassLoader.setClassAssertionStatus.

Doc from java.lang.ClassLoader.setClassAssertionStatus.

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.

Parameters
className:String

The fully qualified class name of the top-level class whose assertion status is to be set.

enabled: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.

Annotations
@Override
setDefaultAssertionStatusback to summary
public final void setDefaultAssertionStatus(final boolean enabled)

Overrides java.lang.ClassLoader.setDefaultAssertionStatus.

Doc from java.lang.ClassLoader.setDefaultAssertionStatus.

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(String, boolean) or setClassAssertionStatus(String, boolean).

Parameters
enabled: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.

Annotations
@Override
setPackageAssertionStatusback to summary
public final void setPackageAssertionStatus(final String packageName, final boolean enabled)

Overrides java.lang.ClassLoader.setPackageAssertionStatus.

Doc from java.lang.ClassLoader.setPackageAssertionStatus.

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 "p.". For example, javax.swing.text is a subpackage of javax.swing, and both java.util and java.lang.reflect are subpackages of java.

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 javax.lang and javax.lang.reflect both have package defaults associated with them, the latter package default applies to classes in javax.lang.reflect.

Package defaults take precedence over the class loader's default assertion status, and may be overridden on a per-class basis by invoking setClassAssertionStatus(String, boolean).

Parameters
packageName:String

The name of the package whose package default assertion status is to be set. A null value indicates the unnamed package that is "current" (see section 7.4.2 of The Java Language Specification.)

enabled:boolean

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.

Annotations
@Override
setResourceLoadersback 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.

Parameters
resourceLoaders:ResourceLoaderSpec[]

the new resource loaders

Returns:boolean

true if the paths were recalculated, or false if another thread finished recalculating before the calling thread

setResourceLoadersback to summary
private boolean setResourceLoaders(final Paths<ResourceLoader, ResourceLoaderSpec> paths, final ResourceLoaderSpec[] resourceLoaders)
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Get a string representation of this class loader.

Returns:String

the string

Annotations
@Override
org.jboss.modules back to summary

public final Class ModuleClassLoader.Configuration

extends Object
Class Inheritance

An opaque configuration used internally to create a module class loader.

Field Summary

Modifier and TypeField and Description
private final AssertionSetting
private final Module
private final ResourceLoaderSpec[]
private final ClassTransformer

Constructor Summary

AccessConstructor and Description
pack-priv
Configuration(final Module module, final AssertionSetting assertionSetting, final ResourceLoaderSpec[] resourceLoaders, final ClassTransformer transformer)

Method Summary

Modifier and TypeMethod and Description
pack-priv AssertionSetting
pack-priv Module
pack-priv ResourceLoaderSpec[]
pack-priv ClassTransformer
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

assertionSettingback to summary
private final AssertionSetting assertionSetting
moduleback to summary
private final Module module
resourceLoadersback to summary
private final ResourceLoaderSpec[] resourceLoaders
transformerback to summary
private final ClassTransformer transformer

Constructor Detail

Configurationback to summary
pack-priv Configuration(final Module module, final AssertionSetting assertionSetting, final ResourceLoaderSpec[] resourceLoaders, final ClassTransformer transformer)

Method Detail

getAssertionSettingback to summary
pack-priv AssertionSetting getAssertionSetting()
getModuleback to summary
pack-priv Module getModule()
getResourceLoadersback to summary
pack-priv ResourceLoaderSpec[] getResourceLoaders()
getTransformerback to summary
pack-priv ClassTransformer getTransformer()