com.holonplatform.core.property

## Interface PathPropertySetAdapter

- All Known Subinterfaces:
    PathPropertyBoxAdapter

      public interface PathPropertySetAdapter

  Adapter to use `Path` expressions to inspect a `PropertySet`.

  The `Property` definitions of the property set can be inspected and obtained:

  - By `Path`, checking if a `Property` implements `Path` and if its path name corresponds to a given `Path` name.
  - By name, using the `Property` name (see `Property.getName()`) to look for a matching property definition.

  A `PathPropertySetAdapter.PathConverter` and a `PathPropertySetAdapter.PathMatcher` definition can be provided to the builder API to control and customize how a `Property` is converted to a `Path` and the path name matching strategy to use. See the `PathPropertySetAdapter.Builder` API for details.

  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `PathPropertySetAdapter.Builder<B extends PathPropertySetAdapter.Builder<B,A>,A extends PathPropertySetAdapter>` `PathPropertySetAdapter` builder.
    `static interface` | `PathPropertySetAdapter.PathConverter` Converter to obtain a `Path` from a `Property`.
    `static interface` | `PathPropertySetAdapter.PathMatcher` Function to implement a `Path` matching strategy.
    `static interface` | `PathPropertySetAdapter.PathPropertySetAdapterBuilder` Default builder.
    `static interface` | `PathPropertySetAdapter.PropertyPath<T>` `Property` and corresponding `Path` pair representation.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PathPropertySetAdapter.PathPropertySetAdapterBuilder` | `builder(PropertySet<?> propertySet)` Create a new `PathPropertySetAdapter` builder.
    `boolean` | `contains(Path<?> path)` Return `true` if a property which corresponds to given path is available in the property set.
    `boolean` | `contains(String name)` Checks if a `Property` with given `name` is present in the property set.
    `static PathPropertySetAdapter` | `create(PropertySet<?> propertySet)` Create a new `PathPropertySetAdapter`.
    `<T> Optional<Path<T>>` | `getPath(Property<T> property)` Check if given `property` is available in property set and if it can be represented as a `Path`.
    `Set<Path<?>>` | `getPathIdentifiers()` If the property set declares a set of identifiers, and each identifier property can be represented as a `Path`, returns the set of identifiers represented as paths.
    `<T> Optional<Property<T>>` | `getProperty(Path<T> path)` Check if a `Property` which corresponds to given `path` is present in the property set.
    `Optional<Property<?>>` | `getProperty(String name)` Get the `Property` with given `name`, if available in the property set.
    `<T> Optional<Property<T>>` | `getProperty(String name, Class<T> type)` Get the `Property` with given `name`, if available in the property set.
    `Stream<String>` | `names()` Returns a stream of the `Property` names available in the property set.
    `Stream<Path<?>>` | `paths()` Returns a stream of `Path`s, containing the `Path` representation of all the properties in the property set which can be represented as a `Path`.
    `Stream<PathPropertySetAdapter.PropertyPath<?>>` | `propertyPaths()` Returns a stream of the property set `Property` definitions which can be represented as a `Path`, providing the corresponding `Path` representation, using the `PathPropertySetAdapter.PropertyPath` interface to provide the Property-Path pairs.

- - ### Method Detail

    - #### contains

          boolean contains(Path<?> path)

      Return `true` if a property which corresponds to given path is available in the property set.
      Parameters:
        `path` - The path to check (not null)
      Returns:
        `true` if the property set contains a `Property` which corresponds to the specified path, `false` otherwise

    - #### getProperty

          <T> Optional<Property<T>> getProperty(Path<T> path)

      Check if a `Property` which corresponds to given `path` is present in the property set.
      Type Parameters:
        `T` - Path type
      Parameters:
        `path` - The path to check (not null)
      Returns:
        If a `Property` which corresponds to given `path` is present in the property set, returns the property. Otherwise an empty Optional is returned.

    - #### getPath

          <T> Optional<Path<T>> getPath(Property<T> property)

      Check if given `property` is available in property set and if it can be represented as a `Path`.
      Type Parameters:
        `T` - Path type
      Parameters:
        `property` - The property to check (not null)
      Returns:
        If given `property` is available in property set and if it can be represented as a `Path`, returns the property as a `Path`.Otherwise an empty Optional is returned.

    - #### getPathIdentifiers

          Set<Path<?>> getPathIdentifiers()

      If the property set declares a set of identifiers, and each identifier property can be represented as a `Path`, returns the set of identifiers represented as paths.
      Returns:
        A `Set` of identifier paths, or an empty `Set` if no identifier is provided by the property set or at least one of the identifier properties cannot be represented as a path

    - #### paths

          Stream<Path<?>> paths()

      Returns a stream of `Path`s, containing the `Path` representation of all the properties in the property set which can be represented as a `Path`.
      Returns:
        Property set paths stream

    - #### propertyPaths

          Stream<PathPropertySetAdapter.PropertyPath<?>> propertyPaths()

      Returns a stream of the property set `Property` definitions which can be represented as a `Path`, providing the corresponding `Path` representation, using the `PathPropertySetAdapter.PropertyPath` interface to provide the Property-Path pairs.
      Returns:
        A stream of `PathPropertySetAdapter.PropertyPath` elements

    - #### contains

          boolean contains(String name)

      Checks if a `Property` with given `name` is present in the property set.
      Parameters:
        `name` - Property name (not null)
      Returns:
        `true` if a `Property` with given `name` is present, `false` otherwise
      Since:
        5.2.0

    - #### getProperty

          <T> Optional<Property<T>> getProperty(String name,
                                                Class<T> type)

      Get the `Property` with given `name`, if available in the property set.
      Type Parameters:
        `T` - Property type
      Parameters:
        `name` - Property name (not null)
        `type` - Expected property type (not null)
      Returns:
        The `Property` with given `name`, if available
      Throws:
        `TypeMismatchException` - If a property with given name is present but its type is not compatible with the expected property type
      Since:
        5.2.0

    - #### getProperty

          Optional<Property<?>> getProperty(String name)

      Get the `Property` with given `name`, if available in the property set.
      Parameters:
        `name` - Property name (not null)
      Returns:
        The `Property` with given `name`, if available
      Since:
        5.2.0

    - #### names

          Stream<String> names()

      Returns a stream of the `Property` names available in the property set.
      Returns:
        Property names stream
      Since:
        5.2.0

    - #### create

          static PathPropertySetAdapter create(PropertySet<?> propertySet)

      Create a new `PathPropertySetAdapter`.
      Parameters:
        `propertySet` - The property set to use (not null)
      Returns:
        A new `PathPropertySetAdapter`

    - #### builder

          static PathPropertySetAdapter.PathPropertySetAdapterBuilder builder(PropertySet<?> propertySet)

      Create a new `PathPropertySetAdapter` builder.
      Parameters:
        `propertySet` - The property set to use (not null)
      Returns:
        A new `PathPropertySetAdapter` builder

Copyright © 2019 The Holon Platform. All rights reserved.