T
- entity base type. See EntityStore
.@ParametersAreNonnullByDefault public abstract class ReactiveEntityStore<T> extends Object implements EntityStore<T,Object>, ReactiveQueryable<T>
EntityStore
where all return values are either single Single
instances or
Completable
representing the outcome of each operation. Observable
query results
can be obtained via ReactiveResult.observable()
.Constructor and Description |
---|
ReactiveEntityStore() |
Modifier and Type | Method and Description |
---|---|
abstract <E extends T> |
delete(E entity)
Deletes the given entity from the store.
|
abstract <E extends T> |
delete(Iterable<E> entities)
Deletes multiple entities.
|
abstract <E extends T,K> |
findByKey(Class<E> type,
K key)
Find an entity by the given key.
|
abstract <E extends T> |
insert(E entity)
Inserts the given entity.
|
abstract <K,E extends T> |
insert(E entity,
Class<K> keyClass)
Inserts the given entity returning the generated key after the entity is inserted.
|
abstract <E extends T> |
insert(Iterable<E> entities)
Insert a collection of entities.
|
abstract <K,E extends T> |
insert(Iterable<E> entities,
Class<K> keyClass)
Insert a collection of entities returning the generated keys for the inserted entities in
the order they were inserted.
|
abstract <E extends T> |
refresh(E entity)
Refresh the given entity.
|
abstract <E extends T> |
refresh(E entity,
Attribute<?,?>... attributes)
Refresh the given entity on specific attributes.
|
abstract <E extends T> |
refresh(Iterable<E> entities,
Attribute<?,?>... attributes)
Refresh the given entities on specific attributes.
|
abstract <E extends T> |
refreshAll(E entity)
Refresh the given entity on all of its attributes including relational ones.
|
<E> io.reactivex.Observable<E> |
runInTransaction(io.reactivex.Single<? extends E>... elements) |
abstract <E extends T> |
update(E entity)
Update the given entity.
|
abstract <E extends T> |
update(E entity,
Attribute<?,?>... attributes)
Update specific attributes of entity regardless of any modification state.
|
abstract <E extends T> |
update(Iterable<E> entities)
Updates a collection of entities.
|
abstract <E extends T> |
upsert(E entity)
Upserts (insert or update) the given entity.
|
abstract <E extends T> |
upsert(Iterable<E> entities)
Upserts (inserts or updates) a collection of entities.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, toBlocking
@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> insert(E entity)
EntityStore
PersistenceException
may be thrown.insert
in interface EntityStore<T,Object>
E
- entity typeentity
- non null entity to insert@CheckReturnValue public abstract <E extends T> io.reactivex.Single<Iterable<E>> insert(Iterable<E> entities)
EntityStore
insert
in interface EntityStore<T,Object>
E
- entity typeentities
- to insert@CheckReturnValue public abstract <K,E extends T> io.reactivex.Single<K> insert(E entity, Class<K> keyClass)
EntityStore
PersistenceException
may be thrown.insert
in interface EntityStore<T,Object>
K
- key typeE
- entity typeentity
- non null entity to insertkeyClass
- key class@CheckReturnValue public abstract <K,E extends T> io.reactivex.Single<Iterable<K>> insert(Iterable<E> entities, Class<K> keyClass)
EntityStore
insert
in interface EntityStore<T,Object>
K
- key typeE
- entity typeentities
- to insertkeyClass
- key class@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> update(E entity)
EntityStore
update
in interface EntityStore<T,Object>
E
- entity typeentity
- to update@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> update(E entity, Attribute<?,?>... attributes)
EntityStore
update
in interface EntityStore<T,Object>
E
- entity typeentity
- to refreshattributes
- attributes to update, attributes should be of type E@CheckReturnValue public abstract <E extends T> io.reactivex.Single<Iterable<E>> update(Iterable<E> entities)
EntityStore
update
in interface EntityStore<T,Object>
E
- entity typeentities
- to update@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> upsert(E entity)
EntityStore
upsert
in interface EntityStore<T,Object>
E
- entity typeentity
- non null entity to insert@CheckReturnValue public abstract <E extends T> io.reactivex.Single<Iterable<E>> upsert(Iterable<E> entities)
EntityStore
upsert
in interface EntityStore<T,Object>
E
- entity typeentities
- to update@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> refresh(E entity)
EntityStore
refresh
in interface EntityStore<T,Object>
E
- entity typeentity
- to insert@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> refresh(E entity, Attribute<?,?>... attributes)
EntityStore
refresh
in interface EntityStore<T,Object>
E
- entity typeentity
- to refreshattributes
- attributes to refresh, attributes should be of type E
(not enforced due to erasure)@CheckReturnValue public abstract <E extends T> io.reactivex.Single<Iterable<E>> refresh(Iterable<E> entities, Attribute<?,?>... attributes)
EntityStore
refresh
in interface EntityStore<T,Object>
E
- entity typeentities
- to refreshattributes
- attributes to refresh, attributes should be of type E
(not enforced due to erasure)@CheckReturnValue public abstract <E extends T> io.reactivex.Single<E> refreshAll(E entity)
EntityStore
refreshAll
in interface EntityStore<T,Object>
E
- entity typeentity
- to refresh@CheckReturnValue public abstract <E extends T> io.reactivex.Completable delete(E entity)
EntityStore
delete
in interface EntityStore<T,Object>
E
- entity type.entity
- to delete@CheckReturnValue public abstract <E extends T> io.reactivex.Completable delete(Iterable<E> entities)
EntityStore
delete
in interface EntityStore<T,Object>
E
- entity typeentities
- to delete@CheckReturnValue public abstract <E extends T,K> io.reactivex.Maybe<E> findByKey(Class<E> type, K key)
EntityStore
EntityCache
if available may be checked first for the object. If an entity is
found in the cache it will be returned and potentially no query will be made.findByKey
in interface EntityStore<T,Object>
E
- entity typeK
- key typetype
- non null entity class typekey
- non null key value@CheckReturnValue @SafeVarargs public final <E> io.reactivex.Observable<E> runInTransaction(io.reactivex.Single<? extends E>... elements)