org.infinispan.schematic.document

## Interface Path

- All Superinterfaces:
    Comparable<Path>, Iterable<String>
  All Known Implementing Classes:
    Paths.EmptyPath, Paths.MultiSegmentPath, Paths.SinglePath

      @Immutable
      public interface Path
      extends Iterable<String>, Comparable<Path>

  The path to a field somewhere within a document.
  Since:
    5.1

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `get(int segmentNumber)` Get a particular segment within this path.
    `String` | `getFirst()` Get the first segment in the path.
    `String` | `getLast()` Get the last segment in the path.
    `Path` | `parent()` Get the parent path, which may be an empty path.
    `int` | `size()` Get the number of segments in this path.
    `boolean` | `startsWith(Path other)` Determine if the first segments of this path are equal to the segments in the supplied path.
    `Path` | `with(String fieldName)` Obtain a path that has this path as the parent and which has as the last segment the supplied field name.

    - ### Methods inherited from interface java.lang.Iterable

      `iterator`

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Method Detail

    - #### get

          String get(int segmentNumber)

      Get a particular segment within this path.
      Parameters:
        `segmentNumber` - the 0-based index of the segment in this path
      Returns:
        the segment; never null
      Throws:
        `IndexOutOfBoundsException` - if the segment number is negative, or greater than or equal to the `size`.

    - #### getLast

          String getLast()

      Get the last segment in the path.
      Returns:
        the field name in the last segment of this path, or null if this is the empty path

    - #### getFirst

          String getFirst()

      Get the first segment in the path.
      Returns:
        the field name in the first segment of this path, or null if this is the empty path

    - #### size

          int size()

      Get the number of segments in this path. An empty path with have a size of '0'.
      Returns:
        the size of this path; never negative

    - #### with

          Path with(String fieldName)

      Obtain a path that has this path as the parent and which has as the last segment the supplied field name.
      Parameters:
        `fieldName` - the field name for the last segment in the new path; may be null
      Returns:
        the new path, or this path if the `fieldName` parameter is null; never null

    - #### parent

          Path parent()

      Get the parent path, which may be an empty path.
      Returns:
        the parent path; never null

    - #### startsWith

          boolean startsWith(Path other)

      Determine if the first segments of this path are equal to the segments in the supplied path. This method returns true if the two paths are equal, or if the supplied path is an ancestor of this path.
      Parameters:
        `other` - the other path; may not be null
      Returns:
        true if the other path is equal to or an ancestor of this path, or false otherwise

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