Class MapBasedConfig
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,Object>
-
- io.smallrye.reactive.messaging.test.common.config.MapBasedConfig
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Object>
,org.eclipse.microprofile.config.Config
public class MapBasedConfig extends LinkedHashMap<String,Object> implements org.eclipse.microprofile.config.Config
An implementation ofConfig
based on a simpleMap
. This class is just use to mock real configuration, so should only be used for tests.Note that this implementation does not do any conversion, so you must pass the expected object instances.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
TEST_MP_CFG_PROPERTIES
-
Constructor Summary
Constructors Constructor Description MapBasedConfig()
MapBasedConfig(Map<String,Object> map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
cleanup()
MapBasedConfig
copy()
Iterable<org.eclipse.microprofile.config.spi.ConfigSource>
getConfigSources()
org.eclipse.microprofile.config.ConfigValue
getConfigValue(String propertyName)
<T> Optional<org.eclipse.microprofile.config.spi.Converter<T>>
getConverter(Class<T> forType)
Map<String,Object>
getMap()
<T> Optional<T>
getOptionalValue(String propertyName, Class<T> propertyType)
Iterable<String>
getPropertyNames()
<T> T
getValue(String propertyName, Class<T> propertyType)
MapBasedConfig
put(String key, Object value)
<T> T
unwrap(Class<T> type)
MapBasedConfig
with(String k, Object v)
MapBasedConfig
without(String s)
void
write()
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.microprofile.config.Config
getOptionalValues, getValues
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Field Detail
-
TEST_MP_CFG_PROPERTIES
protected static final String TEST_MP_CFG_PROPERTIES
- See Also:
- Constant Field Values
-
-
Method Detail
-
cleanup
public static void cleanup()
-
with
public MapBasedConfig with(String k, Object v)
-
without
public MapBasedConfig without(String s)
-
copy
public MapBasedConfig copy()
-
put
public MapBasedConfig put(String key, Object value)
-
getValue
public <T> T getValue(String propertyName, Class<T> propertyType)
- Specified by:
getValue
in interfaceorg.eclipse.microprofile.config.Config
-
getConfigValue
public org.eclipse.microprofile.config.ConfigValue getConfigValue(String propertyName)
- Specified by:
getConfigValue
in interfaceorg.eclipse.microprofile.config.Config
-
getOptionalValue
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
- Specified by:
getOptionalValue
in interfaceorg.eclipse.microprofile.config.Config
-
getPropertyNames
public Iterable<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfaceorg.eclipse.microprofile.config.Config
-
getConfigSources
public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
- Specified by:
getConfigSources
in interfaceorg.eclipse.microprofile.config.Config
-
getConverter
public <T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> getConverter(Class<T> forType)
- Specified by:
getConverter
in interfaceorg.eclipse.microprofile.config.Config
-
unwrap
public <T> T unwrap(Class<T> type)
- Specified by:
unwrap
in interfaceorg.eclipse.microprofile.config.Config
-
write
public void write()
-
-