org.apache.tamaya.format

## Class ConfigurationDataBuilder

- java.lang.Object
- - org.apache.tamaya.format.ConfigurationDataBuilder

-     public final class ConfigurationDataBuilder
      extends Object

  Builder for creating `ConfigurationData` instances. This class is not thread-safe.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ConfigurationDataBuilder` | `addProperties(Map<String,String> properties)` Adds the given entries to the default section, all existing values will be overridden.
    `ConfigurationDataBuilder` | `addProperty(String key, String value)` Adds a single entry to the default section.
    `ConfigurationDataBuilder` | `addSectionProperties(String section, Map<String,String> properties)` Adds the given entries to the given section, all existing values will be overridden.
    `ConfigurationDataBuilder` | `addSectionProperty(String section, String key, String value)` Adds a single entry to a target section.
    `ConfigurationDataBuilder` | `addSections(String... sections)` Adds (empty) sections,if they are not yet existing.
    `ConfigurationData` | `build()` Builds a new `ConfigurationData` instance.
    `Map<String,String>` | `getCombinedProperties()` Access the current combined properties, if not present a new instance is initialized.
    `Map<String,String>` | `getDefaultProperties()` Access the current default section, if not present a new instance is initialized.
    `Map<String,Map<String,String>>` | `getSections()` Access the current named sections, if not present a new instance is initialized.
    `static ConfigurationDataBuilder` | `of(ConfigurationData data)` Creates a new instance.
    `static ConfigurationDataBuilder` | `of(String resource, ConfigurationFormat format)` Creates a new instance.
    `ConfigurationDataBuilder` | `setCombinedProperties(Map<String,String> properties)` Sets the given entries as the combined properties map, all existing properties of the combined map will be overridden.
    `String` | `toString()`

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

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

- - ### Method Detail

    - #### of

          public static ConfigurationDataBuilder of(String resource,
                                                    ConfigurationFormat format)

      Creates a new instance.
      Parameters:
        `resource` - the configuration resource URL, not null.
        `format` - the format that read this data, not null.

    - #### of

          public static ConfigurationDataBuilder of(ConfigurationData data)

      Creates a new instance.
      Parameters:
        `data` - an existing COnfigurationData instances used to initialize the builder.

    - #### addSections

          public ConfigurationDataBuilder addSections(String... sections)

      Adds (empty) sections,if they are not yet existing. Already existing sections will not be touched.
      Parameters:
        `sections` - the new sections to put.
      Returns:
        the builder for chaining.

    - #### addSectionProperty

          public ConfigurationDataBuilder addSectionProperty(String section,
                                                             String key,
                                                             String value)

      Adds a single entry to a target section.
      Parameters:
        `section` - the target section (will be created if not existing).
        `key` - the entry's key
        `value` - the entry's value
      Returns:
        the builder for chaining.

    - #### addProperty

          public ConfigurationDataBuilder addProperty(String key,
                                                      String value)

      Adds a single entry to the default section.
      Parameters:
        `key` - the entry's key
        `value` - the entry's value
      Returns:
        the builder for chaining.

    - #### addSectionProperties

          public ConfigurationDataBuilder addSectionProperties(String section,
                                                               Map<String,String> properties)

      Adds the given entries to the given section, all existing values will be overridden.
      Parameters:
        `section` - the target section (will be created if not existing).
        `properties` - the entry's data
      Returns:
        the builder for chaining.

    - #### addProperties

          public ConfigurationDataBuilder addProperties(Map<String,String> properties)

      Adds the given entries to the default section, all existing values will be overridden.
      Parameters:
        `properties` - the entry's data
      Returns:
        the builder for chaining.

    - #### setCombinedProperties

          public ConfigurationDataBuilder setCombinedProperties(Map<String,String> properties)

      Sets the given entries as the combined properties map, all existing properties of the combined map will be overridden.
      Parameters:
        `properties` - the entry's data
      Returns:
        the builder for chaining.

    - #### getDefaultProperties

          public Map<String,String> getDefaultProperties()

      Access the current default section, if not present a new instance is initialized.
      Returns:
        the current default section, never null.

    - #### getCombinedProperties

          public Map<String,String> getCombinedProperties()

      Access the current combined properties, if not present a new instance is initialized.
      Returns:
        the current combined properties, never null.

    - #### getSections

          public Map<String,Map<String,String>> getSections()

      Access the current named sections, if not present a new instance is initialized.
      Returns:
        the current named sections, never null.

    - #### build

          public ConfigurationData build()

      Builds a new `ConfigurationData` instance.
      Returns:
        a new `ConfigurationData` instance, not null.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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