public static class ClassFileLocator.ForClassLoader.WeaklyReferenced extends java.lang.ref.WeakReference<java.lang.ClassLoader> implements ClassFileLocator
A class file locator that queries a class loader for binary representations of class files. The class loader is only weakly referenced.
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.
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 int |
hashCode
The represented class loader's hash code.
|
CLASS_FILE_EXTENSION| Modifier | Constructor and Description |
|---|---|
protected |
WeaklyReferenced(java.lang.ClassLoader classLoader)
Creates a class file locator for a class loader that is weakly referenced.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
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(java.lang.ClassLoader classLoader)
Creates a class file locator for a given class loader.
|
protected WeaklyReferenced(java.lang.ClassLoader classLoader)
classLoader - The class loader to represent.public static ClassFileLocator of(java.lang.ClassLoader classLoader)
classLoader - The class loader to be used. If this class loader represents the bootstrap class
loader which is represented by the null value, this system class loader
is used instead.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.public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Object