public class ModuleRef extends Object implements Comparable<ModuleRef>
Constructor and Description |
---|
ModuleRef(Object moduleReference,
Object moduleLayer,
nonapi.io.github.classgraph.reflection.ReflectionUtils reflectionUtils)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ModuleRef o) |
boolean |
equals(Object obj) |
ClassLoader |
getClassLoader()
Get the class loader for the module.
|
Object |
getDescriptor()
Get the module descriptor, i.e.
|
Object |
getLayer()
Get the module layer (of JPMS type ModuleLayer).
|
URI |
getLocation()
Get the module location, i.e.
|
File |
getLocationFile()
Get the module location as a File, i.e.
|
String |
getLocationStr()
Get the module location as a string, i.e.
|
String |
getName()
Get the module name, i.e.
|
List<String> |
getPackages()
Get a list of packages in the module.
|
String |
getRawVersion()
Get the raw version string of the module, or null if the module did not provide one.
|
Object |
getReference()
Get the module reference (of JPMS type ModuleReference).
|
int |
hashCode() |
boolean |
isSystemModule()
Checks if this module is a system module.
|
ModuleReaderProxy |
open()
Open the module, returning a
ModuleReaderProxy . |
String |
toString() |
public ModuleRef(Object moduleReference, Object moduleLayer, nonapi.io.github.classgraph.reflection.ReflectionUtils reflectionUtils)
moduleReference
- The module reference, of JPMS type ModuleReference.moduleLayer
- The module layer, of JPMS type ModuleLayerreflectionUtils
- The ReflectionUtils instance.public String getName()
getReference().descriptor().name()
.getReference().descriptor().name()
. Potentially null or empty.public Object getReference()
public Object getLayer()
public Object getDescriptor()
getReference().descriptor()
(of JPMS type ModuleDescriptor).getReference().descriptor()
(of JPMS type ModuleDescriptor).public List<String> getPackages()
public URI getLocation()
getReference().location()
. Returns null for modules that do not have a
location.getReference().location()
. Returns null for modules that do not
have a location.public String getLocationStr()
getReference().location().toString()
. Returns null for
modules that do not have a location.getReference().location().toString()
. Returns null for
modules that do not have a location.public File getLocationFile()
new File(getReference().location())
. Returns null for modules
that do not have a location, or for system (or jlinked) modules, which have "jrt:" location URIs that include
only the module name and not the module jar location.new File(getReference().location())
. Returns null for
modules that do not have a location, or for modules whole location is a "jrt:" URI.public String getRawVersion()
ModuleReference#rawVersion().orElse(null)
.public boolean isSystemModule()
public ClassLoader getClassLoader()
moduleLayer.findLoader(getReference().descriptor().name())
.public int compareTo(ModuleRef o)
compareTo
in interface Comparable<ModuleRef>
public ModuleReaderProxy open() throws IOException
ModuleReaderProxy
.ModuleReaderProxy
for the module.IOException
- If the module cannot be opened.Copyright © 2024. All rights reserved.