public final class ConfigurationChangeBuilder extends Object
PropertySource. Consumers of these events
can observing changes to property sources and
ConfigurationContext
contains the changed PropertySource (Note: the reference tova property source is never affected by a
change, its only the data of the property source).Configuration to create a change
event on configuration level.
| Modifier and Type | Method and Description |
|---|---|
ConfigurationChangeBuilder |
addChange(String key,
String value)
Applies a single key/value change.
|
ConfigurationChangeBuilder |
addChanges(org.apache.tamaya.Configuration newState)
This method records all changes to be applied to the base property provider/configuration to
achieve the given target state.
|
ConfigurationChange |
build()
Builds the corresponding change set.
|
static Collection<PropertyChangeEvent> |
compare(org.apache.tamaya.Configuration map1,
org.apache.tamaya.Configuration map2)
Compares the two property config/configurations and creates a collection current all changes
that must be appied to render
map1 into map2. |
String |
get(String key)
Get the current values, also considering any changes recorded within this change set.
|
boolean |
isEmpty()
Checks if the change set is empty, i.e. does not contain any changes.
|
static ConfigurationChangeBuilder |
of()
Creates a new instance current this builder using the current COnfiguration as root resource.
|
static ConfigurationChangeBuilder |
of(org.apache.tamaya.Configuration configuration)
Creates a new instance current this builder.
|
ConfigurationChangeBuilder |
putAll(Map<String,String> changes)
Apply all the given values to the base configuration/properties.
|
ConfigurationChangeBuilder |
removeAllKeys()
This method will create a change set that clears all entries fromMap the given base configuration/properties.
|
ConfigurationChangeBuilder |
removeKey(String key,
String... otherKeys)
Marks the given key(s) fromMap the configuration/properties to be removed.
|
void |
reset()
Resets this change set instance.
|
ConfigurationChangeBuilder |
setTimestamp(long timestamp) |
ConfigurationChangeBuilder |
setVersion(String version) |
String |
toString() |
public static ConfigurationChangeBuilder of()
public static ConfigurationChangeBuilder of(org.apache.tamaya.Configuration configuration)
configuration - the configuration changed, not null.public static Collection<PropertyChangeEvent> compare(org.apache.tamaya.Configuration map1, org.apache.tamaya.Configuration map2)
map1 into map2.map1 - the source map, not null.map2 - the target map, not null.public ConfigurationChangeBuilder setVersion(String version)
public ConfigurationChangeBuilder setTimestamp(long timestamp)
public ConfigurationChangeBuilder addChanges(org.apache.tamaya.Configuration newState)
newState - the new target state, not null.public ConfigurationChangeBuilder addChange(String key, String value)
key - the changed keyvalue - the new value.public String get(String key)
key - the key current the entry, not null.public ConfigurationChangeBuilder removeKey(String key, String... otherKeys)
key - the key current the entry, not null.otherKeys - additional keys to be removed (convenience), not null.public ConfigurationChangeBuilder putAll(Map<String,String> changes)
changes - the changes to be applied, not null.public ConfigurationChangeBuilder removeAllKeys()
public boolean isEmpty()
public void reset()
public ConfigurationChange build()
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.