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(RepoPath o)
boolean
equals(Object obj)
RepoPath
getParent()
Get the parent path of the current path.int
getSegmentCount()
Get the nubmer of segments in this path.int
hashCode()
boolean
startsWith(RepoPath otherPath)
Check is this path starts with the other path.String
toString()
-
-
-
Constructor Detail
-
RepoPath
public RepoPath(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(RepoPath o)
- Specified by:
compareTo
in interfaceComparable<RepoPath>
-
getParent
public 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.
-
getSegmentCount
public int getSegmentCount()
Get the nubmer of segments in this path.- Returns:
- The number of segments.
-
startsWith
public boolean startsWith(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.
-
-