|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.errai.jpa.client.local.backend.WebStorageBackend
public class WebStorageBackend
The storage backend for HTML WebStorage, a storage facility supported by most browsers for at least 2.5 million characters of data, (5 megabytes of Unicode text).
This backend supports namespacing, which is a way of dividing up the storage into any number of non-overlapping buckets. For any two namespaces A and B (A != B), the storage backend for namespace A will never see, modify, or otherwise or interfere with anything stored in the storage backend for namespace B.
Field Summary | |
---|---|
static StorageBackendFactory |
FACTORY
|
Constructor Summary | |
---|---|
WebStorageBackend(ErraiEntityManager erraiEntityManager)
Creates a WebStorageBackend that works with entities in the default storage namespace. |
|
WebStorageBackend(ErraiEntityManager erraiEntityManager,
String namespace)
Creates a WebStorageBackend that works with entities in the given storage namespace. |
Method Summary | ||
---|---|---|
|
contains(Key<X,Y> key)
Tests if this backend contains data for the given key. |
|
|
get(Key<X,?> requestedKey)
Retrieves the value most recently stored in this backend under the given key, reconnecting referenced objects by calling back up into the owning EntityManager. |
|
|
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. |
|
|
isModified(Key<X,?> key,
X value)
Checks if the value currently associated with key in this backend
datastore is identical to the given one. |
|
|
put(Key<X,?> key,
X value)
Stores the given Errai-Marshalling-Capable value under the given key. |
|
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final StorageBackendFactory FACTORY
Constructor Detail |
---|
public WebStorageBackend(ErraiEntityManager erraiEntityManager)
erraiEntityManager
- the ErraiEntityManager this storage backend will be used with (it
is used for resolving entity references).public WebStorageBackend(ErraiEntityManager erraiEntityManager, String namespace)
erraiEntityManager
- the ErraiEntityManager this storage backend will be used with (it
is used for resolving entity references).namespace
- The namespace to operate within. Must not be null.Method Detail |
---|
public void removeAll()
StorageBackend
removeAll
in interface StorageBackend
public <X> void put(Key<X,?> key, X value)
StorageBackend
put
in interface StorageBackend
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 StorageBackend.remove(Key)
to remove an
entity from this data store.public <X> X get(Key<X,?> requestedKey)
StorageBackend
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 StorageBackend.contains(Key)
.
get
in interface StorageBackend
X
- The entity's Java typerequestedKey
- 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
.public <X> List<X> getAll(ErraiIdentifiableType<X> type, EntityJsonMatcher matcher)
StorageBackend
getAll
in interface StorageBackend
type
- The type of entities to retrievematcher
- The matcher that decides which entity instances will be retrieved.
public <X,Y> boolean contains(Key<X,Y> key)
StorageBackend
StorageBackend.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.
contains
in interface StorageBackend
key
- The identity of the object to be tested for. Null is not
permitted.
public <X> void remove(Key<X,?> key)
StorageBackend
remove
in interface StorageBackend
X
- The entity's Java typekey
- The identity of the object to be removed. Null is not permitted.public <X> boolean isModified(Key<X,?> key, X value)
StorageBackend
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
.
isModified
in interface StorageBackend
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.
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |