Class ModuleRef
- java.lang.Object
-
- io.github.lukehutch.fastclasspathscanner.scanner.ModuleRef
-
- All Implemented Interfaces:
Comparable<ModuleRef>
public class ModuleRef extends Object implements Comparable<ModuleRef>
Work with modules using reflection, until support for JDK 8 and earlier is removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ModuleRef.ModuleReaderProxy
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ModuleRef o)
boolean
equals(Object obj)
static List<ModuleRef>
findModuleRefs(Class<?>[] callStack)
Get all visible ModuleReferences in all layers, given an array of stack frameClass<?>
references.ClassLoader
getClassLoader()
Returns the classloader for the module, i.e.Object
getModuleDescriptor()
Returns the module descriptor, i.e.Object
getModuleLayer()
Returns the module layer (type ModuleLayer).URI
getModuleLocation()
Returns the module location, i.e.File
getModuleLocationFile()
Returns the module location as a File, i.e.String
getModuleLocationStr()
Returns the module location as a string, i.e.String
getModuleName()
Returns the module name, i.e.List<String>
getModulePackages()
Returns the list of packages in the module.Object
getModuleReference()
Returns the module reference (type ModuleReference).int
hashCode()
boolean
isSystemModule()
Returns true if this module's location is a non-"file:/" ("jrt:/") URI, or if it has no location URI, or if it uses the (null) bootstrap ClassLoader, or if the module name starts with a system prefix ("java.", "jre.", etc.).ModuleRef.ModuleReaderProxy
open()
Open the module, returning a ModuleReader.String
toString()
-
-
-
Method Detail
-
getModuleName
public String getModuleName()
Returns the module name, i.e.moduleReference.descriptor().name()
.
-
getModuleReference
public Object getModuleReference()
Returns the module reference (type ModuleReference).
-
getModuleLayer
public Object getModuleLayer()
Returns the module layer (type ModuleLayer).
-
getModuleDescriptor
public Object getModuleDescriptor()
Returns the module descriptor, i.e.moduleReference.descriptor()
(type ModuleDescriptor).
-
getModulePackages
public List<String> getModulePackages()
Returns the list of packages in the module.
-
getModuleLocation
public URI getModuleLocation()
Returns the module location, i.e.moduleReference.location()
. Returns null for modules that do not have a location.
-
isSystemModule
public boolean isSystemModule()
Returns true if this module's location is a non-"file:/" ("jrt:/") URI, or if it has no location URI, or if it uses the (null) bootstrap ClassLoader, or if the module name starts with a system prefix ("java.", "jre.", etc.).
-
getModuleLocationStr
public String getModuleLocationStr()
Returns the module location as a string, i.e.moduleReference.location().toString()
. Returns null for modules that do not have a location.
-
getModuleLocationFile
public File getModuleLocationFile()
Returns the module location as a File, i.e.new File(moduleReference.location())
. Returns null for modules that do not have a location, or for system ("jrt:/") modules.
-
getClassLoader
public ClassLoader getClassLoader()
Returns the classloader for the module, i.e.moduleLayer.findLoader(moduleReference.descriptor().name())
.
-
compareTo
public int compareTo(ModuleRef o)
- Specified by:
compareTo
in interfaceComparable<ModuleRef>
-
open
public ModuleRef.ModuleReaderProxy open() throws IOException
Open the module, returning a ModuleReader.- Throws:
IOException
-
-