Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.value.basic
Class RootPath

    java.lang.Object
      org.modeshape.jcr.value.basic.AbstractPath
          org.modeshape.jcr.value.basic.RootPath

All Implemented Interfaces:
  Serializable, Comparable<Path>, Iterable<Path.Segment>, Path, Readable

    @Immutable
    public class RootPath

extends AbstractPath

Optimized implementation of `Path` that serves as the root path.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.modeshape.jcr.value.basic.AbstractPath
`AbstractPath.SingleIterator<T>`

Nested classes/interfaces inherited from interface org.modeshape.jcr.value.Path
`Path.Segment`

Field Summary
`static Path` | `INSTANCE`

Fields inherited from class org.modeshape.jcr.value.basic.AbstractPath
`EMPTY_PATH_ITERATOR, SELF_PATH`

Fields inherited from interface org.modeshape.jcr.value.Path
`DEFAULT_DECODER, DEFAULT_ENCODER, DEFAULT_INDEX, DELIMITER, DELIMITER_STR, IDENTIFIER_LEADING_TERMINAL, IDENTIFIER_TRAILING_TERMINAL, JSR283_DECODER, JSR283_ENCODER, NO_OP_DECODER, NO_OP_ENCODER, PARENT, PARENT_NAME, PARENT_SEGMENT, ROOT_NAME, ROOT_PATH, SELF, SELF_NAME, SELF_SEGMENT, URL_DECODER, URL_ENCODER`

Method Summary
`int` | `compareTo(Path other)`
`boolean` | `endsWith(Name nameOfLastSegment)` Determine if the path's `Path.getLastSegment()` has the supplied name and no `SNS index`.
`boolean` | `endsWith(Name nameOfLastSegment, int snsIndex)` Determine if the path's `Path.getLastSegment()` has the supplied name and `SNS index`.
`boolean` | `equals(Object obj)`
`Path` | `getAncestor(int degree)` Return the path to the ancestor of the supplied degree.
`Path` | `getCanonicalPath()` Get the canonical form of this path.
`Path` | `getCommonAncestor(Path that)` Find the lowest common ancestor of this path and the supplied path.
`Path.Segment` | `getLastSegment()` Get the last segment in this path.
`Path` | `getNormalizedPath()` Get a normalized path with as many ".." segments and all "." resolved.
`Path` | `getParent()` Return the path to the parent, or this path if it is the `root`.
`Path.Segment` | `getSegment(int index)` Get the segment at the supplied index.
`Path.Segment[]` | `getSegmentsArray()` Obtain a copy of the segments in this path.
`List<Path.Segment>` | `getSegmentsList()` Get an unmodifiable list of the path segments.
`protected Iterator<Path.Segment>` | `getSegmentsOfParent()` Method used by `AbstractPath.equals(Object)` implementation to quickly get an Iterator over the segments in the parent.
`String` | `getString()` Get the string form of the object.
`String` | `getString(NamespaceRegistry namespaceRegistry)` Get the string form of the object, using the supplied namespace registry to convert any namespace URIs to prefixes.
`String` | `getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder)` Get the encoded string form of the object, using the supplied namespace registry to convert the any namespace URIs to prefixes.
`String` | `getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder, TextEncoder delimiterEncoder)` Get the encoded string form of the object, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part of any names.
`String` | `getString(TextEncoder encoder)` Get the encoded string form of the object, using the supplied encoder to encode characters.
`boolean` | `hasSameAncestor(Path that)` Determine whether this path and the supplied path have the same immediate ancestor.
`boolean` | `isAbsolute()` Return whether this path is an absolute path.
`boolean` | `isAncestorOf(Path descendant)` Determine whether this path is an ancestor of the supplied path.
`boolean` | `isAtOrAbove(Path other)` Determine whether this path is the `same as` to or a `ancestor of` the supplied path.
`boolean` | `isAtOrBelow(Path other)` Determine whether this path is the `same as` to or a `descendant of` the supplied path.
`boolean` | `isDescendantOf(Path ancestor)` Determine whether this path is an descendant of the supplied path.
`boolean` | `isNormalized()` Return whether this path is normalized and contains no unnecessary "." segments and as few ".." segments as possible.
`boolean` | `isRoot()` Return whether this path represents the root path.
`boolean` | `isSameAs(Path other)` Determine whether this path represents the same as the supplied path.
`Iterator<Path.Segment>` | `iterator()`
`Iterator<Path>` | `pathsFromRoot()` Return an iterator that walks the paths from the root path down to this path.
`Path` | `relativeToRoot()` Obtain a path that is relative to the root node.
`Path` | `resolve(Path relativePath)` Get the absolute path by resolving the supplied relative (non-absolute) path against this absolute path.
`int` | `size()` Return the number of segments in this path.
`Path` | `subpath(int beginIndex)` Return a new path consisting of the segments starting at `beginIndex` index (inclusive).
`Path` | `subpath(int beginIndex, int endIndex)` Return a new path consisting of the segments between the `beginIndex` index (inclusive) and the `endIndex` index (exclusive).

