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 theValueStoreinterface backed by a simpleHashMap. This class can be used to implementValueStorefunctionality 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 ValueStoreImplclone()ObjectvalueStoreGet(Object key)Retrieves a value from the value store.Set<Object>valueStoreGetAllKeys()Returns a list of all keys contained in this value store.intvalueStoreGetNumKeys()Returns the number of keys in this value store.ValueStorevalueStoreImpl()Returns the implementation to use for adding ValueStore functionality.<T> TvalueStorePut(Object key, T value)Offers a simple get/put-mechanism to store and retrieve information as a kind of global data store.ObjectvalueStoreRemove(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:
valueStorePutin interfaceValueStore- Parameters:
key- The key name.value- value to assign tokey. Mustn't be null (otherwise aNullPointerExceptionis thrown).- Returns:
- returns
value - See Also:
valueStoreGet(Object)
-
valueStoreGet
public Object valueStoreGet(Object key)
Retrieves a value from the value store.- Specified by:
valueStoreGetin 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:
valueStoreGetNumKeysin interfaceValueStore
-
valueStoreGetAllKeys
public Set<Object> valueStoreGetAllKeys()
Returns a list of all keys contained in this value store.- Specified by:
valueStoreGetAllKeysin interfaceValueStore
-
valueStoreRemove
public Object valueStoreRemove(Object key)
Removes an entry from this value store.- Specified by:
valueStoreRemovein interfaceValueStore- Returns:
- The value previously associated with "key", or null, if no such key was found.
-
valueStoreImpl
public ValueStore valueStoreImpl()
Description copied from interface:ValueStoreReturns the implementation to use for adding ValueStore functionality.- Specified by:
valueStoreImplin interfaceValueStore
-
clone
public ValueStoreImpl clone()
-
-