public interface KeyValue
KeyValue class represents a persistent set of attributes,
which supports method chaining.
A KeyValue object only allows String keys and can contain four primitive type
as values: int, long, double, String.
The KeyValue is a replacement of Properties, with simpler
interfaces and reasonable entry limits.
A KeyValue object may be used in concurrent scenarios, so the implementation
of KeyValue should consider concurrent related issues.
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key)
Tests if the specified
String is a key in this KeyValue. |
double |
getDouble(String key)
Searches for the
double property with the specified key in this KeyValue object. |
double |
getDouble(String key,
double defaultValue)
Searches for the
double property with the specified key in this KeyValue object. |
int |
getInt(String key)
Searches for the
int property with the specified key in this KeyValue object. |
int |
getInt(String key,
int defaultValue)
Searches for the
int property with the specified key in this KeyValue object. |
long |
getLong(String key)
Searches for the
long property with the specified key in this KeyValue object. |
long |
getLong(String key,
long defaultValue)
Searches for the
long property with the specified key in this KeyValue object. |
String |
getString(String key)
Searches for the
String property with the specified key in this KeyValue object. |
String |
getString(String key,
String defaultValue)
Searches for the
String property with the specified key in this KeyValue object. |
Set<String> |
keySet()
Returns a
Set view of the keys contained in this KeyValue object. |
KeyValue |
put(String key,
double value)
Inserts or replaces
double value for the specified key. |
KeyValue |
put(String key,
int value)
Inserts or replaces
int value for the specified key. |
KeyValue |
put(String key,
long value)
Inserts or replaces
long value for the specified key. |
KeyValue |
put(String key,
String value)
Inserts or replaces
String value for the specified key. |
KeyValue put(String key, int value)
int value for the specified key.key - the key to be placed into this KeyValue objectvalue - the value corresponding to keyKeyValue put(String key, long value)
long value for the specified key.key - the key to be placed into this KeyValue objectvalue - the value corresponding to keyKeyValue put(String key, double value)
double value for the specified key.key - the key to be placed into this KeyValue objectvalue - the value corresponding to keyKeyValue put(String key, String value)
String value for the specified key.key - the key to be placed into this KeyValue objectvalue - the value corresponding to keyint getInt(String key)
int property with the specified key in this KeyValue object.
If the key is not found in this property list, zero is returned.key - the property keyKeyValue object with the specified key valueput(String, int)int getInt(String key, int defaultValue)
int property with the specified key in this KeyValue object.
If the key is not found in this property list, the default value argument is returned.key - the property keydefaultValue - a default valueKeyValue object with the specified key valueput(String, int)long getLong(String key)
long property with the specified key in this KeyValue object.
If the key is not found in this property list, zero is returned.key - the property keyKeyValue object with the specified key valueput(String, long)long getLong(String key, long defaultValue)
long property with the specified key in this KeyValue object.
If the key is not found in this property list, the default value argument is returned.key - the property keydefaultValue - a default valueKeyValue object with the specified key valueput(String, long)double getDouble(String key)
double property with the specified key in this KeyValue object.
If the key is not found in this property list, zero is returned.key - the property keyKeyValue object with the specified key valueput(String, double)double getDouble(String key, double defaultValue)
double property with the specified key in this KeyValue object.
If the key is not found in this property list, the default value argument is returned.key - the property keydefaultValue - a default valueKeyValue object with the specified key valueput(String, double)String getString(String key)
String property with the specified key in this KeyValue object.
If the key is not found in this property list, null is returned.key - the property keyKeyValue object with the specified key valueput(String, String)String getString(String key, String defaultValue)
String property with the specified key in this KeyValue object.
If the key is not found in this property list, the default value argument is returned.key - the property keydefaultValue - a default valueKeyValue object with the specified key valueput(String, String)Set<String> keySet()
Set view of the keys contained in this KeyValue object.
The set is backed by the KeyValue, so changes to the set are
reflected in the @code KeyValue}, and vice-versa.
KeyValue object.boolean containsKey(String key)
String is a key in this KeyValue.key - possible keytrue if and only if the specified key is in this KeyValue, false
otherwise.Copyright © 2017–2018 OpenMessaging. All rights reserved.