public interface StorageBackend
WARNING: this interface is in an extreme state of flux. It is guaranteed to change as the first few alternative implementations are developed.
Modifier and Type | Method and Description |
---|---|
<X,Y> boolean |
contains(Key<X,Y> key)
Tests if this backend contains data for the given key.
|
<X> X |
get(Key<X,?> key)
Retrieves the value most recently stored in this backend under the given
key, reconnecting referenced objects by calling back up into the owning
EntityManager.
|
<X> List<X> |
getAll(ErraiIdentifiableType<X> type,
EntityJsonMatcher matcher)
Returns all entities of the given type (and its subtypes) whose JSON
representations are accepted by the given matcher.
|
<X> boolean |
isModified(Key<X,?> key,
X value)
Checks if the value currently associated with
key in this backend
datastore is identical to the given one. |
<X> void |
put(Key<X,?> key,
X value)
Stores the given Errai-Marshalling-Capable value under the given key.
|
<X> void |
remove(Key<X,?> key)
Removes the key and its associated value (if any) from this storage
backend.
|
void |
removeAll()
Removes all data from this storage backend.
|
<X> void put(Key<X,?> key, X value)
X
- The entity's Java typekey
- The identity of the entry in the storage backend. Null is not
permitted.value
- The value to store. Must be marshallable using Errai Marshalling.
Null is not permitted; use remove(Key)
to remove an
entity from this data store.<X> X get(Key<X,?> key)
Note that this operation is not a good method for testing if the
backend contains a given object, because of the potentially wide-reaching
side effects caused by recursively resolving the entity references in the
object being retrieved. To test if the backend contains an object for a
particular key, use contains(Key)
.
X
- The entity's Java typekey
- The identity of the object to be retrieved. The actual entity
returned may be a subtype of the type specified in the key. Null
is not permitted.key
.<X> List<X> getAll(ErraiIdentifiableType<X> type, EntityJsonMatcher matcher)
type
- The type of entities to retrievematcher
- The matcher that decides which entity instances will be retrieved.<X,Y> boolean contains(Key<X,Y> key)
get(Key)
, subtypes are taken into account. If this backend
contains an entity with the same ID as the given key and the same type or a
subtype of the type specified in the key, this method will return true.key
- The identity of the object to be tested for. Null is not
permitted.<X> void remove(Key<X,?> key)
X
- The entity's Java typekey
- The identity of the object to be removed. Null is not permitted.<X> boolean isModified(Key<X,?> key, X value)
key
in this backend
datastore is identical to the given one. For the purposes of this method,
two values are considered identical if their serialized representation is
the same. This method does not check for equality using the
equals()
method of value
.X
- The entity's Java typekey
- The identity of the object to be removed. Null is not permitted.value
- The value to check. Must be marshallable using Errai Marshalling.void removeAll()
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.