Interface RxJavaCrudRepository<E,ID>

Type Parameters:
E - The entity type
ID - The ID type
All Superinterfaces:
GenericRepository<E,ID>
All Known Subinterfaces:
DomainEventsReactiveRepository, StudentReactiveRepository

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

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

    • save

      <S extends E> io.reactivex.rxjava3.core.Single<S> save(S entity)
      Saves the given valid entity, returning a possibly new entity representing the saved state.

      If the entity has no identity value, an insert is performed. If the entity has a generated or always auto-populated identity value already present, an update is attempted. Entities with non-generated assigned identities are inserted by default. To require a specific operation, use insert(Object) or update(Object). This is the default repository save behavior and can be overridden by Micronaut Data configuration.

      Type Parameters:
      S - The generic type
      Parameters:
      entity - The entity to save. Must not be null.
      Returns:
      The saved entity will never be null.
    • insert

      <S extends E> io.reactivex.rxjava3.core.Single<S> insert(S entity)
      This method issues an explicit insert for the given entity. The method differs from save(Object) in that an insert will be generated regardless of the entity identity state. If the entity already exists then an exception may be thrown.
      Type Parameters:
      S - The generic type
      Parameters:
      entity - The entity to insert. Must not be null.
      Returns:
      The inserted entity will never be null.
      Since:
      5.0.0
    • saveAll

      <S extends E> io.reactivex.rxjava3.core.Flowable<S> saveAll(Iterable<S> entities)
      Saves all given entities, possibly returning new instances representing the saved state.

      Each entity is saved independently using the same rules as save(Object). This is the default repository save behavior and can be overridden by Micronaut Data configuration.

      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.
    • insertAll

      <S extends E> io.reactivex.rxjava3.core.Flowable<S> insertAll(Iterable<S> entities)
      This method issues an explicit insert for the given entities. The method differs from saveAll(Iterable) in that an insert will be generated for every entity regardless of identity state. If an entity already exists then an exception may be thrown.
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to insert. Must not be null.
      Returns:
      The inserted entities will never be null.
      Since:
      5.0.0
    • findById

      io.reactivex.rxjava3.core.Maybe<E> findById(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

      <S extends E> io.reactivex.rxjava3.core.Single<S> update(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 of the entity identity state. 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

      <S extends E> io.reactivex.rxjava3.core.Flowable<S> updateAll(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 for every entity regardless of identity state. If an 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

      io.reactivex.rxjava3.core.Single<Boolean> existsById(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

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

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

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

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

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

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