T
- the generic type of the objects to be storedpublic interface ObjectStore<T extends Serializable>
Modifier and Type | Method and Description |
---|---|
List<String> |
allKeys() |
void |
clear()
Removes all items of this store without disposing it, meaning that after performing a clear(), you should still be able
perform other operations.
|
void |
close()
Close the underlying store.
|
boolean |
contains(String key)
Check whether this store already contains a value for the given
key |
boolean |
isPersistent() |
void |
open()
Open the underlying store.
|
T |
remove(String key)
Remove the object with the given
key |
T |
retrieve(String key)
* Retrieve the object stored under the given
key |
Map<String,T> |
retrieveAll() |
void |
store(String key,
T value)
Store the given Object.
|
boolean contains(String key) throws ObjectStoreException
key
key
- the identifier of the object to checktrue
if the key is stored or false
no value was stored for the key.ObjectStoreException
- if the given key is null
.ObjectStoreNotAvailableException
- if any implementation-specific error occured, e.g. when the store is not availablevoid store(String key, T value) throws ObjectStoreException
key
- the identifier for value
value
- the Object to store with key
ObjectStoreException
- if the given key cannot be stored or is null
.ObjectStoreNotAvailableException
- if the store is not available or any other implementation-specific error occured.ObjectAlreadyExistsException
- if an attempt is made to store an object for a key that already has an object
associated.T retrieve(String key) throws ObjectStoreException
key
key
- the identifier of the object to retrieve.ObjectDoesNotExistException
.ObjectStoreException
- if the given key is null
.ObjectStoreNotAvailableException
- if the store is not available or any other implementation-specific error occured.ObjectDoesNotExistException
- if no value for the given key was previously stored.T remove(String key) throws ObjectStoreException
key
key
- the identifier of the object to remove.ObjectStoreException
- if the given key is null
or if the store is not available or any other
implementation-specific error occuredObjectDoesNotExistException
- if no value for the given key was previously stored.boolean isPersistent()
this
store is persistent or notvoid clear() throws ObjectStoreException
ObjectStoreException
- if the operation failsvoid open() throws ObjectStoreException
ObjectStoreException
- if an exception occurred while opening the underlying store.void close() throws ObjectStoreException
ObjectStoreException
- if an exception occurred while closing the underlying store.List<String> allKeys() throws ObjectStoreException
ObjectStoreException
- if an exception occurred while collecting the list of all keys.Map<String,T> retrieveAll() throws ObjectStoreException
ObjectStoreException
- if an exception occurred while collecting the valuesCopyright © 2018. All rights reserved.