|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.content.PathHelper
Utility class to manipulate unix path like Strings such as /a/b/c/d. Paths are always expected to begin with / and end without it. Therefore neither a/b/c or /a/b/c/ are considered valid. Most operations take a path which must be in correct form and also an element to add/remove from the path. This element must not contain the SEPARATOR / as any part of itself.
Field Summary | |
static String |
SEPARATOR
|
Constructor Summary | |
PathHelper()
|
Method Summary | |
static String |
addFirst(String first,
String path)
Adds a new element to the front of a path. |
static String |
addLast(String path,
String last)
Adds a new element to the end of a path. |
static String |
getFirst(String path)
Gets the first element in the path. |
static String |
getLast(String path)
Gets the last element in the path. |
static String |
getLineage(String path)
Removes the last element and returns the result. |
int |
getNameCount(String path)
Gets the number of Nodes in the path. |
static String |
getParentName(String path)
Gets the second to last element in a path. |
String |
getSubPath(String path,
int size)
Returns the lineage with the number of parents specified. |
static boolean |
isValid(String path)
Checks if the path is valid: must be non null must be > 0 characters must start with a SEPARATOR must not end with a SEPARATOR |
static String |
removeFirst(String path)
Removes the first element from path and returns the result. |
static String |
trimPath(String path,
int size)
Trims the path to the given size. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SEPARATOR
Constructor Detail |
public PathHelper()
Method Detail |
public static String addFirst(String first, String path)
first
- - the element to add. Must not contain / as part
of the String.path
- - the path to add an element to.
public static String addLast(String path, String last)
path
- - the path to add an element to.
public static String getFirst(String path)
public static String getLast(String path)
public static String getLineage(String path)
public int getNameCount(String path)
public static String getParentName(String path)
public String getSubPath(String path, int size)
public static boolean isValid(String path)
path
- - the path to validate
public static String removeFirst(String path)
public static String trimPath(String path, int size)
|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |