|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.name.Path
public final class Path
The Path
utility class provides misc. methods to resolve and
nornalize JCR-style item paths.
isAbsolute()
:isNormalized()
:isCanonical()
:path ::= properpath ['/'] properpath ::= abspath | relpath abspath ::= '/' relpath relpath ::= pathelement | relpath '/' pathelement pathelement ::= name | name '[' number ']' | '..' | '.' number ::= (* An integer > 0 *) name ::= simplename | prefixedname simplename ::= onecharsimplename | twocharsimplename | threeormorecharname prefixedname ::= prefix ':' localname localname ::= onecharlocalname | twocharlocalname | threeormorecharname onecharsimplename ::= (* Any Unicode character except: '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *) twocharsimplename ::= '.' onecharsimplename | onecharsimplename '.' | onecharsimplename onecharsimplename onecharlocalname ::= nonspace twocharlocalname ::= nonspace nonspace threeormorecharname ::= nonspace string nonspace prefix ::= (* Any valid XML Name *) string ::= char | string char char ::= nonspace | ' ' nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)
Nested Class Summary | |
---|---|
static class |
Path.CurrentElement
Deprecated. |
static class |
Path.NameElement
Deprecated. |
static class |
Path.ParentElement
Deprecated. |
static class |
Path.PathBuilder
Deprecated. Internal helper class used to build a path from pre-parsed path elements. |
static class |
Path.PathElement
Deprecated. Object representation of a single JCR path element. |
static class |
Path.RootElement
Deprecated. |
Field Summary | |
---|---|
static Path.PathElement |
CURRENT_ELEMENT
Deprecated. the 'current' element. i.e. '.' |
static int |
INDEX_DEFAULT
Deprecated. Constant representing the default (initial) index value. |
static int |
INDEX_UNDEFINED
Deprecated. Constant representing an undefined index value |
static Path.PathElement |
PARENT_ELEMENT
Deprecated. the 'parent' element. i.e. '..' |
static Path |
ROOT
Deprecated. the root path |
static int |
ROOT_DEPTH
Deprecated. Constant defining the depth of the root path |
static Path.PathElement |
ROOT_ELEMENT
Deprecated. the 'root' element. i.e |
Method Summary | |
---|---|
static void |
checkFormat(String jcrPath)
Deprecated. Use PathFormat.checkFormat(String) instead. |
Path |
computeRelativePath(Path other)
Deprecated. Computes the relative path from this absolute path to
other . |
static Path |
create(Path parent,
Path relPath,
boolean normalize)
Deprecated. Creates a new Path out of the given parent |
static Path |
create(Path parent,
QName name,
boolean normalize)
Deprecated. Creates a new Path out of the given parent |
static Path |
create(Path parent,
QName name,
int index,
boolean normalize)
Deprecated. Creates a new Path out of the given parent |
static Path |
create(Path parent,
String relJCRPath,
NamespaceResolver resolver,
boolean canonicalize)
Deprecated. Use PathFormat.parse(Path, String, NamespaceResolver) instead. |
static Path |
create(QName name,
int index)
Deprecated. Creates a relative path based on a QName and an index. |
static Path |
create(String jcrPath,
NamespaceResolver resolver,
boolean normalize)
Deprecated. Use PathFormat#parse(String, NamespaceResolver)} instead. |
boolean |
denotesRoot()
Deprecated. Tests whether this path represents the root path, i.e. "/". |
boolean |
equals(Object obj)
Deprecated. Compares the specified object with this path for equality. |
Path |
getAncestor(int degree)
Deprecated. Returns the ancestor path of the specified relative degree. |
int |
getAncestorCount()
Deprecated. Returns the number of ancestors of this path. |
Path |
getCanonicalPath()
Deprecated. Returns the canonical path representation of this path. |
int |
getDepth()
Deprecated. Returns the depth of this path. |
Path.PathElement |
getElement(int i)
Deprecated. Returns the i th element of this path. |
Path.PathElement[] |
getElements()
Deprecated. Returns the elements of this path. |
int |
getLength()
Deprecated. Returns the length of this path, i.e. the number of its elements. |
Path.PathElement |
getNameElement()
Deprecated. Returns the name element (i.e. the last element) of this path. |
Path |
getNormalizedPath()
Deprecated. Returns the normalized path representation of this path. |
int |
hashCode()
Deprecated. Returns a hash code value for this path. |
boolean |
isAbsolute()
Deprecated. Tests whether this path is absolute, i.e. whether it starts with "/". |
boolean |
isAncestorOf(Path other)
Deprecated. Determines if this path is an ancestor of the specified path, based on their (absolute or relative) hierarchy level as returned by . |
boolean |
isCanonical()
Deprecated. Tests whether this path is canonical, i.e. whether it is absolute and does not contain redundant elements such as "." and "..". |
boolean |
isDescendantOf(Path other)
Deprecated. Determines if this path is a descendant of the specified path, based on their (absolute or relative) hierarchy level as returned by . |
boolean |
isNormalized()
Deprecated. Tests whether this path is normalized, i.e. whether it does not contain redundant elements such as "." and "..". |
String |
toJCRPath(NamespaceResolver resolver)
Deprecated. Use PathFormat.format(Path, NamespaceResolver) instead. |
String |
toString()
Deprecated. Returns the internal string representation of this Path . |
static Path |
valueOf(String s)
Deprecated. Returns a Path holding the value of the specified
string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Path.PathElement ROOT_ELEMENT
public static final Path.PathElement CURRENT_ELEMENT
public static final Path.PathElement PARENT_ELEMENT
public static final Path ROOT
public static final int INDEX_UNDEFINED
public static final int INDEX_DEFAULT
public static final int ROOT_DEPTH
Method Detail |
---|
public static Path create(String jcrPath, NamespaceResolver resolver, boolean normalize) throws MalformedPathException
Path
from the given jcrPath
string. If normalize
is true
, the returned
path will be normalized (or canonicalized if absolute).
jcrPath
- resolver
- normalize
-
MalformedPathException
public static Path create(Path parent, String relJCRPath, NamespaceResolver resolver, boolean canonicalize) throws MalformedPathException
PathFormat.parse(Path, String, NamespaceResolver)
instead.
Path
out of the given parent
path
and a relative path string. If canonicalize
is
true
, the returned path will be canonicalized.
parent
- relJCRPath
- resolver
- canonicalize
-
MalformedPathException
public static Path create(Path parent, Path relPath, boolean normalize) throws MalformedPathException
Path
out of the given parent path
string and the given relative path string. If normalize
is
true
, the returned path will be normalized (or
canonicalized, if the parent path is absolute).
- Parameters:
parent
- relPath
- normalize
-
- Throws:
MalformedPathException
- if relPath
is absolute
public static Path create(Path parent, QName name, boolean normalize) throws MalformedPathException
Path
out of the given parent path
string and the give name. If normalize
is true
,
the returned path will be normalized (or canonicalized, if the parent
path is absolute).
- Parameters:
parent
- the parent pathname
- the name of the new path element.normalize
-
- Returns:
- the new path.
- Throws:
MalformedPathException
public static Path create(Path parent, QName name, int index, boolean normalize) throws MalformedPathException
Path
out of the given parent path
and the give name and index.
- Parameters:
parent
- the paren tpath.name
- the name of the new path element.index
- the index of the new path element.normalize
-
- Returns:
- the new path.
- Throws:
MalformedPathException
public static Path create(QName name, int index) throws IllegalArgumentException
QName
and an index.
name
- single QName
for this relative path.index
- index of the sinlge name element.
name
.
IllegalArgumentException
- if index
is negative.public static void checkFormat(String jcrPath) throws MalformedPathException
PathFormat.checkFormat(String)
instead.
jcrPath
is a valid JCR-style absolute or relative
path.
jcrPath
- the path to be checked
MalformedPathException
- If jcrPath
is not a valid
JCR-style path.public boolean denotesRoot()
public boolean isAbsolute()
public boolean isCanonical()
isAbsolute()
public boolean isNormalized()
getNormalizedPath()
public Path getNormalizedPath() throws MalformedPathException
MalformedPathException
- if the path cannot be normalized.isNormalized()
public Path getCanonicalPath() throws MalformedPathException
MalformedPathException
- if this path can not be canonicalized
(e.g. if it is relative)public Path computeRelativePath(Path other) throws MalformedPathException
this
absolute path to
other
.
other
- an absolute path
this
path to
other
path
MalformedPathException
- if either this
or
other
path is not absolutepublic 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 negativepublic 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()
public int getLength()
getDepth()
.
getDepth()
,
getAncestorCount()
public int getDepth()
getLength()
,
getAncestorCount()
public boolean isAncestorOf(Path other) throws MalformedPathException
getDepth()
.
true
if other
is a descendant;
otherwise false
MalformedPathException
- if not both paths are either absolute or
relative.getDepth()
public boolean isDescendantOf(Path other) throws MalformedPathException
getDepth()
.
true
if other
is an ancestor;
otherwise false
MalformedPathException
- if not both paths are either absolute or
relative.getDepth()
public Path.PathElement getNameElement()
public Path.PathElement[] getElements()
public Path.PathElement getElement(int i)
i
th element of this path.
i
- element index.
i
th element of this path.
ArrayIndexOutOfBoundsException
- if this path does not have an
element at index i
.public String toJCRPath(NamespaceResolver resolver) throws NoPrefixDeclaredException
PathFormat.format(Path, NamespaceResolver)
instead.
Path
in the
JCR path format.
resolver
- namespace resolver
NoPrefixDeclaredException
- if a namespace can not be resolvedpublic String toString()
Path
.
Note that the returned string is not a valid JCR path, i.e. the
namespace URI's of the individual path elements are not replaced with
their mapped prefixes. Call
toJCRPath(NamespaceResolver)
for a JCR path representation.
toString
in class Object
Path
.public static Path valueOf(String s) throws IllegalArgumentException
Path
holding the value of the specified
string. The string must be in the format returned by the
Path.toString()
method.
s
- a String
containing the Path
representation to be parsed.
Path
represented by the argument
IllegalArgumentException
- if the specified string can not be parsed
as a Path
.toString()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
obj
- the object to be compared for equality with this path.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |