Class RepoPath
- java.lang.Object
-
- org.apache.sling.feature.cpconverter.shared.RepoPath
-
- All Implemented Interfaces:
Comparable<RepoPath>
public class RepoPath extends Object implements Comparable<RepoPath>
A Repo Path represents a path in the repository, for example when used in a repoinit section.- See Also:
- Repoinit Grammar
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(@NotNull RepoPath o)
boolean
equals(Object obj)
@Nullable RepoPath
getParent()
Get the parent path of the current path.@NotNull List<String>
getSegments()
int
hashCode()
boolean
isRepositoryPath()
boolean
startsWith(@Nullable RepoPath otherPath)
Check is this path starts with the other path.String
toString()
-
-
-
Constructor Detail
-
RepoPath
public RepoPath(@NotNull @NotNull String path)
Construct a Repo Path from a string. The string should separate the path segments with forward slashes, e.g./my/repo/path
.- Parameters:
path
- The string representation of the path. If the initial leading forward slash is missing it will be assumed to be there.
-
-
Method Detail
-
compareTo
public int compareTo(@NotNull @NotNull RepoPath o)
- Specified by:
compareTo
in interfaceComparable<RepoPath>
-
getParent
@Nullable public @Nullable RepoPath getParent()
Get the parent path of the current path.- Returns:
- The parent path, or
null
if we are at the root and there is no further parent.
-
startsWith
public boolean startsWith(@Nullable @Nullable RepoPath otherPath)
Check is this path starts with the other path.- Parameters:
otherPath
- The other path to check against.- Returns:
- If it starts with the other path or not.
-
isRepositoryPath
public boolean isRepositoryPath()
-
-