|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.mk.util.PathUtils
public class PathUtils
Utility methods to parse a JCR path.
Each method validates the input, except if the system property {packageName}.SKIP_VALIDATION is set, in which case only minimal validation takes place within this function, so when the parameter is an illegal path, the the result of this method is undefined.
| Constructor Summary | |
|---|---|
PathUtils()
|
|
| Method Summary | |
|---|---|
static String |
concat(String parentPath,
String... relativePaths)
Concatenate path elements. |
static String |
concat(String parentPath,
String subPath)
Concatenate path elements. |
static boolean |
denotesRoot(String path)
Whether the path is the root path ("/"). |
static Iterable<String> |
elements(String path)
Split a path into elements. |
static String |
getAncestorPath(String path,
int nth)
Get the nth ancestor of a path. |
static int |
getDepth(String path)
Calculate the number of elements in the path. |
static String |
getName(String path)
Get the last element of the (absolute or relative) path. |
static int |
getNextSlash(String path,
int index)
Get the index of the next slash. |
static String |
getParentPath(String path)
Get the parent of a path. |
static boolean |
isAbsolute(String path)
Whether the path is absolute (starts with a slash) or not. |
static boolean |
isAncestor(String ancestor,
String path)
Check if a path is a (direct or indirect) ancestor of another path. |
static String |
relativize(String parentPath,
String path)
Relativize a path wrt. |
static String[] |
split(String path)
Split a path into elements. |
static void |
validate(String path)
Check if the path is valid, and throw an IllegalArgumentException if not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PathUtils()
| Method Detail |
|---|
public static boolean denotesRoot(String path)
path - the path
public static boolean isAbsolute(String path)
path - the path
public static String getParentPath(String path)
path - the path
public static String getAncestorPath(String path,
int nth)
path - the path
public static String getName(String path)
path - the complete path
public static int getDepth(String path)
path - the path
public static String[] split(String path)
path - the path
public static Iterable<String> elements(String path)
path - the path
public static String concat(String parentPath,
String... relativePaths)
parentPath - the parent pathrelativePaths - the relative path elements to add
public static String concat(String parentPath,
String subPath)
parentPath - the parent pathsubPath - the subPath path to add
public static boolean isAncestor(String ancestor,
String path)
ancestor - the ancestor pathpath - the potential offspring path
public static String relativize(String parentPath,
String path)
relativize(parentPath, concat(parentPath, path)) == paths
holds.
parentPath - parent pthpath - path to relativize
public static int getNextSlash(String path,
int index)
path - the pathindex - the starting index
public static void validate(String path)
path - the path
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||