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>allResourcePathsAll resource paths.private Recycler<ModuleReaderProxy,java.io.IOException>moduleReaderProxyRecyclerThe module reader proxy recycler.(package private) ModuleRefmoduleRefThe module ref.(package private) SingletonMap<ModuleRef,Recycler<ModuleReaderProxy,java.io.IOException>,java.io.IOException>moduleRefToModuleReaderProxyRecyclerMapA singleton map from aModuleRefto aModuleReaderProxyrecycler for the module.-
Fields inherited from class io.github.classgraph.ClasspathElement
acceptedClassfileResources, acceptedResources, childClasspathElements, classLoader, classpathElementIdx, classpathElementIdxWithinParent, containsSpecificallyAcceptedClasspathElementResourcePath, fileToLastModified, moduleNameFromModuleDescriptor, nestedClasspathRootPrefixes, packageRootPrefix, scanned, scanResult, 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 booleanequals(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.FilegetFile()Get the file for this classpath element, or null if this is a module with a "jrt:" URI.java.lang.StringgetModuleName()Get the module name from the module reference or the module descriptor.private java.lang.StringgetModuleNameOrEmpty()Get the module name from the module reference or the module descriptor.(package private) ModuleRefgetModuleRef()Get the ModuleRef for this classpath element.(package private) ResourcegetResource(java.lang.String relativePath)Get theResourcefor a given relative path.(package private) java.net.URIgetURI()Get the URI for this classpath element.inthashCode()Hash code.private ResourcenewResource(java.lang.String resourcePath)Create a newResourceobject for a resource or classfile discovered while scanning paths.(package private) voidopen(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueueIgnored, LogNode log)Determine if this classpath element is valid.(package private) voidscanPaths(LogNode log)Scan for package matches within module.java.lang.StringtoString()Return the module reference as a String.-
Methods inherited from class io.github.classgraph.ClasspathElement
addAcceptedResource, checkResourcePathAcceptReject, compareTo, finishScanPaths, getClassLoader, getNumClassfileMatches, log, log, maskClassfiles, setScanResult
-
-
-
-
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 aModuleRefto aModuleReaderProxyrecycler 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:ClasspathElementDetermine 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:
openin 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 newResourceobject 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 theResourcefor a given relative path.- Specified by:
getResourcein classClasspathElement- Parameters:
relativePath- The relative path of theResourceto return.- Returns:
- The
Resourcefor 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:
scanPathsin 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:
getModuleNamein 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:ClasspathElementGet the URI for this classpath element.- Specified by:
getURIin classClasspathElement- Returns:
- the URI for the classpath element.
-
getAllURIs
java.util.List<java.net.URI> getAllURIs()
Description copied from class:ClasspathElementGet 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:
getAllURIsin classClasspathElement- Returns:
- the URI for the classpath element.
-
getFile
java.io.File getFile()
Description copied from class:ClasspathElementGet the file for this classpath element, or null if this is a module with a "jrt:" URI.- Specified by:
getFilein classClasspathElement- Returns:
- the file for the classpath element.
-
toString
public java.lang.String toString()
Return the module reference as a String.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-
equals
public boolean equals(java.lang.Object obj)
Equals.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the obj- Returns:
- true, if successful
-
hashCode
public int hashCode()
Hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the int
-
-