Interface RxJavaCrudRepository<E,ID>

Type Parameters:
E - The entity type
ID - The ID type
All Superinterfaces:
GenericRepository<E,ID>

public interface RxJavaCrudRepository<E,ID> extends GenericRepository<E,ID>
Interface for CRUD using RxJava 2.
Since:
1.0.0
Author:
graemerocher
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull io.reactivex.Single<Long>
    Returns the number of entities available.
    @NonNull io.reactivex.Completable
    delete(E entity)
    Deletes a given entity.
    @NonNull io.reactivex.Completable
    Deletes all entities managed by the repository.
    @NonNull io.reactivex.Completable
    deleteAll(@NonNull Iterable<? extends E> entities)
    Deletes the given entities.
    @NonNull io.reactivex.Completable
    Deletes the entity with the given id.
    @NonNull io.reactivex.Single<Boolean>
    Returns whether an entity with the given id exists.
    @NonNull io.reactivex.Flowable<E>
    Returns all instances of the type.
    @NonNull io.reactivex.Maybe<E>
    Retrieves an entity by its id.
    <S extends E>
    @NonNull io.reactivex.Single<S>
    save(S entity)
    Saves the given valid entity, returning a possibly new entity representing the saved state.
    <S extends E>
    @NonNull io.reactivex.Flowable<S>
    saveAll(@NonNull Iterable<S> entities)
    Saves all given entities, possibly returning new instances representing the saved state.
    <S extends E>
    @NonNull io.reactivex.Single<S>
    update(S entity)
    This method issues an explicit update for the given entity.
    <S extends E>
    @NonNull io.reactivex.Flowable<S>
    updateAll(@NonNull Iterable<S> entities)
    This method issues an explicit update for the given entities.
  • Method Details

    • save

      @NonNull <S extends E> @NonNull io.reactivex.Single<S> save(@NonNull S entity)
      Saves the given valid entity, returning a possibly new entity representing the saved state.
      Type Parameters:
      S - The generic type
      Parameters:
      entity - The entity to save. Must not be null.
      Returns:
      The saved entity will never be null.
    • saveAll

      @NonNull <S extends E> @NonNull io.reactivex.Flowable<S> saveAll(@NonNull @NonNull Iterable<S> entities)
      Saves all given entities, possibly returning new instances representing the saved state.
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to save. Must not be null.
      Returns:
      The saved entities objects. will never be null.
    • findById

      @NonNull @NonNull io.reactivex.Maybe<E> findById(@NonNull ID id)
      Retrieves an entity by its id.
      Parameters:
      id - The ID of the entity to retrieve. Must not be null.
      Returns:
      the entity with the given id or Optional#empty() if none found
    • update

      @NonNull <S extends E> @NonNull io.reactivex.Single<S> update(@NonNull S entity)
      This method issues an explicit update for the given entity. The method differs from save(Object) in that an update will be generated regardless if the entity has been saved previously or not. If the entity has no assigned ID then an exception will be thrown.
      Type Parameters:
      S - The generic type
      Parameters:
      entity - The entity to update. Must not be null.
      Returns:
      The updated entity will never be null.
    • updateAll

      @NonNull <S extends E> @NonNull io.reactivex.Flowable<S> updateAll(@NonNull @NonNull Iterable<S> entities)
      This method issues an explicit update for the given entities. The method differs from saveAll(Iterable) in that an update will be generated regardless if the entity has been saved previously or not. If the entity has no assigned ID then an exception will be thrown.
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to update. Must not be null.
      Returns:
      The updated entities will never be null.
    • existsById

      @NonNull @NonNull io.reactivex.Single<Boolean> existsById(@NonNull ID id)
      Returns whether an entity with the given id exists.
      Parameters:
      id - must not be null.
      Returns:
      true if an entity with the given id exists, false otherwise.
    • findAll

      @NonNull @NonNull io.reactivex.Flowable<E> findAll()
      Returns all instances of the type.
      Returns:
      all entities
    • count

      @NonNull @NonNull io.reactivex.Single<Long> count()
      Returns the number of entities available.
      Returns:
      the number of entities
    • deleteById

      @NonNull @NonNull io.reactivex.Completable deleteById(@NonNull ID id)
      Deletes the entity with the given id.
      Parameters:
      id - must not be null.
      Returns:
      A future that executes the delete operation
    • delete

      @NonNull @NonNull io.reactivex.Completable delete(@NonNull E entity)
      Deletes a given entity.
      Parameters:
      entity - The entity to delete
      Returns:
      A future that executes the delete operation
    • deleteAll

      @NonNull @NonNull io.reactivex.Completable deleteAll(@NonNull @NonNull Iterable<? extends E> entities)
      Deletes the given entities.
      Parameters:
      entities - The entities to delete
      Returns:
      A future that executes the delete operation
    • deleteAll

      @NonNull @NonNull io.reactivex.Completable deleteAll()
      Deletes all entities managed by the repository.
      Returns:
      A future that executes the delete operation