Package com.facebook.buck.core.cell.impl
Class DefaultCellPathResolver
- java.lang.Object
-
- com.facebook.buck.core.cell.AbstractCellPathResolver
-
- com.facebook.buck.core.cell.impl.DefaultCellPathResolver
-
- All Implemented Interfaces:
CellPathResolver
public abstract class DefaultCellPathResolver extends AbstractCellPathResolver
-
-
Field Summary
Fields Modifier and Type Field Description static String
REPOSITORIES_SECTION
-
Constructor Summary
Constructors Constructor Description DefaultCellPathResolver()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static com.google.common.collect.ImmutableMap<CellName,AbsPath>
bootstrapPathMapping(AbsPath root, Config config)
static DefaultCellPathResolver
create(AbsPath root, Config config)
Creates a DefaultCellPathResolver using the mappings in the providedConfig
.static DefaultCellPathResolver
create(AbsPath root, Map<String,AbsPath> cellPaths, CellNameResolver cellNameResolver, NewCellPathResolver newCellPathResolver)
Optional<String>
getCanonicalCellName(Path cellPath)
Returns a cell name that can be used to refer to the cell at the given path.abstract CellNameResolver
getCellNameResolver()
Provides access to theCellNameResolver
for this cell.Optional<Path>
getCellPath(Optional<String> cellName)
abstract com.google.common.collect.ImmutableMap<String,AbsPath>
getCellPathsByRootCellExternalName()
com.google.common.collect.ImmutableMap<Path,String>
getExternalNamesInRootCell()
This gives the names as they are specified in the root cell.com.google.common.collect.ImmutableSortedSet<AbsPath>
getKnownRoots()
abstract NewCellPathResolver
getNewCellPathResolver()
Provides access to theNewCellPathResolver
.com.google.common.collect.ImmutableMap<CellName,AbsPath>
getPathMapping()
abstract AbsPath
getRoot()
-
Methods inherited from class com.facebook.buck.core.cell.AbstractCellPathResolver
getCellPathOrThrow, getCellPathOrThrow, resolveCellRelativePath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.facebook.buck.core.cell.CellPathResolver
getCanonicalCellName, getCurrentCellName
-
-
-
-
Field Detail
-
REPOSITORIES_SECTION
public static final String REPOSITORIES_SECTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRoot
public abstract AbsPath getRoot()
-
getCellPathsByRootCellExternalName
public abstract com.google.common.collect.ImmutableMap<String,AbsPath> getCellPathsByRootCellExternalName()
- Returns:
- absolute paths to all cells this resolver knows about. The key is the name of the cell in the root cell's config (this is not necessarily the canonical name).
-
getCellNameResolver
public abstract CellNameResolver getCellNameResolver()
Description copied from interface:CellPathResolver
Provides access to theCellNameResolver
for this cell. This is to assist in migration to the new name/path resolvers.
-
getNewCellPathResolver
public abstract NewCellPathResolver getNewCellPathResolver()
Description copied from interface:CellPathResolver
Provides access to theNewCellPathResolver
. This is to assist in migration to the new name/path resolvers.
-
getExternalNamesInRootCell
@Lazy public com.google.common.collect.ImmutableMap<Path,String> getExternalNamesInRootCell()
This gives the names as they are specified in the root cell.
-
getPathMapping
@Lazy public com.google.common.collect.ImmutableMap<CellName,AbsPath> getPathMapping()
-
getKnownRoots
@Lazy public com.google.common.collect.ImmutableSortedSet<AbsPath> getKnownRoots()
- Specified by:
getKnownRoots
in interfaceCellPathResolver
- Overrides:
getKnownRoots
in classAbstractCellPathResolver
- Returns:
- sorted set of known roots in reverse natural order
-
create
public static DefaultCellPathResolver create(AbsPath root, Map<String,AbsPath> cellPaths, CellNameResolver cellNameResolver, NewCellPathResolver newCellPathResolver)
-
create
public static DefaultCellPathResolver create(AbsPath root, Config config)
Creates a DefaultCellPathResolver using the mappings in the providedConfig
. This is the preferred way to create a DefaultCellPathResolver.
-
bootstrapPathMapping
public static com.google.common.collect.ImmutableMap<CellName,AbsPath> bootstrapPathMapping(AbsPath root, Config config)
-
getCellPath
public Optional<Path> getCellPath(Optional<String> cellName)
- Parameters:
cellName
- name of cell, Optional.empty() for root cell.- Returns:
- Absolute path to the physical location of the cell, or
Optional.empty()
if the cell name cannot be resolved.
-
getCanonicalCellName
public Optional<String> getCanonicalCellName(Path cellPath)
Description copied from interface:CellPathResolver
Returns a cell name that can be used to refer to the cell at the given path.Returns
Optional.empty()
if the path refers to the root cell. Returns the lexicographically smallest name if the cell path has multiple names.Note: this is not the inverse of
CellPathResolver.getCellPath(Optional)
, which returns the current, rather than the root, cell path if the cell name is empty.
-
-