Package io.github.classgraph
Class ClasspathElementModule
- java.lang.Object
-
- io.github.classgraph.ClasspathElement
-
- io.github.classgraph.ClasspathElementModule
-
- All Implemented Interfaces:
java.lang.Comparable<ClasspathElement>
class ClasspathElementModule extends ClasspathElement
A module classpath element.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.String>
allResourcePaths
All resource paths.private Recycler<ModuleReaderProxy,java.io.IOException>
moduleReaderProxyRecycler
The module reader proxy recycler.(package private) ModuleRef
moduleRef
The module ref.(package private) SingletonMap<ModuleRef,Recycler<ModuleReaderProxy,java.io.IOException>,java.io.IOException>
moduleRefToModuleReaderProxyRecyclerMap
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
Constructors Constructor Description ClasspathElementModule(ModuleRef moduleRef, SingletonMap<ModuleRef,Recycler<ModuleReaderProxy,java.io.IOException>,java.io.IOException> moduleRefToModuleReaderProxyRecyclerMap, Scanner.ClasspathEntryWorkUnit workUnit, ScanSpec scanSpec)
A zip/jarfile classpath element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Equals.(package private) java.util.List<java.net.URI>
getAllURIs()
Get the URI for this classpath element, and the URIs for any automatic nested package prefixes (e.g.(package private) java.io.File
getFile()
Get the file for this classpath element, or null if this is a module with a "jrt:" URI.java.lang.String
getModuleName()
Get the module name from the module reference or the module descriptor.private java.lang.String
getModuleNameOrEmpty()
Get the module name from the module reference or the module descriptor.(package private) ModuleRef
getModuleRef()
Get the ModuleRef for this classpath element.(package private) Resource
getResource(java.lang.String relativePath)
Get theResource
for a given relative path.(package private) java.net.URI
getURI()
Get the URI for this classpath element.int
hashCode()
Hash code.private Resource
newResource(java.lang.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
scanPaths(LogNode log)
Scan for package matches within module.java.lang.String
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 Detail
-
moduleRef
final ModuleRef moduleRef
The module ref.
-
moduleRefToModuleReaderProxyRecyclerMap
SingletonMap<ModuleRef,Recycler<ModuleReaderProxy,java.io.IOException>,java.io.IOException> moduleRefToModuleReaderProxyRecyclerMap
A singleton map from aModuleRef
to aModuleReaderProxy
recycler for the module.
-
moduleReaderProxyRecycler
private Recycler<ModuleReaderProxy,java.io.IOException> moduleReaderProxyRecycler
The module reader proxy recycler.
-
allResourcePaths
private final java.util.Set<java.lang.String> allResourcePaths
All resource paths.
-
-
Constructor Detail
-
ClasspathElementModule
ClasspathElementModule(ModuleRef moduleRef, SingletonMap<ModuleRef,Recycler<ModuleReaderProxy,java.io.IOException>,java.io.IOException> moduleRefToModuleReaderProxyRecyclerMap, Scanner.ClasspathEntryWorkUnit workUnit, ScanSpec scanSpec)
A zip/jarfile classpath element.- Parameters:
moduleRef
- the module refworkUnit
- the work unitmoduleRefToModuleReaderProxyRecyclerMap
- the module ref to module reader proxy recycler mapscanSpec
- the scan spec
-
-
Method Detail
-
open
void open(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueueIgnored, LogNode log) throws java.lang.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:
java.lang.InterruptedException
- if the thread was interrupted while trying to open the classpath element.
-
newResource
private Resource newResource(java.lang.String resourcePath)
Create a newResource
object for a resource or classfile discovered while scanning paths.- Parameters:
resourcePath
- the resource path- Returns:
- the resource
-
getResource
Resource getResource(java.lang.String relativePath)
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
void scanPaths(LogNode log)
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
public java.lang.String 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
private java.lang.String 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
java.net.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
java.util.List<java.net.URI> 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
java.io.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
public java.lang.String toString()
Return the module reference as a String.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string
-
equals
public boolean equals(java.lang.Object obj)
Equals.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the obj- Returns:
- true, if successful
-
hashCode
public int hashCode()
Hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the int
-
-