Interface ReactorCrudRepository<E,ID>

Type Parameters:
E - The entity type
ID - The ID type
All Superinterfaces:
GenericRepository<E,ID>, ReactiveStreamsCrudRepository<E,ID>
All Known Subinterfaces:
BookReactiveRepository, PersonReactiveRepository, ReactorPageableRepository<E,ID>, StreamingPersonReactorRepository

public interface ReactorCrudRepository<E,ID> extends ReactiveStreamsCrudRepository<E,ID>
CRUD repository for Project Reactor.
Since:
3.1
Author:
graemerocher, Denis Stepanov
See Also:
  • Method Summary

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

    • save

      <S extends E> reactor.core.publisher.Mono<S> save(S entity)
      Description copied from interface: ReactiveStreamsCrudRepository
      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 ReactiveStreamsCrudRepository.insert(Object) or ReactiveStreamsCrudRepository.update(Object). This is the default repository save behavior and can be overridden by Micronaut Data configuration.

      Specified by:
      save in interface ReactiveStreamsCrudRepository<E,ID>
      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> reactor.core.publisher.Mono<S> insert(S entity)
      Description copied from interface: ReactiveStreamsCrudRepository
      This method issues an explicit insert for the given entity. The method differs from ReactiveStreamsCrudRepository.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.
      Specified by:
      insert in interface ReactiveStreamsCrudRepository<E,ID>
      Type Parameters:
      S - The generic type
      Parameters:
      entity - The entity to insert. Must not be null.
      Returns:
      The inserted entity will never be null.
    • saveAll

      <S extends E> reactor.core.publisher.Flux<S> saveAll(Iterable<S> entities)
      Description copied from interface: ReactiveStreamsCrudRepository
      Saves all given entities, possibly returning new instances representing the saved state.

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

      Specified by:
      saveAll in interface ReactiveStreamsCrudRepository<E,ID>
      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> reactor.core.publisher.Flux<S> insertAll(Iterable<S> entities)
      Description copied from interface: ReactiveStreamsCrudRepository
      This method issues an explicit insert for the given entities. The method differs from ReactiveStreamsCrudRepository.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.
      Specified by:
      insertAll in interface ReactiveStreamsCrudRepository<E,ID>
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to insert. Must not be null.
      Returns:
      The inserted entities will never be null.
    • update

      <S extends E> reactor.core.publisher.Mono<S> update(S entity)
      Description copied from interface: ReactiveStreamsCrudRepository
      This method issues an explicit update for the given entity. The method differs from ReactiveStreamsCrudRepository.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.
      Specified by:
      update in interface ReactiveStreamsCrudRepository<E,ID>
      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> reactor.core.publisher.Flux<S> updateAll(Iterable<S> entities)
      Description copied from interface: ReactiveStreamsCrudRepository
      This method issues an explicit update for the given entities. The method differs from ReactiveStreamsCrudRepository.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.
      Specified by:
      updateAll in interface ReactiveStreamsCrudRepository<E,ID>
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to update. Must not be null.
      Returns:
      The updated entities will never be null.
    • findById

      reactor.core.publisher.Mono<E> findById(ID id)
      Description copied from interface: ReactiveStreamsCrudRepository
      Retrieves an entity by its id.
      Specified by:
      findById in interface ReactiveStreamsCrudRepository<E,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
    • existsById

      reactor.core.publisher.Mono<Boolean> existsById(ID id)
      Description copied from interface: ReactiveStreamsCrudRepository
      Returns whether an entity with the given id exists.
      Specified by:
      existsById in interface ReactiveStreamsCrudRepository<E,ID>
      Parameters:
      id - must not be null.
      Returns:
      true if an entity with the given id exists, false otherwise.
    • findAll

      reactor.core.publisher.Flux<E> findAll()
      Description copied from interface: ReactiveStreamsCrudRepository
      Returns all instances of the type.
      Specified by:
      findAll in interface ReactiveStreamsCrudRepository<E,ID>
      Returns:
      all entities
    • count

      reactor.core.publisher.Mono<Long> count()
      Description copied from interface: ReactiveStreamsCrudRepository
      Returns the number of entities available.
      Specified by:
      count in interface ReactiveStreamsCrudRepository<E,ID>
      Returns:
      the number of entities
    • deleteById

      reactor.core.publisher.Mono<Long> deleteById(ID id)
      Description copied from interface: ReactiveStreamsCrudRepository
      Deletes the entity with the given id.
      Specified by:
      deleteById in interface ReactiveStreamsCrudRepository<E,ID>
      Parameters:
      id - must not be null.
      Returns:
      A future that executes the delete operation
    • delete

      reactor.core.publisher.Mono<Long> delete(E entity)
      Description copied from interface: ReactiveStreamsCrudRepository
      Deletes a given entity.
      Specified by:
      delete in interface ReactiveStreamsCrudRepository<E,ID>
      Parameters:
      entity - The entity to delete
      Returns:
      A future that executes the delete operation
    • deleteAll

      reactor.core.publisher.Mono<Long> deleteAll(Iterable<? extends E> entities)
      Description copied from interface: ReactiveStreamsCrudRepository
      Deletes the given entities.
      Specified by:
      deleteAll in interface ReactiveStreamsCrudRepository<E,ID>
      Parameters:
      entities - The entities to delete
      Returns:
      A future that executes the delete operation
    • deleteAll

      reactor.core.publisher.Mono<Long> deleteAll()
      Description copied from interface: ReactiveStreamsCrudRepository
      Deletes all entities managed by the repository.
      Specified by:
      deleteAll in interface ReactiveStreamsCrudRepository<E,ID>
      Returns:
      A future that executes the delete operation