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 classModuleRef.ModuleReaderProxy
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ModuleRef o)booleanequals(Object obj)static List<ModuleRef>findModuleRefs(Class<?>[] callStack)Get all visible ModuleReferences in all layers, given an array of stack frameClass<?>references.ClassLoadergetClassLoader()Returns the classloader for the module, i.e.ObjectgetModuleDescriptor()Returns the module descriptor, i.e.ObjectgetModuleLayer()Returns the module layer (type ModuleLayer).URIgetModuleLocation()Returns the module location, i.e.FilegetModuleLocationFile()Returns the module location as a File, i.e.StringgetModuleLocationStr()Returns the module location as a string, i.e.StringgetModuleName()Returns the module name, i.e.List<String>getModulePackages()Returns the list of packages in the module.ObjectgetModuleReference()Returns the module reference (type ModuleReference).inthashCode()booleanisSystemModule()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.ModuleReaderProxyopen()Open the module, returning a ModuleReader.StringtoString()
-
-
-
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:
compareToin interfaceComparable<ModuleRef>
-
open
public ModuleRef.ModuleReaderProxy open() throws IOException
Open the module, returning a ModuleReader.- Throws:
IOException
-
-