Package io.github.classgraph
Class ClasspathElementModule
java.lang.Object
io.github.classgraph.ClasspathElement
io.github.classgraph.ClasspathElementModule
- All Implemented Interfaces:
Comparable<ClasspathElement>
A module classpath element.
-
Field Summary
FieldsModifier and TypeFieldDescriptionAll resource paths.private Recycler
<ModuleReaderProxy, IOException> The module reader proxy recycler.(package private) final ModuleRef
The module ref.(package private) SingletonMap
<ModuleRef, Recycler<ModuleReaderProxy, IOException>, IOException> A singleton map from aModuleRef
to aModuleReaderProxy
recycler for the module.Fields inherited from class io.github.classgraph.ClasspathElement
acceptedClassfileResources, acceptedResources, childClasspathElements, classLoader, classpathElementIdx, classpathElementIdxWithinParent, containsSpecificallyAcceptedClasspathElementResourcePath, fileToLastModified, moduleNameFromModuleDescriptor, nestedClasspathRootPrefixes, packageRootPrefix, scanned, scanSpec, skipClasspathElement
-
Constructor Summary
ConstructorsConstructorDescriptionClasspathElementModule
(ModuleRef moduleRef, SingletonMap<ModuleRef, Recycler<ModuleReaderProxy, IOException>, IOException> moduleRefToModuleReaderProxyRecyclerMap, Scanner.ClasspathEntryWorkUnit workUnit, ScanSpec scanSpec) A zip/jarfile classpath element. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Equals.Get the URI for this classpath element, and the URIs for any automatic nested package prefixes (e.g.(package private) File
getFile()
Get the file for this classpath element, or null if this is a module with a "jrt:" URI.Get the module name from the module reference or the module descriptor.private String
Get the module name from the module reference or the module descriptor.(package private) ModuleRef
Get the ModuleRef for this classpath element.(package private) Resource
getResource
(String relativePath) Get theResource
for a given relative path.(package private) URI
getURI()
Get the URI for this classpath element.int
hashCode()
Hash code.private Resource
newResource
(String resourcePath) Create a newResource
object for a resource or classfile discovered while scanning paths.(package private) void
open
(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueueIgnored, LogNode log) Determine if this classpath element is valid.(package private) void
Scan for package matches within module.toString()
Return the module reference as a String.Methods inherited from class io.github.classgraph.ClasspathElement
addAcceptedResource, checkResourcePathAcceptReject, compareTo, finishScanPaths, getClassLoader, getNumClassfileMatches, log, log, maskClassfiles
-
Field Details
-
moduleRef
The module ref. -
moduleRefToModuleReaderProxyRecyclerMap
SingletonMap<ModuleRef,Recycler<ModuleReaderProxy, moduleRefToModuleReaderProxyRecyclerMapIOException>, IOException> A singleton map from aModuleRef
to aModuleReaderProxy
recycler for the module. -
moduleReaderProxyRecycler
The module reader proxy recycler. -
allResourcePaths
All resource paths.
-
-
Constructor Details
-
ClasspathElementModule
ClasspathElementModule(ModuleRef moduleRef, SingletonMap<ModuleRef, Recycler<ModuleReaderProxy, IOException>, IOException> moduleRefToModuleReaderProxyRecyclerMap, Scanner.ClasspathEntryWorkUnit workUnit, ScanSpec scanSpec) A zip/jarfile classpath element.- Parameters:
moduleRef
- the module refmoduleRefToModuleReaderProxyRecyclerMap
- the module ref to module reader proxy recycler mapworkUnit
- the work unitscanSpec
- the scan spec
-
-
Method Details
-
open
void open(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueueIgnored, LogNode log) throws InterruptedException Description copied from class:ClasspathElement
Determine if this classpath element is valid. If it is not valid, sets skipClasspathElement. ForClasspathElementZip
, may also open or extract inner jars, and also causes jarfile manifests to be read to look for Class-Path entries. If nested jars or Class-Path entries are found, they are added to the work queue. This method is only run once per classpath element, from a single thread.- Specified by:
open
in classClasspathElement
- Parameters:
workQueueIgnored
- the work queuelog
- the log- Throws:
InterruptedException
- if the thread was interrupted while trying to open the classpath element.
-
newResource
Create a newResource
object for a resource or classfile discovered while scanning paths.- Parameters:
resourcePath
- the resource path- Returns:
- the resource
-
getResource
Get theResource
for a given relative path.- Specified by:
getResource
in classClasspathElement
- Parameters:
relativePath
- The relative path of theResource
to return.- Returns:
- The
Resource
for the given relative path, or null if relativePath does not exist in this classpath element.
-
scanPaths
Scan for package matches within module.- Specified by:
scanPaths
in classClasspathElement
- Parameters:
log
- the log
-
getModuleRef
ModuleRef getModuleRef()Get the ModuleRef for this classpath element.- Returns:
- the module ref
-
getModuleName
Get the module name from the module reference or the module descriptor.- Specified by:
getModuleName
in classClasspathElement
- Returns:
- the module name, or null if the module does not have a name.
-
getModuleNameOrEmpty
Get the module name from the module reference or the module descriptor.- Returns:
- the module name, or the empty string if the module does not have a name.
-
getURI
URI getURI()Description copied from class:ClasspathElement
Get the URI for this classpath element.- Specified by:
getURI
in classClasspathElement
- Returns:
- the URI for the classpath element.
-
getAllURIs
Description copied from class:ClasspathElement
Get the URI for this classpath element, and the URIs for any automatic nested package prefixes (e.g. "spring-boot.jar/BOOT-INF/classes") within this jarfile.- Specified by:
getAllURIs
in classClasspathElement
- Returns:
- the URI for the classpath element.
-
getFile
File getFile()Description copied from class:ClasspathElement
Get the file for this classpath element, or null if this is a module with a "jrt:" URI.- Specified by:
getFile
in classClasspathElement
- Returns:
- the file for the classpath element.
-
toString
Return the module reference as a String. -
equals
Equals. -
hashCode
public int hashCode()Hash code.
-