com.holonplatform.core.property

## Interface PropertyValuePresenterRegistry

-     public interface PropertyValuePresenterRegistry

  A registry to register `PropertyValuePresenter`s bound to a condition and provide a suitable `PropertyValuePresenter`.

  The registry supports `PropertyValuePresenter`s priority declaration using `Priority` annotation on presenter class (where less priority value means higher priority order), to select and return the most suitable presenter where more than one presenter matches the condition to which is bound at registration time.

  Since:
    5.0.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CONTEXT_KEY` Default `Context` resource key

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PropertyValuePresenterRegistry` | `create(boolean loadDefaults)` Create a default instance of `PropertyValuePresenterRegistry`.
    `static PropertyValuePresenterRegistry` | `get()` Gets the current `PropertyValuePresenterRegistry` instance.
    `static PropertyValuePresenterRegistry` | `getDefault()` Return the default `PropertyValuePresenterRegistry` using default `ClassLoader`.
    `static PropertyValuePresenterRegistry` | `getDefault(ClassLoader classLoader)` Return the default `PropertyValuePresenterRegistry` using given `classLoader`.
    `<T> Optional<PropertyValuePresenter<T>>` | `getPresenter(Property<T> property)` Gets the `PropertyValuePresenter` to use with given `property` according to registered presenters.
    `<T> void` | `register(Predicate<Property<? extends T>> condition, PropertyValuePresenter<? super T> presenter)` Bind a `PropertyValuePresenter` to a property `Predicate` `condition`

- - ### Field Detail

    - #### CONTEXT_KEY

          static final String CONTEXT_KEY

      Default `Context` resource key

  - ### Method Detail

    - #### register

          <T> void register(Predicate<Property<? extends T>> condition,
                            PropertyValuePresenter<? super T> presenter)

      Bind a `PropertyValuePresenter` to a property `Predicate` `condition`
      Type Parameters:
        `T` - Property base type
      Parameters:
        `condition` - Condition which has to be satisfied to provide the presenter (not null)
        `presenter` - PropertyPresenter to register (not null)

    - #### getPresenter

          <T> Optional<PropertyValuePresenter<T>> getPresenter(Property<T> property)

      Gets the `PropertyValuePresenter` to use with given `property` according to registered presenters.
      Type Parameters:
        `T` - Property base type
      Parameters:
        `property` - Property to present
      Returns:
        PropertyValuePresenter, or an empty Optional if no presenter is available for given property

    - #### create

          static PropertyValuePresenterRegistry create(boolean loadDefaults)

      Create a default instance of `PropertyValuePresenterRegistry`.
      Parameters:
        `loadDefaults` - `true` to load default `PropertyValuePresenter`s from `META-INF/services` using `com.holonplatform.core.property.PropertyValuePresenter` files using default ClassLoader. Every default presenter will be registered using an always `true` condition.
      Returns:
        PropertyValuePresenterRegistry instance

    - #### get

          static PropertyValuePresenterRegistry get()

      Gets the current `PropertyValuePresenterRegistry` instance.
      Returns:
        The `Context`-bound PropertyValuePresenterRegistry instance, if available using `CONTEXT_KEY` as context key, or the default instance for the default ClassLoader obtained through `getDefault()`.

    - #### getDefault

          static PropertyValuePresenterRegistry getDefault(ClassLoader classLoader)

      Return the default `PropertyValuePresenterRegistry` using given `classLoader`.

      The default registry is inited loading `PropertyValuePresenter`s using fully qualified name of its implementation class name to a `com.holonplatform.core.property.PropertyValuePresenter` file in the `META-INF/services` directory.

      Parameters:
        `classLoader` - ClassLoader to use
      Returns:
        Default PropertyValuePresenterRegistry

    - #### getDefault

          static PropertyValuePresenterRegistry getDefault()

      Return the default `PropertyValuePresenterRegistry` using default `ClassLoader`.

      The default registry is inited loading `PropertyValuePresenter`s using fully qualified name of its implementation class name to a `com.holonplatform.core.property.PropertyValuePresenter` file in the `META-INF/services` directory.

      Returns:
        Default PropertyValuePresenterRegistry

Copyright © 2017 The Holon Platform. All rights reserved.