Package com.avanza.astrix.config
Class MapConfigSource
- java.lang.Object
-
- com.avanza.astrix.config.AbstractDynamicConfigSource
-
- com.avanza.astrix.config.MapConfigSource
-
- All Implemented Interfaces:
ConfigSource,DynamicConfigSource,MutableConfigSource
public class MapConfigSource extends AbstractDynamicConfigSource implements MutableConfigSource
Map backedDynamicConfigSourceuseful in testing.- Author:
- Elias Lindholm (elilin)
-
-
Constructor Summary
Constructors Constructor Description MapConfigSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget(String propertyName, DynamicPropertyListener<String> propertyChangeListener)Returns a configuration property from this configuration source.static MapConfigSourceof(String key, Object value)static MapConfigSourceof(String key1, Object value1, String key2, Object value2)static MapConfigSourceof(String key1, Object value1, String key2, Object value2, String key3, Object value3)static MapConfigSourceof(Map<String,?> source)voidset(BooleanSetting setting, boolean value)<T extends Enum<T>>
voidset(EnumSetting<T> setting, T value)voidset(IntSetting setting, int value)voidset(LongSetting setting, long value)<T> voidset(Setting<T> setting, T value)voidset(String propertyName, String value)voidsetAll(MapConfigSource config)StringtoString()-
Methods inherited from class com.avanza.astrix.config.AbstractDynamicConfigSource
get
-
-
-
-
Method Detail
-
of
public static MapConfigSource of(Map<String,?> source)
-
of
public static MapConfigSource of(String key, Object value)
-
of
public static MapConfigSource of(String key1, Object value1, String key2, Object value2)
-
of
public static MapConfigSource of(String key1, Object value1, String key2, Object value2, String key3, Object value3)
-
get
public String get(String propertyName, DynamicPropertyListener<String> propertyChangeListener)
Description copied from interface:DynamicConfigSourceReturns a configuration property from this configuration source. TheDynamicPropertyListenerwill be updated about all changes to the underlying property.- Specified by:
getin interfaceDynamicConfigSourcepropertyChangeListener- - A listener that receives callback for each change in the underlying property value.- Returns:
- The current value of the given property, or null if no value exists right now
-
set
public <T> void set(Setting<T> setting, T value)
- Specified by:
setin interfaceMutableConfigSource
-
set
public void set(IntSetting setting, int value)
- Specified by:
setin interfaceMutableConfigSource
-
set
public void set(LongSetting setting, long value)
- Specified by:
setin interfaceMutableConfigSource
-
set
public void set(BooleanSetting setting, boolean value)
- Specified by:
setin interfaceMutableConfigSource
-
set
public <T extends Enum<T>> void set(EnumSetting<T> setting, T value)
- Specified by:
setin interfaceMutableConfigSource
-
setAll
public void setAll(MapConfigSource config)
-
-