public final class ConfigurationParameters
extends java.lang.Object
implements java.util.Map<java.lang.String,java.lang.Object>
Map interface but is immutable.| 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(java.lang.String key)
Returns
true if this instance contains a configuration entry with
the specified key irrespective of the defined value; false otherwise. |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
java.lang.Object |
get(java.lang.Object key) |
<T> T |
getConfigValue(java.lang.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(java.lang.String key,
T defaultValue,
java.lang.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() |
java.util.Set<java.lang.String> |
keySet() |
static ConfigurationParameters |
of(ConfigurationParameters... params)
Creates a new configuration parameters instance by merging all
params sequentially. |
static ConfigurationParameters |
of(java.util.Dictionary<java.lang.String,java.lang.Object> properties)
Creates new a configuration parameters instance by copying the given properties.
|
static ConfigurationParameters |
of(java.util.Map<?,?> map)
Creates new a configuration parameters instance by copying the given map.
|
static ConfigurationParameters |
of(java.util.Properties properties)
Creates new a configuration parameters instance by copying the given properties.
|
static ConfigurationParameters |
of(java.lang.String key,
java.lang.Object value)
Creates new a single valued configuration parameters instance from the
given key and value.
|
static ConfigurationParameters |
of(java.lang.String key1,
java.lang.Object value1,
java.lang.String key2,
java.lang.Object value2)
Creates new a configuration parameters instance from the
given key and value pairs.
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,?> m) |
java.lang.Object |
remove(java.lang.Object key) |
int |
size() |
java.util.Collection<java.lang.Object> |
values() |
public static final ConfigurationParameters EMPTY
public static ConfigurationParameters of(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.public static ConfigurationParameters of(java.util.Properties properties)
properties - source propertiesEMPTY if the source properties were empty.public static ConfigurationParameters of(java.util.Dictionary<java.lang.String,java.lang.Object> properties)
properties - source propertiesEMPTY if the source properties were empty.public static ConfigurationParameters of(java.util.Map<?,?> map)
map - source mapEMPTY if the source map was empty.public static ConfigurationParameters of(java.lang.String key, java.lang.Object value)
key - The keyvalue - The valuepublic static ConfigurationParameters of(java.lang.String key1, java.lang.Object value1, java.lang.String key2, java.lang.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(java.lang.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.public <T> T getConfigValue(java.lang.String key,
T defaultValue,
java.lang.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.public <T> T getConfigValue(java.lang.String key,
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 int size()
size in interface java.util.Map<java.lang.String,java.lang.Object>public boolean isEmpty()
isEmpty in interface java.util.Map<java.lang.String,java.lang.Object>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<java.lang.String,java.lang.Object>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<java.lang.String,java.lang.Object>public java.lang.Object get(java.lang.Object key)
get in interface java.util.Map<java.lang.String,java.lang.Object>public java.lang.Object put(java.lang.String key,
java.lang.Object value)
put in interface java.util.Map<java.lang.String,java.lang.Object>public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.String,java.lang.Object>public void putAll(java.util.Map<? extends java.lang.String,?> m)
putAll in interface java.util.Map<java.lang.String,java.lang.Object>public void clear()
clear in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Set<java.lang.String> keySet()
keySet in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Collection<java.lang.Object> values()
values in interface java.util.Map<java.lang.String,java.lang.Object>public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet in interface java.util.Map<java.lang.String,java.lang.Object>"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"