public class MemoryDataStore<K,E> extends Object implements DataStore<K,E>
map by mapping entity keys to entities.| Constructor and Description |
|---|
MemoryDataStore(Class<E> entityType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete(K key)
Deletes the entity identifiable with the provided key, or does nothing if no such entity
exists.
|
Class<E> |
getEntityType() |
boolean |
hasKey(K key)
Determines whether or not an entity with the given key exists in the data store.
|
Collection<K> |
keys() |
E |
retrieve(K key)
Given a key, retrieves the entity associated with that key in the data store.
|
Collection<E> |
retrieveAll() |
boolean |
save(K key,
E entity)
Saves the given entity into the data store under the provided key.
|
void |
truncate()
Does a hard remove of all the entities in the data store
|
public boolean hasKey(K key)
DataStorepublic boolean save(K key, E entity)
DataStoreDataStore.hasKey(Object) should
yield true and the very same entity (or an equal value entity) can be retrieved by
calling DataStore.retrieve(Object).public boolean delete(K key)
DataStoreDataStore.hasKey(Object) should return false and DataStore.retrieve(Object) should return
null for the same key.public E retrieve(K key)
DataStorepublic Collection<K> keys()
public Collection<E> retrieveAll()
retrieveAll in interface DataStore<K,E>public Class<E> getEntityType()
getEntityType in interface DataStore<K,E>Copyright © 2014–2021. All rights reserved.