public class MapBasedConfig extends LinkedHashMap<String,Object> implements org.eclipse.microprofile.config.Config
Config
based on a simple Map
.
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.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
protected static String |
TEST_MP_CFG_PROPERTIES |
Constructor and Description |
---|
MapBasedConfig() |
MapBasedConfig(Map<String,Object> map) |
Modifier and Type | Method and 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() |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
getOptionalValues, getValues
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
protected static final String TEST_MP_CFG_PROPERTIES
public static void cleanup()
public MapBasedConfig with(String k, Object v)
public MapBasedConfig without(String s)
public MapBasedConfig copy()
public MapBasedConfig put(String key, Object value)
public <T> T getValue(String propertyName, Class<T> propertyType)
getValue
in interface org.eclipse.microprofile.config.Config
public org.eclipse.microprofile.config.ConfigValue getConfigValue(String propertyName)
getConfigValue
in interface org.eclipse.microprofile.config.Config
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
getOptionalValue
in interface org.eclipse.microprofile.config.Config
public Iterable<String> getPropertyNames()
getPropertyNames
in interface org.eclipse.microprofile.config.Config
public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
getConfigSources
in interface org.eclipse.microprofile.config.Config
public <T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> getConverter(Class<T> forType)
getConverter
in interface org.eclipse.microprofile.config.Config
public <T> T unwrap(Class<T> type)
unwrap
in interface org.eclipse.microprofile.config.Config
public void write()
Copyright © 2018–2021 SmallRye. All rights reserved.