public static class ClassFileLocator.ForModule.WeaklyReferenced extends WeakReference<Object> implements ClassFileLocator
A class file locator for a Java module that only references this module weakly. If a module was garbage collected, this class file locator only returns unresolved resolutions.
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.Compound, ClassFileLocator.Filtering, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.MultiReleaseAware, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
CLASS_FILE_EXTENSION, META_INF_VERSIONS
Modifier | Constructor and Description |
---|---|
protected |
WeaklyReferenced(Object module)
Creates a class file locator for a Java module that is weakly referenced.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
equals(Object other) |
int |
hashCode() |
ClassFileLocator.Resolution |
locate(String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(JavaModule module)
Creates a class file locator for a Java module where the module is referenced weakly.
|
protected WeaklyReferenced(Object module)
module
- The raw Java module to represent.public static ClassFileLocator of(JavaModule module)
module
- The Java module to represent.public ClassFileLocator.Resolution locate(String name) throws IOException
locate
in interface ClassFileLocator
name
- The name of the type to locate a class file representation for.IOException
- If reading a class file causes an error.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean equals(@MaybeNull Object other)
Copyright © 2014–2024. All rights reserved.