Class ClasspathElementDir

  • All Implemented Interfaces:
    java.lang.Comparable<ClasspathElement>

    class ClasspathElementDir
    extends ClasspathElement
    A directory classpath element, using the Path API.
    • Field Detail

      • classpathEltPath

        private final java.nio.file.Path classpathEltPath
        The directory at the root of the classpath element.
      • scannedCanonicalPaths

        private final java.util.Set<java.nio.file.Path> scannedCanonicalPaths
        Used to ensure that recursive scanning doesn't get into an infinite loop due to a link cycle.
      • nestedJarHandler

        private final NestedJarHandler nestedJarHandler
        The nested jar handler.
    • Constructor Detail

      • ClasspathElementDir

        ClasspathElementDir​(Scanner.ClasspathEntryWorkUnit workUnit,
                            NestedJarHandler nestedJarHandler,
                            ScanSpec scanSpec)
        A directory classpath element.
        Parameters:
        workUnit - the work unit -- workUnit.classpathEntryObj must be a Path object
        nestedJarHandler - the nested jar handler
        scanSpec - the scan spec
    • Method Detail

      • open

        void open​(WorkQueue<Scanner.ClasspathEntryWorkUnit> workQueue,
                  LogNode log)
        Description copied from class: ClasspathElement
        Determine if this classpath element is valid. If it is not valid, sets skipClasspathElement. For ClasspathElementZip, 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 class ClasspathElement
        Parameters:
        workQueue - the work queue
        log - the log
      • newResource

        private Resource newResource​(java.nio.file.Path resourcePath,
                                     NestedJarHandler nestedJarHandler)
        Create a new Resource object for a resource or classfile discovered while scanning paths.
        Parameters:
        resourcePath - the Path for the resource
        nestedJarHandler - the nested jar handler
        Returns:
        the resource
      • getResource

        Resource getResource​(java.lang.String relativePath)
        Get the Resource for a given relative path.
        Specified by:
        getResource in class ClasspathElement
        Parameters:
        relativePath - The relative path of the Resource to return.
        Returns:
        The Resource for the given relative path, or null if relativePath does not exist in this classpath element.
      • scanPathRecursively

        private void scanPathRecursively​(java.nio.file.Path path,
                                         LogNode log)
        Recursively scan a Path for sub-path patterns matching the scan spec.
        Parameters:
        path - the Path
        log - the log
      • scanPaths

        void scanPaths​(LogNode log)
        Hierarchically scan directory structure for classfiles and matching files.
        Specified by:
        scanPaths in class ClasspathElement
        Parameters:
        log - the log
      • getModuleName

        public java.lang.String getModuleName()
        Get the module name from module descriptor.
        Specified by:
        getModuleName in class ClasspathElement
        Returns:
        the module name
      • getFile

        public java.io.File getFile()
        Get the directory File.
        Specified by:
        getFile in class ClasspathElement
        Returns:
        The classpath element directory as a File, or null if this classpath element is not backed by a directory (should not happen).
      • getURI

        java.net.URI getURI()
        Description copied from class: ClasspathElement
        Get the URI for this classpath element.
        Specified by:
        getURI in class ClasspathElement
        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 class ClasspathElement
        Returns:
        the URI for the classpath element.
      • toString

        public java.lang.String toString()
        Return the classpath element directory as a String.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object