com.holonplatform.core

## Interface Path<T>

- Type Parameters:
    `T` - Type of the element identified by this path
  All Superinterfaces:
    DataMappable, Expression, Serializable, TypedExpression<T>
  All Known Subinterfaces:
    Aliasable.AliasablePath<T,C>, BeanDataTarget<T>, BeanProperty<T>, BeanProperty.Builder<T>, BooleanBeanProperty, BooleanProperty, BooleanProperty.BooleanPropertyBuilder, CloneableProperty.CloneablePathProperty<T,P>, CollectionPathProperty<E,C>, DataTarget<T>, Join<T>, ListPathProperty<T>, ListPathProperty.ListPathPropertyBuilder<T>, NumericBeanProperty<N>, NumericProperty<N>, NumericProperty.NumericPropertyBuilder<N>, Path.FinalPath<T>, Path.FinalPath.FinalPathBuilder<T>, Path.PathBuilder<T>, PathExpression<T>, PathProperty<T>, PathProperty.PathPropertyBuilder<T>, PropertyBoxProperty, PropertyBoxProperty.PropertyBoxPropertyBuilder, RelationalTarget<T>, SetPathProperty<T>, SetPathProperty.SetPathPropertyBuilder<T>, StringBeanProperty, StringProperty, StringProperty.StringPropertyBuilder, TemporalBeanProperty<T>, TemporalProperty<T>, TemporalProperty.TemporalPropertyBuilder<T>
  All Known Implementing Classes:
    DefaultFinalPath, DefaultPath

      public interface Path<T>
      extends TypedExpression<T>, DataMappable, Serializable

  Represents a generic, typed path for a data structure attribute which can be identified by a `String` name.

  If the path belongs to a hierarchical structure, the parent path can be provided using `getParent()`.

  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Path.Builder<T,B extends Path.Builder<T,B>>` Base path builder.
    `static interface` | `Path.FinalPath<T>` Represents a final path, i.e.
    `static interface` | `Path.PathBuilder<T>` Path builder.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.Expression

      `Expression.ExpressionResolverFunction<E extends Expression,R extends Expression>, Expression.InvalidExpressionException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static char` | `PATH_HIERARCHY_SEPARATOR` Separator character used as separator between path hierarchy elements when composing or parsing a path name.

    - ### Fields inherited from interface com.holonplatform.core.DataMappable

      `DEFAULT_CONFIG_PROPERTY_PREFIX, PATH`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default String` | `fullName()` Gets the path full name, including any parent path, separated by a dot `.` character.
    `default String` | `fullName(Function<Path<?>,String> nameMapper)` Gets the path full name, including any parent path, separated by a dot `.` character.
    `String` | `getName()` Gets the path name
    `Optional<Path<?>>` | `getParent()` Gets the parent path
    `default boolean` | `isRootPath()` Checks whether this path is a root path, i.e.
    `static <T> Path.PathBuilder<T>` | `of(String name, Class<? extends T> type)` Create a default `Path` implementation with given `name` and `type`.
    `default String` | `relativeName()` Gets the relative path name, separated by a dot `.` character, i.e.
    `default String` | `relativeName(Function<Path<?>,String> nameMapper)` Gets the relative path name, separated by a dot `.` character, i.e.
    `default Stream<Path<?>>` | `stream()` Returns a `Stream` of path hierarchy, starting form this path and walking through parent paths, if any.

    - ### Methods inherited from interface com.holonplatform.core.TypedExpression

      `getTemporalType, getType, isCollectionExpression, isConverterExpression`

    - ### Methods inherited from interface com.holonplatform.core.Expression

      `validate`

    - ### Methods inherited from interface com.holonplatform.core.DataMappable

      `getDataPath, isDataMappable`

- - ### Field Detail

    - #### PATH_HIERARCHY_SEPARATOR

          static final char PATH_HIERARCHY_SEPARATOR

      Separator character used as separator between path hierarchy elements when composing or parsing a path name.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getName

          String getName()

      Gets the path name
      Returns:
        Path name (should never be null)

    - #### getParent

          Optional<Path<?>> getParent()

      Gets the parent path
      Returns:
        Optional parent path, empty if none

    - #### isRootPath

          default boolean isRootPath()

      Checks whether this path is a root path, i.e. it has no parent path.
      Returns:
        `true` if it is a root path, `false` otherwise

    - #### stream

          default Stream<Path<?>> stream()

      Returns a `Stream` of path hierarchy, starting form this path and walking through parent paths, if any.
      Returns:
        Path hierarchy stream

    - #### fullName

          default String fullName()

      Gets the path full name, including any parent path, separated by a dot `.` character.
      Returns:
        Path full name

    - #### fullName

          default String fullName(Function<Path<?>,String> nameMapper)

      Gets the path full name, including any parent path, separated by a dot `.` character.
      Parameters:
        `nameMapper` - The function to use to obtain the path name (not null)
      Returns:
        Path full name

    - #### relativeName

          default String relativeName()

      Gets the relative path name, separated by a dot `.` character, i.e. exclude any `Path.FinalPath` path instance from path name composition.
      Returns:
        Path relative name, en empty String if this Path is a `Path.FinalPath` itself.

    - #### relativeName

          default String relativeName(Function<Path<?>,String> nameMapper)

      Gets the relative path name, separated by a dot `.` character, i.e. exclude any `Path.FinalPath` path instance from path name composition.
      Parameters:
        `nameMapper` - The function to use to obtain the path name (not null)
      Returns:
        Path relative name, en empty String if this Path is a `Path.FinalPath` itself.

    - #### of

          static <T> Path.PathBuilder<T> of(String name,
                                            Class<? extends T> type)

      Create a default `Path` implementation with given `name` and `type`.

      The returned type is a `Path` instance implementing also `Path.Builder` to provide instance configuration methods.

      Type Parameters:
        `T` - Path type
      Parameters:
        `name` - Path name (not null)
        `type` - Path type (not null)
      Returns:
        New PathBuilder path instance

Copyright © 2019 The Holon Platform. All rights reserved.