public abstract class TemplateObjectStore<T extends Serializable> extends AbstractObjectStoreSupport<T>
ObjectStore implementations so that it's easier to conform to the contract.
ObjectStore implementations are not required to extend this class, but it is recommended to do so
in order to help guaranteeing that implementations implement the contract correctly.
| Constructor and Description |
|---|
TemplateObjectStore() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(String key)
Check whether this store already contains a value for the given
key |
protected abstract boolean |
doContains(String key)
Template method for
contains(String). |
protected abstract T |
doRemove(String key)
Template method for
remove(String) (String, Serializable)}. |
protected abstract T |
doRetrieve(String key)
Template method for
store(String, Serializable). |
protected abstract void |
doStore(String key,
T value)
Template method for
store(String, Serializable). |
T |
remove(String key)
Remove the object with the given
key |
T |
retrieve(String key)
* Retrieve the object stored under the given
key |
void |
store(String key,
T value)
Store the given Object.
|
validateKey, validatePresentKeyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallKeys, clear, close, isPersistent, openpublic boolean contains(String key) throws ObjectStoreException
keykey - 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 availableprotected abstract boolean doContains(String key) throws ObjectStoreException
contains(String). Implement this method assuming that
the key is already valid
ObjectStoreExceptionpublic void store(String key, T value) throws ObjectStoreException
key - the identifier for valuevalue - the Object to store with keyObjectStoreException - 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.protected abstract void doStore(String key, T value) throws ObjectStoreException
store(String, Serializable). Implement this method assuming that the key is valid
and that contains(String) has already been invoked to verify that the key doesn't already exists
in this store.
ObjectStoreExceptionpublic T retrieve(String key) throws ObjectStoreException
keykey - 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.protected abstract T doRetrieve(String key) throws ObjectStoreException
store(String, Serializable). Implement this method assuming that the key is valid
and that contains(String) has already been invoked to verify that the key actually exists in this store.
ObjectStoreExceptionpublic T remove(String key) throws ObjectStoreException
keykey - 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.protected abstract T doRemove(String key) throws ObjectStoreException
remove(String) (String, Serializable)}. Implement this method assuming that the key is valid
and that contains(String) has already been invoked to verify that the key actually exists in this store.
ObjectStoreExceptionCopyright © 2017 MuleSoft, Inc.. All rights reserved.