public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bindings
A concurrently accessible parameter map which holds both keys and values as strings. An atomic change counter tracks updates, to allow interested consumers to determine when to re-read values across threads. The basic format is <paramname>=<paramvalue>;...
To create a parameter map, use one of the static parse... methods.
No non-String types are used internally. Everything is encoded as a String, even though the generic type is parameterized for Bindings support.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ParameterMap.Listener |
ConcurrentHashMap.KeySetView<K,V>AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
ParameterMap(Map<String,String> valueMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ParameterMap.Listener listener) |
void |
clear() |
Set<Map.Entry<String,Object>> |
entrySet() |
Object |
get(Object key) |
boolean |
getBoolOrDefault(String paramName,
boolean defaultBoolValue) |
AtomicLong |
getChangeCounter()
Get the atomic change counter for this parameter map.
|
double |
getDoubleOrDefault(String paramName,
double defaultDoubleValue) |
int |
getIntOrDefault(String paramName,
int defaultIntValue) |
long |
getLongOrDefault(String paramName,
long defaultLongValue) |
Optional<Boolean> |
getOptionalBoolean(String paramName) |
Optional<Double> |
getOptionalDouble(String paramName) |
Optional<Long> |
getOptionalLong(String paramName) |
Optional<String> |
getOptionalString(String paramName) |
int |
getSize() |
String |
getStringOrDefault(String paramName,
String defaultStringValue) |
Map<String,String> |
getStringStringMap() |
static ParameterMap |
parseOrException(String encodedParams) |
static Optional<ParameterMap> |
parseParams(String encodedParams) |
static ParameterMap |
parsePositional(String encodedParams,
String[] defaultFieldNames)
Parse positional parameters, each suffixed with the ';' terminator.
|
Object |
put(String name,
Object value) |
void |
putAll(Map<? extends String,? extends Object> toMerge) |
Object |
remove(Object key) |
void |
removeListener(ParameterMap.Listener listener) |
void |
set(String paramName,
Object newValue) |
boolean |
takeBoolOrDefault(String paramName,
boolean defaultBoolValue) |
Double |
takeDoubleOrDefault(String paramName,
double defaultDoubleValue) |
int |
takeIntOrDefault(String paramName,
int paramDefault) |
Long |
takeLongOrDefault(String paramName,
Long defaultLongValue) |
String |
takeStringOrDefault(String paramName,
String defaultStringValue) |
String |
toString() |
compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, valuesclonefinalize, getClass, notify, notifyAll, wait, wait, waitcontainsKeycompute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, valuespublic long getLongOrDefault(String paramName, long defaultLongValue)
public double getDoubleOrDefault(String paramName, double defaultDoubleValue)
public int getIntOrDefault(String paramName, int defaultIntValue)
public boolean getBoolOrDefault(String paramName, boolean defaultBoolValue)
public int takeIntOrDefault(String paramName, int paramDefault)
public boolean takeBoolOrDefault(String paramName, boolean defaultBoolValue)
public void clear()
public AtomicLong getChangeCounter()
public String toString()
toString in class ConcurrentHashMap<String,Object>public void addListener(ParameterMap.Listener listener)
public void removeListener(ParameterMap.Listener listener)
public int getSize()
public static ParameterMap parseOrException(String encodedParams)
public static Optional<ParameterMap> parseParams(String encodedParams)
public static ParameterMap parsePositional(String encodedParams, String[] defaultFieldNames)
encodedParams - parameter stringdefaultFieldNames - the well-known field orderingCopyright © 2016. All rights reserved.