Class DefaultJavaPackageFinder

    • Constructor Detail

      • DefaultJavaPackageFinder

        public DefaultJavaPackageFinder​(ProjectFilesystem projectFilesystem,
                              <String> pathsFromRoot,
                              <String> pathElements)
    • Method Detail

      • findJavaPackageFolder

        public Path findJavaPackageFolder​(Path pathRelativeToProjectRoot)
        Description copied from interface: JavaPackageFinder
        Given the relative path to a file under the project root, return the Java package with which the file is associated. For .java files, this is generally obvious, as they contain an explicit "package" statement. For other files, such as resources, other heuristics must be used.
        Specified by:
        findJavaPackageFolder in interface JavaPackageFinder
        pathRelativeToProjectRoot - may be a path to either a file or a directory. If a directory, then it must end in a slash.
        a path that always ends with a slash, or the empty string, indicating the root directory.
      • getPathsFromRoot

        public<String> getPathsFromRoot()
      • getPathElements

        public<String> getPathElements()
      • createDefaultJavaPackageFinder

        public static DefaultJavaPackageFinder createDefaultJavaPackageFinder​(ProjectFilesystem projectFilesystem,
                                                                              Iterable<String> pathPatterns)
        pathPatterns - elements that start with a slash must be prefix patterns; all other elements indicate individual directory names (and therefore cannot contain slashes).
      • findJavaPackageWithPackageFolder

        public static String findJavaPackageWithPackageFolder​(Path packageFolder)