org.modeshape.jcr.value.basic

## Class BasicPathSegment

- java.lang.Object
- - org.modeshape.jcr.value.basic.BasicPathSegment

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable<Path.Segment>, Path.Segment, Readable
  Direct Known Subclasses:
    IdentifierPathSegment

      @Immutable
      public class BasicPathSegment
      extends Object
      implements Path.Segment

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicPathSegment(Name name)`
    `BasicPathSegment(Name name, int index)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(Path.Segment that)`
    `boolean` | `equals(Object obj)`
    `int` | `getIndex()` Get the index for this segment, which will be 1 by default.
    `Name` | `getName()` Get the name component of this segment.
    `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.
    `String` | `getUnencodedString()` Get the raw string form of the segment using the `no-op encoder`.
    `int` | `hashCode()`
    `boolean` | `hasIndex()` Return whether this segment has an index.
    `boolean` | `isIdentifier()` Return whether this segment is an identifier segment.
    `boolean` | `isParentReference()` Return whether this segment is a reference to a parent.
    `boolean` | `isSelfReference()` Return whether this segment is a self-reference.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### BasicPathSegment

          public BasicPathSegment(Name name)

      Parameters:
        `name` - the segment name
      Throws:
        `IllegalArgumentException` - if the name is null or if the index is invalid

    - #### BasicPathSegment

          public BasicPathSegment(Name name,
                          int index)

      Parameters:
        `name` - the segment name
        `index` - the segment index
      Throws:
        `IllegalArgumentException` - if the name is null or if the index is invalid

  - ### Method Detail

    - #### getIndex

          public int getIndex()

      Description copied from interface: `Path.Segment`
      Get the index for this segment, which will be 1 by default.
      Specified by:
        `getIndex` in interface `Path.Segment`
      Returns:
        the index

    - #### getName

          public Name getName()

      Description copied from interface: `Path.Segment`
      Get the name component of this segment.
      Specified by:
        `getName` in interface `Path.Segment`
      Returns:
        the segment's name

    - #### hasIndex

          public boolean hasIndex()

      Description copied from interface: `Path.Segment`
      Return whether this segment has an index.
      Specified by:
        `hasIndex` in interface `Path.Segment`
      Returns:
        true if this segment has an index, or false otherwise.

    - #### isParentReference

          public boolean isParentReference()

      Description copied from interface: `Path.Segment`
      Return whether this segment is a reference to a parent.
      Specified by:
        `isParentReference` in interface `Path.Segment`
      Returns:
        true if the segment is a parent-reference, or false otherwise.

    - #### isSelfReference

          public boolean isSelfReference()

      Description copied from interface: `Path.Segment`
      Return whether this segment is a self-reference.
      Specified by:
        `isSelfReference` in interface `Path.Segment`
      Returns:
        true if the segment is a self-reference, or false otherwise.

    - #### isIdentifier

          public boolean isIdentifier()

      Description copied from interface: `Path.Segment`
      Return whether this segment is an identifier segment.
      Specified by:
        `isIdentifier` in interface `Path.Segment`
      Returns:
        true if the segment is an identifier segment, or false otherwise.

    - #### compareTo

          public int compareTo(Path.Segment that)

      Specified by:
        `compareTo` in interface `Comparable<Path.Segment>`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getUnencodedString

          public String getUnencodedString()

      Description copied from interface: `Path.Segment`
      Get the raw string form of the segment using the `no-op encoder`. This is equivalent to calling `getString(Path.NO_OP_ENCODER)`.
      Specified by:
        `getUnencodedString` in interface `Path.Segment`
      Returns:
        the un-encoded string
      See Also:
        `Readable.getString(TextEncoder)`

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

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