Class ExecutorAsyncOperations
java.lang.Object
io.micronaut.data.runtime.operations.ExecutorAsyncOperations
- All Implemented Interfaces:
- AsyncRepositoryOperations
An implementation of 
AsyncRepositoryOperations that delegates to a blocking operations and specified Executor.
 This can be used in absence of true asynchronous support at the driver level.
 If a backing implementation provides a async API then the backing implementation should not use this class and instead directly implement the AsyncRepositoryOperations interface.
- Since:
- 1.0.0
- Author:
- graemerocher
- 
Constructor SummaryConstructorsConstructorDescriptionExecutorAsyncOperations(@NonNull RepositoryOperations operations, @NonNull Executor executor) Default constructor.
- 
Method SummaryModifier and TypeMethodDescription<T> CompletableFuture<Long>count(@NonNull PagedQuery<T> pagedQuery) Counts all results for the given query.<T> @NonNull CompletableFuture<Number>delete(@NonNull DeleteOperation<T> operation) Deletes the entity.<T> @NonNull CompletableFuture<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 CompletableFuture<Number>executeUpdate(@NonNull PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values.<T> CompletableFuture<Boolean>exists(@NonNull PreparedQuery<T, Boolean> preparedQuery) Check with an record exists for the given query.<T> @NonNull CompletableFuture<Iterable<T>>findAll(@NonNull PagedQuery<T> pagedQuery) Finds all results for the given query.<T,R> @NonNull CompletableFuture<Iterable<R>> findAll(@NonNull PreparedQuery<T, R> preparedQuery) Finds all results for the given query.<T,R> @NonNull CompletableFuture<R> findOne(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull CompletableFuture<T>Find one by ID.<T,R> @NonNull CompletableFuture<R> findOptional(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull CompletableFuture<T>findOptional(@NonNull Class<T> type, @NonNull Object id) Find one by ID.<R> CompletableFuture<Page<R>>findPage(@NonNull PagedQuery<R> pagedQuery) Find a page for the given entity and pageable.<T> @NonNull CompletableFuture<T>persist(@NonNull InsertOperation<T> entity) Persist the entity returning a possibly new entity.<T> @NonNull CompletableFuture<Iterable<T>>persistAll(@NonNull InsertBatchOperation<T> operation) Persist all the given entities.<T> @NonNull CompletableFuture<T>update(@NonNull UpdateOperation<T> operation) Updates the entity returning a possibly new entity.<T> @NonNull CompletableFuture<Iterable<T>>updateAll(@NonNull UpdateBatchOperation<T> operation) Updates the entities for the given operation.
- 
Constructor Details- 
ExecutorAsyncOperationspublic ExecutorAsyncOperations(@NonNull @NonNull RepositoryOperations operations, @NonNull @NonNull Executor executor) Default constructor.- Parameters:
- operations- The target operations
- executor- The executor to use.
 
 
- 
- 
Method Details- 
getExecutor- Specified by:
- getExecutorin interface- AsyncRepositoryOperations
- Returns:
- The executor used by this async operations
 
- 
findOne@NonNull public <T> @NonNull CompletableFuture<T> findOne(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:AsyncRepositoryOperationsFind one by ID.- Specified by:
- findOnein interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- type- The type
- id- The id
- Returns:
- A completion stage that emits the result
 
- 
existspublic <T> CompletableFuture<Boolean> exists(@NonNull @NonNull PreparedQuery<T, Boolean> preparedQuery) Description copied from interface:AsyncRepositoryOperationsCheck with an record exists for the given query.- Specified by:
- existsin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The declaring type
- Parameters:
- preparedQuery- The query
- Returns:
- True if it exists
 
- 
findOne@NonNull public <T,R> @NonNull CompletableFuture<R> findOne(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperationsFind one by Query.- Specified by:
- findOnein interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic resultType
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A completion stage that emits the result
 
- 
findOptional@NonNull public <T> @NonNull CompletableFuture<T> findOptional(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:AsyncRepositoryOperationsFind one by ID.- Specified by:
- findOptionalin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- type- The type
- id- The id
- Returns:
- A completion stage that emits the result or null if there is no result
 
- 
findOptional@NonNull public <T,R> @NonNull CompletableFuture<R> findOptional(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperationsFind one by Query.- Specified by:
- findOptionalin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic resultType
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A completion stage that emits the result or null if there is no result
 
- 
findAll@NonNull public <T> @NonNull CompletableFuture<Iterable<T>> findAll(@NonNull @NonNull PagedQuery<T> pagedQuery) Description copied from interface:AsyncRepositoryOperationsFinds all results for the given query.- Specified by:
- findAllin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- pagedQuery- The paged query
- Returns:
- A completion stage that emits the results
 
- 
countDescription copied from interface:AsyncRepositoryOperationsCounts all results for the given query.- Specified by:
- countin interface- AsyncRepositoryOperations
- 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 CompletableFuture<Iterable<R>> findAll(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:AsyncRepositoryOperationsFinds all results for the given query.- Specified by:
- findAllin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The entity type
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A completion stage that emits an iterable with all results
 
- 
persist@NonNull public <T> @NonNull CompletableFuture<T> persist(@NonNull @NonNull InsertOperation<T> entity) Description copied from interface:AsyncRepositoryOperationsPersist the entity returning a possibly new entity.- Specified by:
- persistin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- entity- The entity operation
- Returns:
- A completion stage that emits the entity
 
- 
update@NonNull public <T> @NonNull CompletableFuture<T> update(@NonNull @NonNull UpdateOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsUpdates the entity returning a possibly new entity.- Specified by:
- updatein interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The entity operation
- Returns:
- A completion stage that emits the entity
 
- 
updateAll@NonNull public <T> @NonNull CompletableFuture<Iterable<T>> updateAll(@NonNull @NonNull UpdateBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsUpdates the entities for the given operation.- Specified by:
- updateAllin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The operation
- Returns:
- The updated entities
 
- 
delete@NonNull public <T> @NonNull CompletableFuture<Number> delete(@NonNull @NonNull DeleteOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsDeletes the entity.- Specified by:
- deletein interface- AsyncRepositoryOperations
- 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 CompletableFuture<Iterable<T>> persistAll(@NonNull @NonNull InsertBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsPersist all the given entities.- Specified by:
- persistAllin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The batch operation
- Returns:
- The entities, possibly mutated
 
- 
executeUpdate@NonNull public @NonNull CompletableFuture<Number> executeUpdate(@NonNull @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 interface- AsyncRepositoryOperations
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A completion that emits a boolean true if successful
 
- 
executeDeleteDescription 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 interface- AsyncRepositoryOperations
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A completion that emits a boolean true if successful
 
- 
deleteAll@NonNull public <T> @NonNull CompletableFuture<Number> deleteAll(@NonNull @NonNull DeleteBatchOperation<T> operation) Description copied from interface:AsyncRepositoryOperationsDeletes all the entities of the given type.- Specified by:
- deleteAllin interface- AsyncRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The batch operation
- Returns:
- A completion that emits a boolean true if successful
 
- 
findPageDescription copied from interface:AsyncRepositoryOperationsFind a page for the given entity and pageable.- Specified by:
- findPagein interface- AsyncRepositoryOperations
- Type Parameters:
- R- The entity generic type
- Parameters:
- pagedQuery- The paged query
- Returns:
- The page type
 
 
-