org.modeshape.jcr.value.basic

## Class BasicPath

- java.lang.Object
- - org.modeshape.jcr.value.basic.AbstractPath
  - - org.modeshape.jcr.value.basic.BasicPath

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

      @Immutable
      public class BasicPath
      extends AbstractPath

  A basic implementation of `Path`.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.value.Path

      `Path.Segment`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Path` | `EMPTY_RELATIVE`
    `static Path` | `PARENT_PATH`
    `static Path` | `SELF_PATH`

    - ### Fields inherited from class org.modeshape.jcr.value.basic.AbstractPath

      `EMPTY_PATH_ITERATOR`

    - ### 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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicPath(List<Path.Segment> segments, boolean absolute)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Path` | `getAncestor(int degree)` Return the path to the ancestor of the supplied degree.
    `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.
    `boolean` | `isAbsolute()` Return whether this path is an absolute 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.
    `int` | `size()` Return the number of segments in this path.

    - ### Methods inherited from class org.modeshape.jcr.value.basic.AbstractPath

      `compareTo, createSegmentsSubList, doGetString, endsWith, endsWith, equals, getCanonicalPath, getCommonAncestor, getLastSegment, getNormalizedPath, getParent, getSegment, getSegmentsArray, getString, getString, getString, getString, getString, hashCode, hasSameAncestor, isAncestorOf, isAtOrAbove, isAtOrBelow, isDescendantOf, isIdentifier, isNormalized, isSameAs, iterator, pathsFromRoot, relativeTo, relativeToRoot, resolve, resolveAgainst, subpath, subpath, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_RELATIVE

          public static final Path EMPTY_RELATIVE

    - #### SELF_PATH

          public static final Path SELF_PATH

    - #### PARENT_PATH

          public static final Path PARENT_PATH

  - ### Constructor Detail

    - #### BasicPath

          public BasicPath(List<Path.Segment> segments,
                   boolean absolute)

      Parameters:
        `segments` - the segments
        `absolute` - true if this path is absolute, or false otherwise

  - ### 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

    - #### 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

    - #### 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

    - #### 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

    - #### size

          public int size()

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

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