|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Path
The Path
interface defines the qualified representation of
a JCR path. It consists of Path.Element
objects and is immutable.
It has the following properties:
isAbsolute()
:isNormalized()
:isCanonical()
:Path
objects having the equal Element
s
must be equal.
Nested Class Summary | |
---|---|
static interface |
Path.Element
Object representation of a single JCR path element. |
Field Summary | |
---|---|
static char |
DELIMITER
Delimiter used in order to concatenate the Path.Element objects upon getString() . |
static int |
INDEX_DEFAULT
Constant representing the default (initial) index value. |
static int |
INDEX_UNDEFINED
Constant representing an undefined index value |
static int |
ROOT_DEPTH
Constant defining the depth of the root path |
Method Summary | |
---|---|
Path |
computeRelativePath(Path other)
Computes the relative path from this absolute path to
other . |
boolean |
denotesRoot()
Tests whether this path represents the root path, i.e. |
Path |
getAncestor(int degree)
Returns the ancestor path of the specified relative degree. |
int |
getAncestorCount()
Returns the number of ancestors of this path. |
Path |
getCanonicalPath()
Returns the canonical path representation of this path. |
int |
getDepth()
Returns the depth of this path. |
Path.Element[] |
getElements()
Returns the elements of this path. |
int |
getLength()
Returns the length of this path, i.e. |
Path.Element |
getNameElement()
Returns the name element (i.e. |
Path |
getNormalizedPath()
Returns the normalized path representation of this path. |
String |
getString()
Returns the String representation of this Path as it is used by PathFactory.create(String) .
The String representation must consist of the String representation of
its elements separated by DELIMITER . |
boolean |
isAbsolute()
Tests whether this path is absolute, i.e. |
boolean |
isAncestorOf(Path other)
Determines if this path is an ancestor of the specified path, based on their (absolute or relative) hierarchy level as returned by . |
boolean |
isCanonical()
Tests whether this path is canonical, i.e. |
boolean |
isDescendantOf(Path other)
Determines if this path is a descendant of the specified path, based on their (absolute or relative) hierarchy level as returned by . |
boolean |
isNormalized()
Tests whether this path is normalized, i.e. |
Path |
subPath(int from,
int to)
Returns a new Path consisting of those Path.Element objects
between the given from , inclusive, and the given to ,
exclusive. |
Field Detail |
---|
static final int INDEX_UNDEFINED
static final int INDEX_DEFAULT
static final int ROOT_DEPTH
static final char DELIMITER
getString()
.
Method Detail |
---|
boolean denotesRoot()
boolean isAbsolute()
boolean isCanonical()
isAbsolute()
boolean isNormalized()
getNormalizedPath()
Path getNormalizedPath() throws RepositoryException
RepositoryException
- if the path cannot be normalized.isNormalized()
Path getCanonicalPath() throws RepositoryException
RepositoryException
- if this path can not be canonicalized
(e.g. if it is relative).Path computeRelativePath(Path other) throws RepositoryException
this
absolute path to
other
.
other
- an absolute path.
this
path to other
path.
RepositoryException
- if either this
or
other
path is not absolute.Path getAncestor(int degree) throws IllegalArgumentException, PathNotFoundException
degree
- the relative degree of the requested ancestor.
PathNotFoundException
- if there is no ancestor of the specified degree.
IllegalArgumentException
- if degree
is negative.int getAncestorCount()
getDepth()
- 1
.
Note that the returned value might be negative if this path is not
canonical, e.g. the depth of "../../a" is -1, its ancestor count is
therefore -2.
getDepth()
,
getLength()
,
isCanonical()
int getLength()
getDepth()
.
getDepth()
,
getAncestorCount()
int getDepth()
getLength()
,
getAncestorCount()
boolean isAncestorOf(Path other) throws IllegalArgumentException, RepositoryException
getDepth()
.
true
if other
is a descendant;
otherwise false
.
IllegalArgumentException
- if the given path is null
or if not both paths are either absolute or relative.
RepositoryException
- if any of the path cannot be normalized.getDepth()
boolean isDescendantOf(Path other) throws IllegalArgumentException, RepositoryException
getDepth()
.
true
if other
is an ancestor;
otherwise false
IllegalArgumentException
- If the given path is null.
RepositoryException
- if not both paths are either absolute or
relative.getDepth()
Path subPath(int from, int to) throws IllegalArgumentException, RepositoryException
Path
consisting of those Path.Element objects
between the given from
, inclusive, and the given to
,
exclusive. An IllegalArgumentException
is thrown if from
is greater or equal than to
or if any of both params is
out of the possible range. A RepositoryException
is thrown
if this Path
is not normalized.
from
- to
-
IllegalArgumentException
RepositoryException
- If this Path is not normalized.Path.Element[] getElements()
Path.Element getNameElement()
String getString()
PathFactory.create(String)
.
The String representation must consist of the String representation of
its elements separated by DELIMITER
.
Path.Element.getString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |