org.apache.tamaya.event

## Class PropertyChangeSetBuilder

- java.lang.Object
- - org.apache.tamaya.event.PropertyChangeSetBuilder

-     public final class PropertyChangeSetBuilder
      extends Object

  Models a set current changes to be applied to a configuration/property provider. Such a set can be applied to any `PropertySource` instance. If the provider is mutable it may check the version given and applyChanges the changes to the provider/configuration, including triggering current regarding change events.

  For appropriate conversion a `Function<String, Codec>` can be applied, which performs correct conversion, when changed values are set. This function enables connecting e.g. setters on a configuration template with the corresponding conversion logic, so the template calls are correctly converted back.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PropertyChangeSetBuilder` | `add(String... keys)` Marks the given key(s) as added.
    `PropertyChangeSetBuilder` | `addChanges(Map<String,String> map1, Map<String,String> map2)` Compares the two property maps and adds the corresponding updated/aded/removed keys to the builder.
    `PropertyChangeSet` | `build()` Builds s new change set.
    `static PropertyChangeSetBuilder` | `of(PropertySource source)` Creates a new instance current this builder.
    `PropertyChangeSetBuilder` | `remove(String... keys)` Marks the given key(s) as removed.
    `String` | `toString()`
    `PropertyChangeSetBuilder` | `update(String... keys)` Marks the given key(s) as updaed.

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

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

- - ### Method Detail

    - #### of

          public static PropertyChangeSetBuilder of(PropertySource source)

      Creates a new instance current this builder.
      Parameters:
        `source` - the underlying property provider/configuration, not null.
      Returns:
        the builder for chaining.

    - #### remove

          public PropertyChangeSetBuilder remove(String... keys)

      Marks the given key(s) as removed.
      Parameters:
        `keys` - the keys removed
      Returns:
        the builder for chaining.

    - #### add

          public PropertyChangeSetBuilder add(String... keys)

      Marks the given key(s) as added.
      Parameters:
        `keys` - the keys added
      Returns:
        the builder for chaining.

    - #### update

          public PropertyChangeSetBuilder update(String... keys)

      Marks the given key(s) as updaed.
      Parameters:
        `keys` - the keys updated
      Returns:
        the builder for chaining.

    - #### addChanges

          public PropertyChangeSetBuilder addChanges(Map<String,String> map1,
                                                     Map<String,String> map2)

      Compares the two property maps and adds the corresponding updated/aded/removed keys to the builder.
      Parameters:
        `map1` - the source map, not null.
        `map2` - the target map, not null.
      Returns:
        the builder for chaining.

    - #### build

          public PropertyChangeSet build()

      Builds s new change set.
      Returns:
        a new change set, never null.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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