| Modifier and Type | Class and Description |
|---|---|
static class |
ConfigurationParameters.Milliseconds
Helper class for configuration parameters that denote a "duration", such
as a timeout or expiration time.
|
| Modifier and Type | Field and Description |
|---|---|
static ConfigurationParameters |
EMPTY
An empty configuration parameters
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
contains(String key)
Returns
true if this instance contains a configuration entry with
the specified key irrespective of the defined value; false otherwise. |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,Object>> |
entrySet() |
Object |
get(Object key) |
<T> T |
getConfigValue(String key,
T defaultValue)
Returns the value of the configuration entry with the given
key
applying the following rules:
If this instance doesn't contain a configuration entry with that
key, or if the entry is null, the specified defaultValue will be returned.
If the configured value is not null an attempt is made to convert the configured value to
match the type of the default value.
|
<T> T |
getConfigValue(String key,
T defaultValue,
Class<T> targetClass)
Returns the value of the configuration entry with the given
key
applying the following rules:
If this instance doesn't contain a configuration entry with that
key the specified defaultValue will be returned.
If defaultValue is null the original value will
be returned.
If the configured value is null this method will always
return null.
If neither defaultValue nor the configured value is
null an attempt is made to convert the configured value to
match the type of the default value.
|
boolean |
isEmpty() |
Set<String> |
keySet() |
static ConfigurationParameters |
of(ConfigurationParameters... params)
Creates a new configuration parameters instance by merging all
params sequentially. |
static ConfigurationParameters |
of(Dictionary<String,Object> properties)
Creates new a configuration parameters instance by copying the given properties.
|
static ConfigurationParameters |
of(Map<?,?> map)
Creates new a configuration parameters instance by copying the given map.
|
static ConfigurationParameters |
of(Properties properties)
Creates new a configuration parameters instance by copying the given properties.
|
static ConfigurationParameters |
of(String key,
Object value)
Creates new a single valued configuration parameters instance from the
given key and value.
|
static ConfigurationParameters |
of(String key1,
Object value1,
String key2,
Object value2)
Creates new a configuration parameters instance from the
given key and value pairs.
|
Object |
put(String key,
Object value) |
void |
putAll(Map<? extends String,?> m) |
Object |
remove(Object key) |
int |
size() |
Collection<Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllpublic static final ConfigurationParameters EMPTY
@Nonnull public static ConfigurationParameters of(@Nonnull ConfigurationParameters... params)
params sequentially.
I.e. property define in subsequent arguments overwrite the ones before.params - source parameters to mergeEMPTY if all source params were empty.@Nonnull public static ConfigurationParameters of(@Nonnull Properties properties)
properties - source propertiesEMPTY if the source properties were empty.@Nonnull public static ConfigurationParameters of(@Nonnull Dictionary<String,Object> properties)
properties - source propertiesEMPTY if the source properties were empty.@Nonnull public static ConfigurationParameters of(@Nonnull Map<?,?> map)
map - source mapEMPTY if the source map was empty.@Nonnull public static ConfigurationParameters of(@Nonnull String key, @Nonnull Object value)
key - The keyvalue - The value@Nonnull public static ConfigurationParameters of(@Nonnull String key1, @Nonnull Object value1, @Nonnull String key2, @Nonnull Object value2)
key1 - The key of the first pair.value1 - The value of the first pairkey2 - The key of the second pair.value2 - The value of the second pair.public boolean contains(@Nonnull String key)
true if this instance contains a configuration entry with
the specified key irrespective of the defined value; false otherwise.key - The key to be tested.true if this instance contains a configuration entry with
the specified key irrespective of the defined value; false otherwise.@CheckForNull public <T> T getConfigValue(@Nonnull String key, @Nullable T defaultValue, @Nullable Class<T> targetClass)
key
applying the following rules:
defaultValue will be returned.defaultValue is null the original value will
be returned.null this method will always
return null.defaultValue nor the configured value is
null an attempt is made to convert the configured value to
match the type of the default value.key - The name of the configuration option.defaultValue - The default value to return if no such entry exists
or to use for conversion.targetClass - The target classnull.@Nonnull public <T> T getConfigValue(@Nonnull String key, @Nonnull T defaultValue)
key
applying the following rules:
null, the specified defaultValue will be returned.null an attempt is made to convert the configured value to
match the type of the default value.key - The name of the configuration option.defaultValue - The default value to return if no such entry exists
or to use for conversion.null.public boolean containsKey(Object key)
containsKey in interface Map<String,Object>public boolean containsValue(Object value)
containsValue in interface Map<String,Object>@Nonnull public Collection<Object> values()
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.