com.holonplatform.core.config

## Interface ConfigPropertySet

- All Known Subinterfaces:
    BeanConfigProperties, DatastoreConfigProperties, JwtConfigProperties
  All Known Implementing Classes:
    BeanConfigProperties.BeanConfigPropertiesImpl, DatastoreConfigProperties.DatastoreConfigPropertiesImpl, com.holonplatform.core.internal.config.DefaultConfigPropertySet, JwtConfigProperties.JwtConfigPropertiesImpl

      public interface ConfigPropertySet

  A set of configuration properties, identified by a specific name, used as property definition prefix.

  For external property definitions (for example using a `.properties` file), the actual property name is composed using the property set name returned by `getName()` and the given specific `name`. For example, if the property set name is `test` and the property name is `prop`, the actual property name will be `test.prop`.

  Since:
    5.0.0
  See Also:
    `ConfigProperty`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ConfigPropertySet.Builder<C extends ConfigPropertySet>` Builder to create `ConfigPropertySet`s bound to property data sources.
    `static class` | `ConfigPropertySet.ConfigurationException` Exception thrown for configuration errors.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> String` | `getConfigPropertyName(ConfigProperty<T> property)` Get the complete name of given configuration property, i.e. the property key prefixed by the `ConfigPropertySet` name.
    `<T> Optional<T>` | `getConfigPropertyValue(ConfigProperty<T> property)` Get the value associated to given `property`, if available.
    `default <T> T` | `getConfigPropertyValue(ConfigProperty<T> property, T defaultValue)` Returns the value associated to given `property`.
    `default <T> Optional<T>` | `getConfigPropertyValueOrElse(ConfigProperty<T> property, Supplier<Optional<T>> orElse)` Get the value associated to given `property`, if available.
    `String` | `getName()` Configuration property set name, used as property definition prefix.
    `Map<String,String>` | `getSubPropertiesUsingPrefix(String prefix)` Get a key-value `Map` of all the properties at sub levels of this property set, starting from given prefix.
    `<T> boolean` | `hasConfigProperty(ConfigProperty<T> property)` Checks whether this property set contains a not `null` value associated to given `property`.

- - ### Method Detail

    - #### getName

          String getName()

      Configuration property set name, used as property definition prefix.
      Returns:
        Configuration properties set name (not null)

    - #### getConfigPropertyName

          <T> String getConfigPropertyName(ConfigProperty<T> property)

      Get the complete name of given configuration property, i.e. the property key prefixed by the `ConfigPropertySet` name.
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - The configuration property for which to obtain the complete name (not null)
      Returns:
        the complete configuration property name

    - #### hasConfigProperty

          <T> boolean hasConfigProperty(ConfigProperty<T> property)

      Checks whether this property set contains a not `null` value associated to given `property`.
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - Property to check (not null)
      Returns:
        `true` if this property set contains a not `null` value associated to given `property`

    - #### getConfigPropertyValue

          <T> Optional<T> getConfigPropertyValue(ConfigProperty<T> property)

      Get the value associated to given `property`, if available.
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - Configuration property to read (not null)
      Returns:
        Optional config property value

    - #### getConfigPropertyValue

          default <T> T getConfigPropertyValue(ConfigProperty<T> property,
                                               T defaultValue)

      Returns the value associated to given `property`.
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - Configuration property to read (not null)
        `defaultValue` - Default value to return if property was not found or has no value
      Returns:
        Property value, or `defaultValue` if not found

    - #### getConfigPropertyValueOrElse

          default <T> Optional<T> getConfigPropertyValueOrElse(ConfigProperty<T> property,
                                                               Supplier<Optional<T>> orElse)

      Get the value associated to given `property`, if available. If not available, try to obtain the value from the provided `orElse` supplier.
      Type Parameters:
        `T` - Property type
      Parameters:
        `property` - Configuration property to read (not null)
        `orElse` - Fallback value supplier (not null)
      Returns:
        Optional config property value

    - #### getSubPropertiesUsingPrefix

          Map<String,String> getSubPropertiesUsingPrefix(String prefix)

      Get a key-value `Map` of all the properties at sub levels of this property set, starting from given prefix.
      Parameters:
        `prefix` - Prefix to use (not null)
      Returns:
        Map of all the properties at sub levels of this property set, starting from given prefix. An empty map if one found.

Copyright © 2019 The Holon Platform. All rights reserved.