Package jasima.core.util
Class ValueStoreImpl
- java.lang.Object
-
- jasima.core.util.ValueStoreImpl
-
- All Implemented Interfaces:
ValueStore
,Cloneable
public class ValueStoreImpl extends Object implements ValueStore, Cloneable
Implementation of theValueStore
interface backed by a simpleHashMap
. This class can be used to implementValueStore
functionality on behalf of a host object.
-
-
Constructor Summary
Constructors Constructor Description ValueStoreImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueStoreImpl
clone()
Object
valueStoreGet(Object key)
Retrieves a value from the value store.Set<Object>
valueStoreGetAllKeys()
Returns a list of all keys contained in this value store.int
valueStoreGetNumKeys()
Returns the number of keys in this value store.ValueStore
valueStoreImpl()
Returns the implementation to use for adding ValueStore functionality.<T> T
valueStorePut(Object key, T value)
Offers a simple get/put-mechanism to store and retrieve information as a kind of global data store.Object
valueStoreRemove(Object key)
Removes an entry from this value store.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jasima.core.util.ValueStore
valueStoreContains, valueStoreGet, valueStoreUpdate
-
-
-
-
Method Detail
-
valueStorePut
public <T> T valueStorePut(Object key, T value)
Offers a simple get/put-mechanism to store and retrieve information as a kind of global data store. This can be used as a simple extension mechanism.- Specified by:
valueStorePut
in interfaceValueStore
- Parameters:
key
- The key name.value
- value to assign tokey
. Mustn't be null (otherwise aNullPointerException
is thrown).- Returns:
- returns
value
- See Also:
valueStoreGet(Object)
-
valueStoreGet
public Object valueStoreGet(Object key)
Retrieves a value from the value store.- Specified by:
valueStoreGet
in interfaceValueStore
- Parameters:
key
- The entry to return, e.g., identified by a name.- Returns:
- The value associated with
key
. - See Also:
valueStorePut(Object, Object)
-
valueStoreGetNumKeys
public int valueStoreGetNumKeys()
Returns the number of keys in this value store.- Specified by:
valueStoreGetNumKeys
in interfaceValueStore
-
valueStoreGetAllKeys
public Set<Object> valueStoreGetAllKeys()
Returns a list of all keys contained in this value store.- Specified by:
valueStoreGetAllKeys
in interfaceValueStore
-
valueStoreRemove
public Object valueStoreRemove(Object key)
Removes an entry from this value store.- Specified by:
valueStoreRemove
in interfaceValueStore
- Returns:
- The value previously associated with "key", or null, if no such key was found.
-
valueStoreImpl
public ValueStore valueStoreImpl()
Description copied from interface:ValueStore
Returns the implementation to use for adding ValueStore functionality.- Specified by:
valueStoreImpl
in interfaceValueStore
-
clone
public ValueStoreImpl clone()
-
-