org.hibernate.search.elasticsearch.util.impl

## Class PathComponentExtractor

- java.lang.Object
- - org.hibernate.search.elasticsearch.util.impl.PathComponentExtractor

- All Implemented Interfaces:
    Cloneable

      public class PathComponentExtractor
      extends Object
      implements Cloneable

  A stateful helper to extract path components from a string, one component at a time.
  Author:
    Yoann Rodiere

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PathComponentExtractor.ConsumptionLimit`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathComponentExtractor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(String pathPart)` Append a string to the path for later consumption through `next(ConsumptionLimit)`.
    `void` | `appendRelativePart(String otherPath)` Append to the path the part of `otherPath` that is relative to the current path.
    `PathComponentExtractor` | `clone()`
    `void` | `flushTo(PathComponentExtractor.ConsumptionLimit consumeLimit)` Consume all components in the current path up to the given limit.
    `String` | `getLastComponentAbsolutePath()`
    `String` | `next(PathComponentExtractor.ConsumptionLimit consumeLimit)` Consume one more component in the current path (provided it's not beyond the given limit) and returns this component.
    `void` | `reset()`
    `String` | `toString()`

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

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PathComponentExtractor

          public PathComponentExtractor()

  - ### Method Detail

    - #### append

          public void append(String pathPart)

      Append a string to the path for later consumption through `next(ConsumptionLimit)`.
      Parameters:
        `pathPart` - A string that may or may not include path component separators (dots).

    - #### appendRelativePart

          public void appendRelativePart(String otherPath)
                                  throws ParentPathMismatchException

      Append to the path the part of `otherPath` that is relative to the current path.

      In other words, replace the current path with `otherPath` provided `otherPath` denotes a child element of the current path, while preserving the memory of the previously consumed path components.

      Parameters:
        `otherPath` - A path that must start with the current path.
      Throws:
        `ParentPathMismatchException` - If `otherPath` is not contained with the current path.

    - #### next

          public String next(PathComponentExtractor.ConsumptionLimit consumeLimit)

      Consume one more component in the current path (provided it's not beyond the given limit) and returns this component.

      If this method reaches a incompletely qualified path component, i.e one that is not followed by a dot but by the end of the path, it will return it only if `consumptionLimit` is `PathComponentExtractor.ConsumptionLimit.LAST`.

      Parameters:
        `consumeLimit` - The consumption limit, i.e. the definition of the last component to consume in the path.
      Returns:
        The next path component, or `null` if the consumption limit has been reached.

    - #### flushTo

          public void flushTo(PathComponentExtractor.ConsumptionLimit consumeLimit)

      Consume all components in the current path up to the given limit.

      This is equivalent to calling `next(consumeLimit)` repeatedly until `null` is returned.

      Parameters:
        `consumeLimit` - The consumption limit, i.e. the definition of the last component to consume in the path.

    - #### reset

          public void reset()

    - #### getLastComponentAbsolutePath

          public String getLastComponentAbsolutePath()

      Returns:
        The absolute path of the last non-null path component returned by `next(ConsumptionLimit)`, or `null` if `next(ConsumptionLimit)` hasn't returned such a component yet.

    - #### clone

          public PathComponentExtractor clone()

      Overrides:
        `clone` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved