org.apache.tamaya.functions

## Class PropertySourceFunctions

- java.lang.Object
- - org.apache.tamaya.functions.PropertySourceFunctions

-     public final class PropertySourceFunctions
      extends Object

  Accessor that provides useful functions along with configuration.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.apache.tamaya.spi.PropertySource` | `addItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items)` Creates an operator that adds items to the instance.
    `static org.apache.tamaya.spi.PropertySource` | `addItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items, boolean override)` Creates a ConfigOperator that adds the given items.
    `static org.apache.tamaya.spi.PropertySource` | `emptyPropertySource()` Accesses an empty PropertySource.
    `static Collection<? extends org.apache.tamaya.spi.PropertySource>` | `findPropertySourcesByName(String expression)` Find all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
    `static <T> T` | `getPropertySource(Class<T> type)` Get a list of all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
    `static <T> Collection<T>` | `getPropertySources(Class<T> type)` Get a list of all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
    `static boolean` | `isKeyInSection(String key, String sectionKey)` Calculates the current section key and compares it to the given key.
    `static boolean` | `isKeyInSections(String key, String... sectionKeys)` Calculates the current section key and compares it to the given section keys.
    `static org.apache.tamaya.spi.PropertySource` | `replaceItems(org.apache.tamaya.spi.PropertySource propertySource, Map<String,String> items)` Creates an operator that replaces the given items.
    `static Map<String,String>` | `sectionRecursive(Map<String,String> properties, boolean stripKeys, String... sectionKeys)` Creates a ConfigOperator that creates a Configuration containing only keys that are contained in the given section (recursive).
    `static Set<String>` | `sections(Map<String,String> properties)` Return a query to evaluate the set with all fully qualified section names.
    `static Set<String>` | `sections(Map<String,String> properties, Predicate<String> predicate)` Return a query to evaluate the set with all fully qualified section names, containing only the sections that match the predicate and have properties attached.
    `static Map<String,String>` | `sectionsRecursive(Map<String,String> properties, String... sectionKeys)` Creates a ConfigOperator that creates a Configuration containing only keys that are contained in the given section (recursive).
    `static Set<String>` | `transitiveSections(Map<String,String> properties)` Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all subarea names, regardless if properties are accessible or not.
    `static Set<String>` | `transitiveSections(Map<String,String> properties, Predicate<String> predicate)` Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all subarea names, regardless if properties are accessible or not.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isKeyInSection

          public static boolean isKeyInSection(String key,
                               String sectionKey)

      Calculates the current section key and compares it to the given key.
      Parameters:
        `key` - the fully qualified entry key, not null
        `sectionKey` - the section key, not null
      Returns:
        true, if the entry is exact in this section

    - #### isKeyInSections

          public static boolean isKeyInSections(String key,
                                String... sectionKeys)

      Calculates the current section key and compares it to the given section keys.
      Parameters:
        `key` - the fully qualified entry key, not null
        `sectionKeys` - the section keys, not null
      Returns:
        true, if the entry is exact in this section

    - #### sections

          public static Set<String> sections(Map<String,String> properties)

      Return a query to evaluate the set with all fully qualified section names. This method should return the sections as accurate as possible, but may not provide a complete set of sections that are finally accessible, especially when the underlying storage does not support key iteration.
      Parameters:
        `properties` - properties to find sections in.
      Returns:
        set with all sections, never `null`.

    - #### transitiveSections

          public static Set<String> transitiveSections(Map<String,String> properties)

      Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all subarea names, regardless if properties are accessible or not. This method should return the sections as accurate as possible, but may not provide a complete set of sections that are finally accessible, especially when the underlying storage does not support key iteration.
      Parameters:
        `properties` - properties to find transitive sections in.
      Returns:
        s set with all transitive sections, never `null`.

    - #### sections

          public static Set<String> sections(Map<String,String> properties,
                             Predicate<String> predicate)

      Return a query to evaluate the set with all fully qualified section names, containing only the sections that match the predicate and have properties attached. This method should return the sections as accurate as possible, but may not provide a complete set of sections that are finally accessible, especially when the underlying storage does not support key iteration.
      Parameters:
        `properties` - properties to find sections in.
        `predicate` - A predicate to determine, which sections should be returned, not `null`.
      Returns:
        s set with all sections, never `null`.

    - #### transitiveSections

          public static Set<String> transitiveSections(Map<String,String> properties,
                                       Predicate<String> predicate)

      Return a query to evaluate the set with all fully qualified section names, containing the transitive closure also including all subarea names, regardless if properties are accessible or not. This method should return the sections as accurate as possible, but may not provide a complete set of sections that are finally accessible, especially when the underlying storage does not support key iteration.
      Parameters:
        `properties` - properties to find transitive sections in.
        `predicate` - A predicate to determine, which sections should be returned, not `null`.
      Returns:
        s set with all transitive sections, never `null`.

    - #### sectionsRecursive

          public static Map<String,String> sectionsRecursive(Map<String,String> properties,
                                             String... sectionKeys)

      Creates a ConfigOperator that creates a Configuration containing only keys that are contained in the given section (recursive). Hereby the section key is stripped away from the Map of the resulting keys.
      Parameters:
        `properties` - properties to find recursive sections in.
        `sectionKeys` - the section keys, not null
      Returns:
        the section configuration, with the areaKey stripped away.

    - #### sectionRecursive

          public static Map<String,String> sectionRecursive(Map<String,String> properties,
                                            boolean stripKeys,
                                            String... sectionKeys)

      Creates a ConfigOperator that creates a Configuration containing only keys that are contained in the given section (recursive).
      Parameters:
        `properties` - properties to find sections in.
        `sectionKeys` - the section keys, not null
        `stripKeys` - if set to true, the section key is stripped away fromMap the resulting key.
      Returns:
        the section configuration, with the areaKey stripped away.

    - #### addItems

          public static org.apache.tamaya.spi.PropertySource addItems(org.apache.tamaya.spi.PropertySource propertySource,
                                                      Map<String,String> items,
                                                      boolean override)

      Creates a ConfigOperator that adds the given items.
      Parameters:
        `propertySource` - source property source that is changed.
        `items` - the items to be added/replaced.
        `override` - if true, all items existing are overridden by the new ones passed.
      Returns:
        the ConfigOperator, never null.

    - #### addItems

          public static org.apache.tamaya.spi.PropertySource addItems(org.apache.tamaya.spi.PropertySource propertySource,
                                                      Map<String,String> items)

      Creates an operator that adds items to the instance.
      Parameters:
        `propertySource` - source property source that is changed.
        `items` - the items, not null.
      Returns:
        the operator, never null.

    - #### replaceItems

          public static org.apache.tamaya.spi.PropertySource replaceItems(org.apache.tamaya.spi.PropertySource propertySource,
                                                          Map<String,String> items)

      Creates an operator that replaces the given items.
      Parameters:
        `propertySource` - source property source that is changed.
        `items` - the items.
      Returns:
        the operator for replacing the items.

    - #### emptyPropertySource

          public static org.apache.tamaya.spi.PropertySource emptyPropertySource()

      Accesses an empty PropertySource.
      Returns:
        an empty PropertySource, never null.

    - #### findPropertySourcesByName

          public static Collection<? extends org.apache.tamaya.spi.PropertySource> findPropertySourcesByName(String expression)

      Find all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
      Parameters:
        `expression` - the regular expression to match the source's name.
      Returns:
        the list of all `PropertySource` instances matching, never null.

    - #### getPropertySources

          public static <T> Collection<T> getPropertySources(Class<T> type)

      Get a list of all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
      Type Parameters:
        `T` - the type of the property source instances requested
      Parameters:
        `type` - target type to filter for property sources.
      Returns:
        the list of all `PropertySource` instances matching, never null.

    - #### getPropertySource

          public static <T> T getPropertySource(Class<T> type)

      Get a list of all `PropertySource` instances managed by the current `ConfigurationContext` that are assignable to the given type.
      Type Parameters:
        `T` - the type of the property source instances requested
      Parameters:
        `type` - target type to filter for property sources.
      Returns:
        the list of all `PropertySource` instances matching, never null.

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.