public class SourcePathResolverAdapter extends Object
SourcePathResolver
compatible with client code that assumes each
SourcePath
resolves to only one Path
.
See also AbstractSourcePathResolver
.
Constructor and Description |
---|
SourcePathResolverAdapter(SourcePathResolver resolver) |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableMap<Path,Path> |
createRelativeMap(Path basePath,
Iterable<SourcePath> sourcePaths)
Returns a map where given
SourcePath instances are resolved relatively to the given
base path and stored (as keys) with their absolute paths (as values). |
com.google.common.collect.ImmutableCollection<Path> |
filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources)
Returns a collection of
Path instances by filtering the given SourcePath
instances for Path instances. |
Path |
getAbsolutePath(SourcePath sourcePath)
Returns the
Path associated with the given SourcePath . |
com.google.common.collect.ImmutableSortedSet<Path> |
getAllAbsolutePaths(Collection<? extends SourcePath> sourcePaths)
Returns the
Path instances associated with the given SourcePath instances. |
ProjectFilesystem |
getFilesystem(SourcePath sourcePath)
Returns the
ProjectFilesystem associated with this adapter. |
Path |
getIdeallyRelativePath(SourcePath sourcePath)
Returns the
Path instances the given SourcePath refers to, ideally relative to
its owning ProjectFilesystem . |
<T> com.google.common.collect.ImmutableMap<T,Path> |
getMappedPaths(Map<T,SourcePath> sourcePathMap)
Returns a list of values and their associated
Path instances by transforming the given
SourcePath instances into Path instances. |
Path |
getRelativePath(ProjectFilesystem projectFilesystem,
SourcePath sourcePath)
|
Path |
getRelativePath(SourcePath sourcePath)
|
SourcePathResolver |
getResolver()
Returns the
SourcePathResolver associated
with this adapter. |
String |
getSourcePathName(BuildTarget target,
SourcePath sourcePath)
Returns the logical name for a given
SourcePath . |
com.google.common.collect.ImmutableMap<String,SourcePath> |
getSourcePathNames(BuildTarget target,
String parameter,
Iterable<SourcePath> sourcePaths)
Resolves the logical names for a group of
SourcePath objects into a map, throwing an
error on duplicates. |
<T> com.google.common.collect.ImmutableMap<String,T> |
getSourcePathNames(BuildTarget target,
String parameter,
Iterable<T> objects,
java.util.function.Predicate<T> filter,
java.util.function.Function<T,SourcePath> objectSourcePathFunction)
Resolves the logical names for a group of
SourcePath objects into a map, throwing an
error on duplicates. |
String |
toString() |
public SourcePathResolverAdapter(SourcePathResolver resolver)
public Path getAbsolutePath(SourcePath sourcePath)
Path
associated with the given SourcePath
.public Path getRelativePath(SourcePath sourcePath)
public Path getIdeallyRelativePath(SourcePath sourcePath)
Path
instances the given SourcePath
refers to, ideally relative to
its owning ProjectFilesystem
. Absolute path may get returned however!public Path getRelativePath(ProjectFilesystem projectFilesystem, SourcePath sourcePath)
public com.google.common.collect.ImmutableSortedSet<Path> getAllAbsolutePaths(Collection<? extends SourcePath> sourcePaths)
Path
instances associated with the given SourcePath
instances.public <T> com.google.common.collect.ImmutableMap<T,Path> getMappedPaths(Map<T,SourcePath> sourcePathMap)
Path
instances by transforming the given
SourcePath
instances into Path
instances.public com.google.common.collect.ImmutableMap<String,SourcePath> getSourcePathNames(BuildTarget target, String parameter, Iterable<SourcePath> sourcePaths)
SourcePath
objects into a map, throwing an
error on duplicates.public com.google.common.collect.ImmutableCollection<Path> filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources)
Path
instances by filtering the given SourcePath
instances for Path
instances.public <T> com.google.common.collect.ImmutableMap<String,T> getSourcePathNames(BuildTarget target, String parameter, Iterable<T> objects, java.util.function.Predicate<T> filter, java.util.function.Function<T,SourcePath> objectSourcePathFunction)
SourcePath
objects into a map, throwing an
error on duplicates.public String getSourcePathName(BuildTarget target, SourcePath sourcePath)
SourcePath
.public com.google.common.collect.ImmutableMap<Path,Path> createRelativeMap(Path basePath, Iterable<SourcePath> sourcePaths)
SourcePath
instances are resolved relatively to the given
base path and stored (as keys) with their absolute paths (as values).public ProjectFilesystem getFilesystem(SourcePath sourcePath)
ProjectFilesystem
associated with this adapter.public SourcePathResolver getResolver()
SourcePathResolver
associated
with this adapter.