public class KVStore extends HashMap<String,ValueObject> implements KV
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
KVStore()
Create an empty
KVStore |
KVStore(KVStore copy)
Create a
KVStore by coping another KVStore |
KVStore(Map<String,Object> values)
Create a
KVStore with a (String, Object) map |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getValue(String key)
Get
value object value by key from the store. |
KVStore |
putValue(String key,
Object val)
Put a simple data into the store with a key.
|
KVStore |
putValues(Map<String,Object> kvMap)
Put a map of (key, value) pair into the store.
|
Map<String,Object> |
toMap()
Returns a
Map contains (key, value) pairs that stored in this KVStore. |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic KVStore()
Create an empty KVStore
public KVStore(KVStore copy)
Create a KVStore by coping another KVStore
copy - the KVStore in which all (K,V) pairs will be copied into the new KVStore instancepublic KVStore putValue(String key, Object val)
Put a simple data into the store with a key. The type of simple data should be allowed by ValueObject
putValue in interface KVkey - the keyval - the valueValueObjectpublic <T> T getValue(String key)
Get value object value by key from the store.
getValue in interface KVT - the generic type of the return valuekey - the keyValueObject.value()public KVStore putValues(Map<String,Object> kvMap)
Put a map of (key, value) pair into the store. The value could be any type that supported by ValueObject
public Map<String,Object> toMap()
Returns a Map contains (key, value) pairs that stored in this KVStore. The value in the pair should be the ValueObject.value() stored in the ValueObject in this KVStore
Copyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.