com.holonplatform.core.property

## Interface PathPropertyBoxAdapter

- All Superinterfaces:
    PathPropertySetAdapter

      public interface PathPropertyBoxAdapter
      extends PathPropertySetAdapter

  Adapter to use `Path` expressions to inspect and set `PropertyBox` values.
  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `PathPropertyBoxAdapter.PathPropertyBoxAdapterBuilder` Default builder.

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

      `PathPropertySetAdapter.Builder<B extends PathPropertySetAdapter.Builder<B,A>,A extends PathPropertySetAdapter>, PathPropertySetAdapter.PathConverter, PathPropertySetAdapter.PathMatcher, PathPropertySetAdapter.PathPropertySetAdapterBuilder, PathPropertySetAdapter.PropertyPath<T>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PathPropertyBoxAdapter.PathPropertyBoxAdapterBuilder` | `builder(PropertyBox propertyBox)` Create a new `PathPropertyBoxAdapter` builder.
    `<T> boolean` | `containsValue(Path<T> path)` Check if the `PropertyBox` contains a `Property` which corresponds to given `path` with a not `null` value.
    `static PathPropertyBoxAdapter` | `create(PropertyBox propertyBox)` Create a new `PathPropertyBoxAdapter`.
    `<T> Optional<T>` | `getValue(Path<T> path)` Get the value of the `PropertyBox` property which corresponds to given `path`, if the the property is present and its value is not `null`.
    `<T> Optional<T>` | `getValueOrElse(Path<T> path, Consumer<Path<T>> valueNotPresent)` Get the value of the `PropertyBox` property which corresponds to given `path`, if the the property is present and its value is not `null`.
    `<T> Optional<Property<T>>` | `setValue(Path<T> path, T value)` Set the value of the `PropertyBox` property which corresponds to given `path`, if such property is available.

    - ### Methods inherited from interface com.holonplatform.core.property.PathPropertySetAdapter

      `builder, contains, contains, create, getPath, getPathIdentifiers, getProperty, getProperty, getProperty, names, paths, propertyPaths`

- - ### Method Detail

    - #### containsValue

          <T> boolean containsValue(Path<T> path)

      Check if the `PropertyBox` contains a `Property` which corresponds to given `path` with a not `null` value.
      Type Parameters:
        `T` - Property type
      Parameters:
        `path` - Path to check (not null)
      Returns:
        `true` if a property which corresponds to given `path` is present and the property value is not `null`

    - #### getValue

          <T> Optional<T> getValue(Path<T> path)

      Get the value of the `PropertyBox` property which corresponds to given `path`, if the the property is present and its value is not `null`.
      Type Parameters:
        `T` - Path and value type
      Parameters:
        `path` - Path for which obtain the property value (not null)
      Returns:
        The value of the property which corresponds to given `path`, or an empty Optional if path does not corresponds to any property or the property has no value

    - #### getValueOrElse

          <T> Optional<T> getValueOrElse(Path<T> path,
                                         Consumer<Path<T>> valueNotPresent)

      Get the value of the `PropertyBox` property which corresponds to given `path`, if the the property is present and its value is not `null`. When no property or value available, invokes the given `Consumer`.
      Type Parameters:
        `T` - Path and value type
      Parameters:
        `path` - Path for which obtain the property value (not null)
        `valueNotPresent` - Consumer to be invoked when a value is not available for given path
      Returns:
        The value of the property which corresponds to given `path`, or an empty Optional if path does not corresponds to any property or the property has no value

    - #### setValue

          <T> Optional<Property<T>> setValue(Path<T> path,
                                             T value)

      Set the value of the `PropertyBox` property which corresponds to given `path`, if such property is available.
      Type Parameters:
        `T` - Path and value type
      Parameters:
        `path` - Path for which to set the value (not null)
        `value` - The value to set
      Returns:
        The property which corresponds to given `path` and for which the value was setted, or an empty Optional if no property corresponds to given `path`
      Throws:
        `Property.PropertyAccessException` - If an error occurred setting the property value
        `Property.PropertyReadOnlyException` - If the property is read-only
        `Validator.ValidationException` - If property value validation fails

    - #### create

          static PathPropertyBoxAdapter create(PropertyBox propertyBox)

      Create a new `PathPropertyBoxAdapter`.
      Parameters:
        `propertyBox` - The `PropertyBox` set to use (not null)
      Returns:
        A new `PathPropertyBoxAdapter`

    - #### builder

          static PathPropertyBoxAdapter.PathPropertyBoxAdapterBuilder builder(PropertyBox propertyBox)

      Create a new `PathPropertyBoxAdapter` builder.
      Parameters:
        `propertyBox` - The `PropertyBox` set to use (not null)
      Returns:
        A new `PathPropertyBoxAdapter` builder

Copyright © 2019 The Holon Platform. All rights reserved.