Class AsyncFromReactiveAsyncRepositoryOperation
java.lang.Object
io.micronaut.data.runtime.operations.AsyncFromReactiveAsyncRepositoryOperation
- All Implemented Interfaces:
AsyncRepositoryOperations
public class AsyncFromReactiveAsyncRepositoryOperation
extends Object
implements AsyncRepositoryOperations
An implementation of
AsyncRepositoryOperations
that delegates to a reactive operation.- Since:
- 2.4.0
- Author:
- Denis Stepanov
-
Constructor Summary
ConstructorDescriptionAsyncFromReactiveAsyncRepositoryOperation
(ReactiveRepositoryOperations reactiveOperations, Executor executor) -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull CompletionStage<Long>
count
(PagedQuery<T> pagedQuery) Counts all results for the given query.<T> @NonNull CompletionStage<Number>
delete
(@NonNull DeleteOperation<T> operation) Deletes the entity.<T> @NonNull CompletionStage<Number>
deleteAll
(@NonNull 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.@NonNull CompletionStage<Number>
executeUpdate
(@NonNull PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values.<T> CompletionStage<Boolean>
exists
(@NonNull PreparedQuery<T, Boolean> preparedQuery) Check with an record exists for the given query.<T,
R> @NonNull CompletionStage<Iterable<R>> findAll
(@NonNull PreparedQuery<T, R> preparedQuery) Finds all results for the given query.<T> @NonNull CompletionStage<Iterable<T>>
findAll
(PagedQuery<T> pagedQuery) Finds all results for the given query.<T,
R> @NonNull CompletionStage<R> findOne
(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull CompletionStage<T>
Find one by ID.<T,
R> @NonNull CompletionStage<R> findOptional
(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull CompletionStage<T>
findOptional
(@NonNull Class<T> type, @NonNull Object id) Find one by ID.<R> @NonNull CompletionStage<Page<R>>
findPage
(@NonNull PagedQuery<R> pagedQuery) Find a page for the given entity and pageable.@NonNull Executor
<T> @NonNull CompletionStage<T>
persist
(@NonNull InsertOperation<T> operation) Persist the entity returning a possibly new entity.<T> @NonNull CompletionStage<Iterable<T>>
persistAll
(@NonNull InsertBatchOperation<T> operation) Persist all the given entities.<T> @NonNull CompletionStage<T>
update
(@NonNull UpdateOperation<T> operation) Updates the entity returning a possibly new entity.<T> @NonNull CompletionStage<Iterable<T>>
updateAll
(@NonNull UpdateBatchOperation<T> operation) Updates the entities for the given operation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.operations.async.AsyncRepositoryOperations
execute
-
Constructor Details
-
AsyncFromReactiveAsyncRepositoryOperation
public AsyncFromReactiveAsyncRepositoryOperation(ReactiveRepositoryOperations reactiveOperations, Executor executor)
-
-
Method Details
-
getExecutor
- Specified by:
getExecutor
in interfaceAsyncRepositoryOperations
- Returns:
- The executor used by this async operations
-
findOne
@NonNull public <T> @NonNull CompletionStage<T> findOne(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:AsyncRepositoryOperations
Find one by ID.- Specified by:
findOne
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeid
- The id- Returns:
- A completion stage that emits the result
-
exists
public <T> CompletionStage<Boolean> exists(@NonNull @NonNull PreparedQuery<T, Boolean> preparedQuery) Description copied from interface:AsyncRepositoryOperations
Check with an record exists for the given query.- Specified by:
exists
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The declaring type- Parameters:
preparedQuery
- The query- Returns:
- True if it exists
-
findOne
@NonNull public <T,R> @NonNull CompletionStage<R> findOne(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperations
Find one by Query.- Specified by:
findOne
in 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> @NonNull CompletionStage<T> findOptional(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:AsyncRepositoryOperations
Find one by ID.- Specified by:
findOptional
in 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
@NonNull public <T,R> @NonNull CompletionStage<R> findOptional(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperations
Find one by Query.- Specified by:
findOptional
in 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:AsyncRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in 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:AsyncRepositoryOperations
Counts all results for the given query.- Specified by:
count
in 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> @NonNull CompletionStage<Iterable<R>> findAll(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperations
Finds all results for the given query.- Specified by:
findAll
in 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
@NonNull public <T> @NonNull CompletionStage<T> persist(@NonNull @NonNull InsertOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Persist the entity returning a possibly new entity.- Specified by:
persist
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A completion stage that emits the entity
-
update
@NonNull public <T> @NonNull CompletionStage<T> update(@NonNull @NonNull UpdateOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Updates the entity returning a possibly new entity.- Specified by:
update
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The entity operation- Returns:
- A completion stage that emits the entity
-
delete
@NonNull public <T> @NonNull CompletionStage<Number> delete(@NonNull @NonNull DeleteOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Deletes the entity.- Specified by:
delete
in 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> @NonNull CompletionStage<Iterable<T>> persistAll(@NonNull @NonNull InsertBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Persist all the given entities.- Specified by:
persistAll
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- The entities, possibly mutated
-
executeUpdate
@NonNull public @NonNull CompletionStage<Number> executeUpdate(@NonNull @NonNull PreparedQuery<?, Number> preparedQuery) Description copied from interface:AsyncRepositoryOperations
Executes 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:
executeUpdate
in interfaceAsyncRepositoryOperations
- Parameters:
preparedQuery
- The prepared query- Returns:
- A completion that emits a boolean true if successful
-
executeDelete
Description copied from interface:AsyncRepositoryOperations
Executes 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:
executeDelete
in interfaceAsyncRepositoryOperations
- Parameters:
preparedQuery
- The prepared query- Returns:
- A completion that emits a boolean true if successful
-
deleteAll
@NonNull public <T> @NonNull CompletionStage<Number> deleteAll(@NonNull @NonNull DeleteBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Deletes all the entities of the given type.- Specified by:
deleteAll
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The batch operation- Returns:
- A completion that emits a boolean true if successful
-
findPage
@NonNull public <R> @NonNull CompletionStage<Page<R>> findPage(@NonNull @NonNull PagedQuery<R> pagedQuery) Description copied from interface:AsyncRepositoryOperations
Find a page for the given entity and pageable.- Specified by:
findPage
in interfaceAsyncRepositoryOperations
- Type Parameters:
R
- The entity generic type- Parameters:
pagedQuery
- The paged query- Returns:
- The page type
-
updateAll
@NonNull public <T> @NonNull CompletionStage<Iterable<T>> updateAll(@NonNull @NonNull UpdateBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperations
Updates the entities for the given operation.- Specified by:
updateAll
in interfaceAsyncRepositoryOperations
- Type Parameters:
T
- The generic type- Parameters:
operation
- The operation- Returns:
- The updated entities
-