@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.ForModule extends java.lang.Object implements ClassFileLocator
A class file locator that locates class files by querying a Java module's getResourceAsStream method.
Important: Even when calling Closeable.close() on this class file locator, no underlying
class loader is closed if it implements the Closeable interface as this is typically not intended.
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassFileLocator.ForModule.WeaklyReferenced
A class file locator for a Java module that only references this module weakly.
|
ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple| Modifier and Type | Field and Description |
|---|---|
private JavaModule |
module
The represented Java module.
|
private static java.lang.Object[] |
NO_ARGUMENTS
An empty array that can be used to indicate no arguments to avoid an allocation on a reflective call.
|
CLASS_FILE_EXTENSION| Modifier | Constructor and Description |
|---|---|
protected |
ForModule(JavaModule module)
Creates a new class file locator for a Java module.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected static ClassFileLocator.Resolution |
locate(JavaModule module,
java.lang.String typeName)
Creates a resolution for a Java module's class files.
|
ClassFileLocator.Resolution |
locate(java.lang.String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(JavaModule module)
Returns a class file locator for the provided module.
|
static ClassFileLocator |
ofBootLayer()
Returns a class file locator that exposes all class files of the boot module layer.
|
private static final java.lang.Object[] NO_ARGUMENTS
private final JavaModule module
protected ForModule(JavaModule module)
module - The represented Java module.public static ClassFileLocator ofBootLayer()
public static ClassFileLocator of(JavaModule module)
module - The module to create a class file locator for.public ClassFileLocator.Resolution locate(java.lang.String name) throws java.io.IOException
locate in interface ClassFileLocatorname - The name of the type to locate a class file representation for.java.io.IOException - If reading a class file causes an error.protected static ClassFileLocator.Resolution locate(JavaModule module, java.lang.String typeName) throws java.io.IOException
module - The Java module to query.typeName - The name of the type being queried.java.io.IOException - If an I/O exception was thrown.public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseable