Class ReactorToAsyncOperationsAdaptor
java.lang.Object
io.micronaut.data.runtime.operations.ReactorToAsyncOperationsAdaptor
- All Implemented Interfaces:
AsyncRepositoryOperations
public final class ReactorToAsyncOperationsAdaptor
extends Object
implements AsyncRepositoryOperations
An implementation of
AsyncRepositoryOperations that delegates to a reactive operation.- Since:
- 3.5.0
- Author:
- Denis Stepanov
-
Constructor Summary
ConstructorsConstructorDescriptionReactorToAsyncOperationsAdaptor(ReactorReactiveRepositoryOperations reactiveOperations, Executor executor) -
Method Summary
Modifier and TypeMethodDescription<T> CompletionStage<Long>count(PagedQuery<T> pagedQuery) Counts all results for the given query.<T> CompletionStage<Number>delete(DeleteOperation<T> operation) Deletes the entity.<T> CompletionStage<Number>deleteAll(DeleteBatchOperation<T> operation) Deletes all the entities of the given type.executeDelete(PreparedQuery<?, Number> preparedQuery) Executes a delete batch for the given query and parameter values.executeUpdate(PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values.<T> CompletionStage<Boolean>exists(PreparedQuery<T, Boolean> preparedQuery) Check with an record exists for the given query.<T> CompletionStage<Iterable<T>>findAll(PagedQuery<T> pagedQuery) Finds all results for the given query.<T,R> CompletionStage<Iterable<R>> findAll(PreparedQuery<T, R> preparedQuery) Finds all results for the given query.<T,R> CompletionStage<R> findOne(PreparedQuery<T, R> preparedQuery) Find one by Query.<T> CompletionStage<T>findOne(Class<T> type, Serializable id) Find one by ID.<T,R> CompletionStage<R> findOptional(PreparedQuery<T, R> preparedQuery) Find one by Query.<T> CompletionStage<T>findOptional(Class<T> type, Serializable id) Find one by ID.<R> CompletionStage<Page<R>>findPage(PagedQuery<R> pagedQuery) Find a page for the given entity and pageable.<T> CompletionStage<T>persist(InsertOperation<T> operation) Persist the entity returning a possibly new entity.<T> CompletionStage<Iterable<T>>persistAll(InsertBatchOperation<T> operation) Persist all the given entities.<T> CompletionStage<T>update(UpdateOperation<T> operation) Updates the entity returning a possibly new entity.<T> CompletionStage<Iterable<T>>updateAll(UpdateBatchOperation<T> operation) Updates the entities for the given operation.
-
Constructor Details
-
ReactorToAsyncOperationsAdaptor
public ReactorToAsyncOperationsAdaptor(ReactorReactiveRepositoryOperations reactiveOperations, Executor executor)
-
-
Method Details
-
getExecutor
- Specified by:
getExecutorin interfaceAsyncRepositoryOperations- Returns:
- The executor used by this async operations
-
findOne
Description copied from interface:AsyncRepositoryOperationsFind one by ID.- Specified by:
findOnein interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
type- The typeid- The id- Returns:
- A completion stage that emits the result
-
exists
Description copied from interface:AsyncRepositoryOperationsCheck with an record exists for the given query.- Specified by:
existsin interfaceAsyncRepositoryOperations- Type Parameters:
T- The declaring type- Parameters:
preparedQuery- The query- Returns:
- True if it exists
-
findOne
Description copied from interface:AsyncRepositoryOperationsFind one by Query.- Specified by:
findOnein interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic resultTypeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- A completion stage that emits the result
-
findOptional
@NonNull public <T> CompletionStage<T> findOptional(@NonNull Class<T> type, @NonNull Serializable id) Description copied from interface:AsyncRepositoryOperationsFind one by ID.- Specified by:
findOptionalin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
type- The typeid- The id- Returns:
- A completion stage that emits the result or null if there is no result
-
findOptional
Description copied from interface:AsyncRepositoryOperationsFind one by Query.- Specified by:
findOptionalin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic resultTypeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- A completion stage that emits the result or null if there is no result
-
findAll
Description copied from interface:AsyncRepositoryOperationsFinds all results for the given query.- Specified by:
findAllin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
pagedQuery- The paged query- Returns:
- A completion stage that emits the results
-
count
Description copied from interface:AsyncRepositoryOperationsCounts all results for the given query.- Specified by:
countin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
pagedQuery- The paged query- Returns:
- A completion stage that emits the count as a long
-
findAll
@NonNull public <T,R> CompletionStage<Iterable<R>> findAll(@NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperationsFinds all results for the given query.- Specified by:
findAllin interfaceAsyncRepositoryOperations- Type Parameters:
T- The entity typeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- A completion stage that emits an iterable with all results
-
persist
Description copied from interface:AsyncRepositoryOperationsPersist the entity returning a possibly new entity.- Specified by:
persistin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The entity operation- Returns:
- A completion stage that emits the entity
-
update
Description copied from interface:AsyncRepositoryOperationsUpdates the entity returning a possibly new entity.- Specified by:
updatein interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The entity operation- Returns:
- A completion stage that emits the entity
-
delete
Description copied from interface:AsyncRepositoryOperationsDeletes the entity.- Specified by:
deletein interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The batch operation- Returns:
- A publisher that emits the number of entities deleted
-
persistAll
@NonNull public <T> CompletionStage<Iterable<T>> persistAll(@NonNull InsertBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsPersist all the given entities.- Specified by:
persistAllin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The batch operation- Returns:
- The entities, possibly mutated
-
executeUpdate
@NonNull public CompletionStage<Number> executeUpdate(@NonNull PreparedQuery<?, Number> preparedQuery) Description copied from interface:AsyncRepositoryOperationsExecutes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeUpdatein interfaceAsyncRepositoryOperations- Parameters:
preparedQuery- The prepared query- Returns:
- A completion that emits a boolean true if successful
-
executeDelete
Description copied from interface:AsyncRepositoryOperationsExecutes a delete batch for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Specified by:
executeDeletein interfaceAsyncRepositoryOperations- Parameters:
preparedQuery- The prepared query- Returns:
- A completion that emits a boolean true if successful
-
deleteAll
Description copied from interface:AsyncRepositoryOperationsDeletes all the entities of the given type.- Specified by:
deleteAllin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The batch operation- Returns:
- A completion that emits a boolean true if successful
-
findPage
Description copied from interface:AsyncRepositoryOperationsFind a page for the given entity and pageable.- Specified by:
findPagein interfaceAsyncRepositoryOperations- Type Parameters:
R- The entity generic type- Parameters:
pagedQuery- The paged query- Returns:
- The page type
-
updateAll
@NonNull public <T> CompletionStage<Iterable<T>> updateAll(@NonNull UpdateBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsUpdates the entities for the given operation.- Specified by:
updateAllin interfaceAsyncRepositoryOperations- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The updated entities
-