Class ClasspathElementDir
java.lang.Object
io.github.classgraph.ClasspathElement
io.github.classgraph.ClasspathElementDir
- All Implemented Interfaces:
Comparable<ClasspathElement>
A directory classpath element, using the
Path API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PathThe directory at the root of the classpath element.private final NestedJarHandlerThe nested jar handler.Used to ensure that recursive scanning doesn't get into an infinite loop due to a link cycle.Fields inherited from class ClasspathElement
acceptedClassfileResources, acceptedResources, childClasspathElements, classLoader, classpathElementIdx, classpathElementIdxWithinParent, containsSpecificallyAcceptedClasspathElementResourcePath, fileToLastModified, moduleNameFromModuleDescriptor, nestedClasspathRootPrefixes, packageRootPrefix, scanned, scanResult, scanSpec, skipClasspathElement -
Constructor Summary
ConstructorsConstructorDescriptionClasspathElementDir(Scanner.ClasspathEntryWorkUnit workUnit, NestedJarHandler nestedJarHandler, ScanSpec scanSpec) A directory classpath element. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the URI for this classpath element, and the URIs for any automatic nested package prefixes (e.g.getFile()Get the directoryFile.Get the module name from module descriptor.(package private) ResourcegetResource(String relativePath) Get theResourcefor a given relative path.(package private) URIgetURI()Get the URI for this classpath element.inthashCode()private ResourcenewResource(Path resourcePath, BasicFileAttributes attributes) Create a newResourceobject for a resource or classfile discovered while scanning paths.(package private) voidopen(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueue, LogNode log) Determine if this classpath element is valid.private voidscanPathRecursively(Path path, LogNode log) Recursively scan aPathfor sub-path patterns matching the scan spec.(package private) voidHierarchically scan directory structure for classfiles and matching files.toString()Return the classpath element directory as a String.Methods inherited from class ClasspathElement
addAcceptedResource, checkResourcePathAcceptReject, compareTo, finishScanPaths, getClassLoader, getNumClassfileMatches, log, log, maskClassfiles, setScanResult
-
Field Details
-
classpathEltPath
The directory at the root of the classpath element. -
scannedCanonicalPaths
-
nestedJarHandler
The nested jar handler.
-
-
Constructor Details
-
ClasspathElementDir
ClasspathElementDir(Scanner.ClasspathEntryWorkUnit workUnit, NestedJarHandler nestedJarHandler, ScanSpec scanSpec) A directory classpath element.- Parameters:
workUnit- the work unit -- workUnit.classpathEntryObj must be aPathobjectnestedJarHandler- the nested jar handlerscanSpec- the scan spec
-
-
Method Details
-
open
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:
workQueue- the work queuelog- the log
-
newResource
-
getResource
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.
-
scanPathRecursively
-
scanPaths
Hierarchically scan directory structure for classfiles and matching files.- Specified by:
scanPathsin classClasspathElement- Parameters:
log- the log
-
getModuleName
Get the module name from module descriptor.- Specified by:
getModuleNamein classClasspathElement- Returns:
- the module name
-
getFile
Get the directoryFile.- Specified by:
getFilein classClasspathElement- Returns:
- The classpath element directory as a
File, or null if this classpath element is not backed by a directory (should not happen).
-
getURI
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
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.
-
toString
-
hashCode
-
equals
-