public final class PropertySourceChangeBuilder 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 |
---|---|
PropertySourceChangeBuilder |
addChanges(org.apache.tamaya.spi.PropertySource newState)
This method records all changes to be applied to the base property provider/configuration to
achieve the given target state.
|
PropertySourceChange |
build()
Builds the corresponding change set.
|
static Collection<PropertyChangeEvent> |
compare(org.apache.tamaya.spi.PropertySource map1,
org.apache.tamaya.spi.PropertySource map2)
Compares the two property config/configurations and creates a collection current all changes
that must be appied to render
map1 into map2 . |
PropertySourceChangeBuilder |
deleteAll()
This method will create a change set that clears all entries fromMap the given base configuration/properties.
|
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 PropertySourceChangeBuilder |
of(org.apache.tamaya.spi.PropertySource source,
ChangeType changeType)
Creates a new instance of this builder.
|
PropertySourceChangeBuilder |
putAll(Map<String,String> changes)
Apply all the given values to the base configuration/properties.
|
PropertySourceChangeBuilder |
remove(String key,
String... otherKeys)
Marks the given key(s) fromMap the configuration/properties to be removed.
|
void |
reset()
Resets this change set instance.
|
PropertySourceChangeBuilder |
setChangeType(ChangeType changeType) |
PropertySourceChangeBuilder |
setTimestamp(long timestamp) |
PropertySourceChangeBuilder |
setVersion(String version) |
String |
toString() |
public static PropertySourceChangeBuilder of(org.apache.tamaya.spi.PropertySource source, ChangeType changeType)
source
- the underlying property provider/configuration, not null.changeType
- kind of change.public static Collection<PropertyChangeEvent> compare(org.apache.tamaya.spi.PropertySource map1, org.apache.tamaya.spi.PropertySource map2)
map1
into map2
.map1
- the source map, not null.map2
- the target map, not null.public PropertySourceChangeBuilder setVersion(String version)
public PropertySourceChangeBuilder setTimestamp(long timestamp)
public PropertySourceChangeBuilder addChanges(org.apache.tamaya.spi.PropertySource newState)
newState
- the new target state, not null.public String get(String key)
key
- the key current the entry, not null.public PropertySourceChangeBuilder remove(String key, String... otherKeys)
key
- the key current the entry, not null.otherKeys
- additional keys to be removed (convenience), not null.public PropertySourceChangeBuilder putAll(Map<String,String> changes)
changes
- the changes to be applied, not null.public PropertySourceChangeBuilder deleteAll()
public boolean isEmpty()
public void reset()
public PropertySourceChangeBuilder setChangeType(ChangeType changeType)
public PropertySourceChange build()
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.