public class DefaultJavaPackageFinder extends Object implements JavaPackageFinder
Constructor and Description |
---|
DefaultJavaPackageFinder(ProjectFilesystem projectFilesystem,
com.google.common.collect.ImmutableSortedSet<String> pathsFromRoot,
com.google.common.collect.ImmutableSet<String> pathElements) |
Modifier and Type | Method and Description |
---|---|
static DefaultJavaPackageFinder |
createDefaultJavaPackageFinder(ProjectFilesystem projectFilesystem,
Iterable<String> pathPatterns) |
String |
findJavaPackage(BuildTarget buildTarget) |
String |
findJavaPackage(Path pathRelativeToProjectRoot) |
Path |
findJavaPackageFolder(Path pathRelativeToProjectRoot)
Given the relative path to a file under the project root, return the Java package with which
the file is associated.
|
static String |
findJavaPackageWithPackageFolder(Path packageFolder) |
com.google.common.collect.ImmutableSet<String> |
getPathElements() |
com.google.common.collect.ImmutableSortedSet<String> |
getPathsFromRoot() |
public DefaultJavaPackageFinder(ProjectFilesystem projectFilesystem, com.google.common.collect.ImmutableSortedSet<String> pathsFromRoot, com.google.common.collect.ImmutableSet<String> pathElements)
public Path findJavaPackageFolder(Path pathRelativeToProjectRoot)
JavaPackageFinder
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.public com.google.common.collect.ImmutableSortedSet<String> getPathsFromRoot()
public com.google.common.collect.ImmutableSet<String> getPathElements()
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).public String findJavaPackage(Path pathRelativeToProjectRoot)
findJavaPackage
in interface JavaPackageFinder
public String findJavaPackage(BuildTarget buildTarget)
findJavaPackage
in interface JavaPackageFinder