Methods inherited from class org.modeshape.jcr.value.basic.AbstractPath
`createSegmentsSubList, doGetString, hashCode, isIdentifier, isNormalized, relativeTo, resolveAgainst, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### INSTANCE

    public static final Path INSTANCE

Method Detail

### getAncestor

    public Path getAncestor(int degree)

  Description copied from interface: `Path`
  Return the path to the ancestor of the supplied degree. An ancestor of degree `x` is the path that is `x` levels up along the path. For example, `degree = 0` returns this path, while `degree = 1` returns the parent of this path, `degree = 2` returns the grandparent of this path, and so on. Note that the result may be unexpected if this path is not `normalized`, as a non-normalized path contains ".." and "." segments.

  Returns:
    the ancestor of the supplied degree

### getSegmentsOfParent

    protected Iterator<Path.Segment> getSegmentsOfParent()

  Description copied from class: `AbstractPath`
  Method used by `AbstractPath.equals(Object)` implementation to quickly get an Iterator over the segments in the parent.

  Specified by:
    `getSegmentsOfParent` in class `AbstractPath`
  Returns:
    the iterator over the segments; never null, but may not have any elements

### getCanonicalPath

    public Path getCanonicalPath()

  Description copied from interface: `Path`
  Get the canonical form of this path. A canonical path has is `absolute` and `Path.isNormalized()`.

  Specified by:
    `getCanonicalPath` in interface `Path`
  Overrides:
    `getCanonicalPath` in class `AbstractPath`
  Returns:
    the canonical path, or this object if it is already in its canonical form

### getCommonAncestor

    public Path getCommonAncestor(Path that)

  Description copied from interface: `Path`
  Find the lowest common ancestor of this path and the supplied path.

  Specified by:
    `getCommonAncestor` in interface `Path`
  Overrides:
    `getCommonAncestor` in class `AbstractPath`
  Parameters:
    `that` - the other path
  Returns:
    the lowest common ancestor, which may be the root path if there is no other.

### getLastSegment

    public Path.Segment getLastSegment()

  Description copied from interface: `Path`
  Get the last segment in this path.

  Specified by:
    `getLastSegment` in interface `Path`
  Overrides:
    `getLastSegment` in class `AbstractPath`
  Returns:
    the last segment, or null if the path is empty

### endsWith

    public boolean endsWith(Name nameOfLastSegment)

  Description copied from interface: `Path`
  Determine if the path's `Path.getLastSegment()` has the supplied name and no `SNS index`.

  Specified by:
    `endsWith` in interface `Path`
  Overrides:
    `endsWith` in class `AbstractPath`
  Parameters:
    `nameOfLastSegment` - the name
  Returns:
    return true if the supplied name is the name in the path's last segment (and there is no SNS index), or false otherwise

### endsWith

    public boolean endsWith(Name nameOfLastSegment,
                            int snsIndex)

  Description copied from interface: `Path`
  Determine if the path's `Path.getLastSegment()` has the supplied name and `SNS index`.

  Specified by:
    `endsWith` in interface `Path`
  Overrides:
    `endsWith` in class `AbstractPath`
  Parameters:
    `nameOfLastSegment` - the name
    `snsIndex` - the SNS index
  Returns:
    return true if the path's last segment has the supplied name and SNS, or false otherwise

### getNormalizedPath

    public Path getNormalizedPath()

  Description copied from interface: `Path`
  Get a normalized path with as many ".." segments and all "." resolved. The relative path ".", however, will return itself as the normalized path, since it cannot be resolved any further.

  Specified by:
    `getNormalizedPath` in interface `Path`
  Overrides:
    `getNormalizedPath` in class `AbstractPath`
  Returns:
    the normalized path, or this object if this path is already normalized

### relativeToRoot

    public Path relativeToRoot()

  Description copied from interface: `Path`
  Obtain a path that is relative to the root node. This is equivalent to calling `Path.relativeTo(Path)` with the root path.

  Specified by:
    `relativeToRoot` in interface `Path`
  Overrides:
    `relativeToRoot` in class `AbstractPath`
  Returns:
    the relative path from the root node; never null

### resolve

    public Path resolve(Path relativePath)

  Description copied from interface: `Path`
  Get the absolute path by resolving the supplied relative (non-absolute) path against this absolute path.

  Specified by:
    `resolve` in interface `Path`
  Overrides:
    `resolve` in class `AbstractPath`
  Parameters:
    `relativePath` - the relative path that is to be resolved against this path
  Returns:
    the absolute and normalized path resolved from this path and the supplied absolute path

### getParent

    public Path getParent()

  Description copied from interface: `Path`
  Return the path to the parent, or this path if it is the `root`. This is an efficient operation that does not require copying any data.

  Specified by:
    `getParent` in interface `Path`
  Overrides:
    `getParent` in class `AbstractPath`
  Returns:
    the parent path, or this null if it is already the root

### getSegment

    public Path.Segment getSegment(int index)

  Description copied from interface: `Path`
  Get the segment at the supplied index.

  Specified by:
    `getSegment` in interface `Path`
  Overrides:
    `getSegment` in class `AbstractPath`
  Parameters:
    `index` - the index
  Returns:
    the segment

### getSegmentsArray

    public Path.Segment[] getSegmentsArray()

  Description copied from interface: `Path`
  Obtain a copy of the segments in this path. None of the segments are encoded.

  Specified by:
    `getSegmentsArray` in interface `Path`
  Overrides:
    `getSegmentsArray` in class `AbstractPath`
  Returns:
    the array of segments as a copy

### getSegmentsList

    public List<Path.Segment> getSegmentsList()

  Description copied from interface: `Path`
  Get an unmodifiable list of the path segments.

  Returns:
    the unmodifiable list of path segments; never null

### getString

    public String getString()

  Description copied from interface: `Readable`
  Get the string form of the object. A `default encoder` is used to encode characters.

  Specified by:
    `getString` in interface `Readable`
  Overrides:
    `getString` in class `AbstractPath`
  Returns:
    the encoded string
  See Also:
    `Readable.getString(TextEncoder)`

### getString

    public String getString(TextEncoder encoder)

  Description copied from interface: `Readable`
  Get the encoded string form of the object, using the supplied encoder to encode characters.

  Specified by:
    `getString` in interface `Readable`
  Overrides:
    `getString` in class `AbstractPath`
  Parameters:
    `encoder` - the encoder to use, or null if the `default encoder` should be used
  Returns:
    the encoded string
  See Also:
    `Readable.getString()`

### getString

    public String getString(NamespaceRegistry namespaceRegistry)

  Description copied from interface: `Readable`
  Get the string form of the object, using the supplied namespace registry to convert any namespace URIs to prefixes. A `default encoder` is used to encode characters.

  Specified by:
    `getString` in interface `Readable`
  Overrides:
    `getString` in class `AbstractPath`
  Parameters:
    `namespaceRegistry` - the namespace registry that should be used to obtain the prefix for any namespace URIs
  Returns:
    the encoded string
  See Also:
    `Readable.getString(NamespaceRegistry,TextEncoder)`

### getString

    public String getString(NamespaceRegistry namespaceRegistry,
                            TextEncoder encoder)

  Description copied from interface: `Readable`
  Get the encoded string form of the object, using the supplied namespace registry to convert the any namespace URIs to prefixes.

  Specified by:
    `getString` in interface `Readable`
  Overrides:
    `getString` in class `AbstractPath`
  Parameters:
    `namespaceRegistry` - the namespace registry that should be used to obtain the prefix for the namespace URIs
    `encoder` - the encoder to use, or null if the `default encoder` should be used
  Returns:
    the encoded string
  See Also:
    `Readable.getString(NamespaceRegistry)`

### getString

    public String getString(NamespaceRegistry namespaceRegistry,
                            TextEncoder encoder,
                            TextEncoder delimiterEncoder)

  Description copied from interface: `Readable`
  Get the encoded string form of the object, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part of any names.

  Specified by:
    `getString` in interface `Readable`
  Overrides:
    `getString` in class `AbstractPath`
  Parameters:
    `namespaceRegistry` - the namespace registry that should be used to obtain the prefix for the namespace URIs in the segment `names`
    `encoder` - the encoder to use for encoding the local part and namespace prefix of any names, or null if the `default encoder` should be used
    `delimiterEncoder` - the encoder to use for encoding the delimiter between the local part and namespace prefix of any names, or null if the standard delimiter should be used
  Returns:
    the encoded string
  See Also:
    `Readable.getString(NamespaceRegistry)`, `Readable.getString(NamespaceRegistry, TextEncoder)`

### hasSameAncestor

    public boolean hasSameAncestor(Path that)

  Description copied from interface: `Path`
  Determine whether this path and the supplied path have the same immediate ancestor. In other words, this method determines whether the node represented by this path is a sibling of the node represented by the supplied path.

  Specified by:
    `hasSameAncestor` in interface `Path`
  Overrides:
    `hasSameAncestor` in class `AbstractPath`
  Parameters:
    `that` - the other path
  Returns:
    true if this path and the supplied path have the same immediate ancestor.

### isAbsolute

    public boolean isAbsolute()

  Description copied from interface: `Path`
  Return whether this path is an absolute path. A path is either relative or `absolute`. An absolute path starts with a "/".

  Returns:
    true if the path is absolute, or false otherwise

### isAncestorOf

    public boolean isAncestorOf(Path descendant)

  Description copied from interface: `Path`
  Determine whether this path is an ancestor of the supplied path. A path is considered an ancestor of another path if the the ancestor path appears in its entirety at the beginning of the descendant path, and where the descendant path contains at least one additional segment.

  Specified by:
    `isAncestorOf` in interface `Path`
  Overrides:
    `isAncestorOf` in class `AbstractPath`
  Parameters:
    `descendant` - the path that may be the descendant; may be null
  Returns:
    true if this path is an ancestor of the supplied path, or false otherwise

### isAtOrAbove

    public boolean isAtOrAbove(Path other)

  Description copied from interface: `Path`
  Determine whether this path is the `same as` to or a `ancestor of` the supplied path. This method is equivalent to (but may be more efficient than) calling `isSame(other) || isAncestor(other)`, and is a convenience method that is identical to calling `other.isAtOrBelow(this)`.

  Specified by:
    `isAtOrAbove` in interface `Path`
  Overrides:
    `isAtOrAbove` in class `AbstractPath`
  Parameters:
    `other` - the other path to compare with this path; may be null
  Returns:
    true if the paths are equivalent or if this path is considered an ancestor of the other path, or false otherwise

### isAtOrBelow

    public boolean isAtOrBelow(Path other)

  Description copied from interface: `Path`
  Determine whether this path is the `same as` to or a `descendant of` the supplied path. This method is equivalent to (but may be more efficient than) calling `isSame(other) || isAncestor(other)`.

  Specified by:
    `isAtOrBelow` in interface `Path`
  Overrides:
    `isAtOrBelow` in class `AbstractPath`
  Parameters:
    `other` - the other path to compare with this path; may be null
  Returns:
    true if the paths are equivalent or if this path is considered a descendant of the other path, or false otherwise

### isDescendantOf

    public boolean isDescendantOf(Path ancestor)

  Description copied from interface: `Path`
  Determine whether this path is an descendant of the supplied path. A path is considered a descendant of another path if the the descendant path starts exactly with the entire ancestor path but contains at least one additional segment.

  Specified by:
    `isDescendantOf` in interface `Path`
  Overrides:
    `isDescendantOf` in class `AbstractPath`
  Parameters:
    `ancestor` - the path that may be the ancestor; may be null
  Returns:
    true if this path is an descendant of the supplied path, or false otherwise

### isNormalized

    public boolean isNormalized()

  Description copied from interface: `Path`
  Return whether this path is normalized and contains no unnecessary "." segments and as few ".." segments as possible. For example, the path "../a" is normalized, while "/a/b/c/../d" is not normalized.

  Returns:
    true if this path is normalized, or false otherwise

### isRoot

    public boolean isRoot()

  Description copied from interface: `Path`
  Return whether this path represents the root path.

  Returns:
    true if this path is the root path, or false otherwise

### isSameAs

    public boolean isSameAs(Path other)

  Description copied from interface: `Path`
  Determine whether this path represents the same as the supplied path. This is equivalent to calling `this.compareTo(other) == 0` .

  Specified by:
    `isSameAs` in interface `Path`
  Overrides:
    `isSameAs` in class `AbstractPath`
  Parameters:
    `other` - the other path to compare with this path; may be null
  Returns:
    true if the paths are equivalent, or false otherwise

### iterator

    public Iterator<Path.Segment> iterator()

  Specified by:
    `iterator` in interface `Iterable<Path.Segment>`
  Overrides:
    `iterator` in class `AbstractPath`

### pathsFromRoot

    public Iterator<Path> pathsFromRoot()

  Description copied from interface: `Path`
  Return an iterator that walks the paths from the root path down to this path. This method always returns at least one path (the root returns an iterator containing itself).

  Specified by:
    `pathsFromRoot` in interface `Path`
  Overrides:
    `pathsFromRoot` in class `AbstractPath`
  Returns:
    the path iterator; never null

### size

    public int size()

  Description copied from interface: `Path`
  Return the number of segments in this path.

  Returns:
    the number of path segments

### subpath

    public Path subpath(int beginIndex)

  Description copied from interface: `Path`
  Return a new path consisting of the segments starting at `beginIndex` index (inclusive). This is equivalent to calling `path.subpath(beginIndex,path.size()-1)`.

  Specified by:
    `subpath` in interface `Path`
  Overrides:
    `subpath` in class `AbstractPath`
  Parameters:
    `beginIndex` - the beginning index, inclusive.
  Returns:
    the specified subpath

### subpath

    public Path subpath(int beginIndex,
                        int endIndex)

  Description copied from interface: `Path`
  Return a new path consisting of the segments between the `beginIndex` index (inclusive) and the `endIndex` index (exclusive).

  Specified by:
    `subpath` in interface `Path`
  Overrides:
    `subpath` in class `AbstractPath`
  Parameters:
    `beginIndex` - the beginning index, inclusive.
    `endIndex` - the ending index, exclusive.
  Returns:
    the specified subpath

### compareTo

    public int compareTo(Path other)

  Specified by:
    `compareTo` in interface `Comparable<Path>`
  Overrides:
    `compareTo` in class `AbstractPath`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `AbstractPath`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.