Package io.github.classgraph
Class ModuleRef
- java.lang.Object
-
- io.github.classgraph.ModuleRef
-
-
Constructor Summary
Constructors Constructor Description ModuleRef(java.lang.Object moduleReference, java.lang.Object moduleLayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ModuleRef o)booleanequals(java.lang.Object obj)java.lang.ClassLoadergetClassLoader()java.lang.ObjectgetDescriptor()java.lang.ObjectgetLayer()java.net.URIgetLocation()java.io.FilegetLocationFile()java.lang.StringgetLocationStr()java.lang.StringgetName()java.util.List<java.lang.String>getPackages()java.lang.StringgetRawVersion()Get the raw version string of the module, or null if the module did not provide one.java.lang.ObjectgetReference()inthashCode()booleanisSystemModule()ModuleReaderProxyopen()Open the module, returning aModuleReaderProxy.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- The module name, i.e.
getReference().descriptor().name().
-
getReference
public java.lang.Object getReference()
- Returns:
- The module reference (of JPMS type ModuleReference).
-
getLayer
public java.lang.Object getLayer()
- Returns:
- The module layer (of JPMS type ModuleLayer).
-
getDescriptor
public java.lang.Object getDescriptor()
- Returns:
- The module descriptor, i.e.
getReference().descriptor()(of JPMS type ModuleDescriptor).
-
getPackages
public java.util.List<java.lang.String> getPackages()
- Returns:
- The list of packages in the module. (Does not include non-package directories.)
-
getLocation
public java.net.URI getLocation()
- Returns:
- The module location, i.e.
getReference().location(). Returns null for modules that do not have a location.
-
getLocationStr
public java.lang.String getLocationStr()
- Returns:
- The module location as a string, i.e.
getReference().location().toString(). Returns null for modules that do not have a location.
-
getLocationFile
public java.io.File getLocationFile()
- Returns:
- The module location as a File, i.e.
new File(getReference().location()). Returns null for modules that do not have a location, or for system ("jrt:") modules.
-
getRawVersion
public java.lang.String getRawVersion()
Get the raw version string of the module, or null if the module did not provide one.- Returns:
- The raw version of the module, obtained by
ModuleReference#rawVersion().orElse(null).
-
isSystemModule
public boolean isSystemModule()
- Returns:
- true if this module's location is a non-"file:" (i.e. "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.).
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
- Returns:
- The classloader for the module, i.e.
moduleLayer.findLoader(getReference().descriptor().name()).
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(ModuleRef o)
- Specified by:
compareToin interfacejava.lang.Comparable<ModuleRef>
-
open
public ModuleReaderProxy open() throws java.io.IOException
Open the module, returning aModuleReaderProxy.- Returns:
- A
ModuleReaderProxyfor the module. - Throws:
java.io.IOException- If the module cannot be opened.
-
-