Class ExecutorReactiveOperations
java.lang.Object
io.micronaut.data.runtime.operations.ExecutorReactiveOperations
- All Implemented Interfaces:
- io.micronaut.core.convert.ConversionServiceProvider,- ReactiveRepositoryOperations
An implementation of 
ReactiveRepositoryOperations that delegates to a blocking operations and specified Executor.
 This can be used in absence of true reactive support at the driver level an allows composing blocking operations within reactive flows.
 If a backing implementation provides a reactive API then the backing implementation should not use this class and instead directly implement the ReactiveRepositoryOperations interface.
- Since:
- 1.0.0
- Author:
- graemerocher
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionExecutorReactiveOperations(@NonNull RepositoryOperations datastore, @NonNull Executor executor, DataConversionService dataConversionService) Default constructor.ExecutorReactiveOperations(@NonNull ExecutorAsyncOperations asyncOperations, DataConversionService dataConversionService) Default constructor.
- 
Method SummaryModifier and TypeMethodDescription<T> @NonNull org.reactivestreams.Publisher<Long>count(PagedQuery<T> pagedQuery) Counts all results for the given query.<T> @NonNull org.reactivestreams.Publisher<Number>delete(@NonNull DeleteOperation<T> operation) Deletes the entity.<T> @NonNull org.reactivestreams.Publisher<Number>deleteAll(@NonNull DeleteBatchOperation<T> operation) Deletes all the entities of the given type.@NonNull org.reactivestreams.Publisher<Number>executeUpdate(@NonNull PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values.<T> org.reactivestreams.Publisher<Boolean>exists(@NonNull PreparedQuery<T, Boolean> preparedQuery) Check with an record exists for the given query.<T,R> @NonNull org.reactivestreams.Publisher<R> findAll(@NonNull PreparedQuery<T, R> preparedQuery) Finds all results for the given query.<T> @NonNull org.reactivestreams.Publisher<T>findAll(PagedQuery<T> pagedQuery) Finds all results for the given query.<T,R> @NonNull org.reactivestreams.Publisher<R> findOne(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull org.reactivestreams.Publisher<T>Find one by ID.<T,R> @NonNull org.reactivestreams.Publisher<R> findOptional(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> @NonNull org.reactivestreams.Publisher<T>findOptional(@NonNull Class<T> type, @NonNull Object id) Find one by ID.<R> @NonNull org.reactivestreams.Publisher<Page<R>>findPage(@NonNull PagedQuery<R> pagedQuery) Find a page for the given entity and pageable.io.micronaut.core.convert.ConversionService<T> @NonNull org.reactivestreams.Publisher<T>persist(@NonNull InsertOperation<T> entity) Persist the entity returning a possibly new entity.<T> @NonNull org.reactivestreams.Publisher<T>persistAll(@NonNull InsertBatchOperation<T> operation) Persist all the given entities.<T> @NonNull org.reactivestreams.Publisher<T>update(@NonNull UpdateOperation<T> operation) Updates the entity returning a possibly new entity.<T> @NonNull org.reactivestreams.Publisher<T>updateAll(@NonNull UpdateBatchOperation<T> operation) Updates the entities for the given operation.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.data.operations.reactive.ReactiveRepositoryOperationsexecuteDelete
- 
Constructor Details- 
ExecutorReactiveOperationspublic ExecutorReactiveOperations(@NonNull @NonNull RepositoryOperations datastore, @NonNull @NonNull Executor executor, DataConversionService dataConversionService) Default constructor.- Parameters:
- datastore- The target operations
- executor- The executor to use.
- dataConversionService- The data conversion service
 
- 
ExecutorReactiveOperationspublic ExecutorReactiveOperations(@NonNull @NonNull ExecutorAsyncOperations asyncOperations, DataConversionService dataConversionService) Default constructor.- Parameters:
- asyncOperations- The instance operations instance
- dataConversionService- The data conversion service
 
 
- 
- 
Method Details- 
findOne@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> findOne(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:ReactiveRepositoryOperationsFind one by ID.- Specified by:
- findOnein interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- type- The type
- id- The id
- Returns:
- A publisher that emits the result
 
- 
existspublic <T> org.reactivestreams.Publisher<Boolean> exists(@NonNull @NonNull PreparedQuery<T, Boolean> preparedQuery) Description copied from interface:ReactiveRepositoryOperationsCheck with an record exists for the given query.- Specified by:
- existsin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The declaring type
- Parameters:
- preparedQuery- The query
- Returns:
- True if it exists
 
- 
findOne@NonNull public <T,R> @NonNull org.reactivestreams.Publisher<R> findOne(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:ReactiveRepositoryOperationsFind one by Query.- Specified by:
- findOnein interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic resultType
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A publisher that emits the result
 
- 
findOptional@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> findOptional(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id) Description copied from interface:ReactiveRepositoryOperationsFind one by ID.- Specified by:
- findOptionalin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- type- The type
- id- The id
- Returns:
- A publisher that emits zero or one result
 
- 
findOptional@NonNull public <T,R> @NonNull org.reactivestreams.Publisher<R> findOptional(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:ReactiveRepositoryOperationsFind one by Query.- Specified by:
- findOptionalin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic resultType
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A publisher that emits the zero or one result
 
- 
findAllDescription copied from interface:ReactiveRepositoryOperationsFinds all results for the given query.- Specified by:
- findAllin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- pagedQuery- The paged query
- Returns:
- A publisher that emits the results
 
- 
countDescription copied from interface:ReactiveRepositoryOperationsCounts all results for the given query.- Specified by:
- countin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- pagedQuery- The paged query
- Returns:
- A publisher that emits the count as a long
 
- 
findPage@NonNull public <R> @NonNull org.reactivestreams.Publisher<Page<R>> findPage(@NonNull @NonNull PagedQuery<R> pagedQuery) Description copied from interface:ReactiveRepositoryOperationsFind a page for the given entity and pageable.- Specified by:
- findPagein interface- ReactiveRepositoryOperations
- Type Parameters:
- R- The entity generic type
- Parameters:
- pagedQuery- The paged query
- Returns:
- The page type
 
- 
findAll@NonNull public <T,R> @NonNull org.reactivestreams.Publisher<R> findAll(@NonNull @NonNull PreparedQuery<T, R> preparedQuery) Description copied from interface:ReactiveRepositoryOperationsFinds all results for the given query.- Specified by:
- findAllin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The entity type
- R- The result type
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A publisher that emits an iterable with all results
 
- 
persist@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> persist(@NonNull @NonNull InsertOperation<T> entity) Description copied from interface:ReactiveRepositoryOperationsPersist the entity returning a possibly new entity.- Specified by:
- persistin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- entity- The entity operation
- Returns:
- A publisher that emits the entity
 
- 
update@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> update(@NonNull @NonNull UpdateOperation<T> operation) Description copied from interface:ReactiveRepositoryOperationsUpdates the entity returning a possibly new entity.- Specified by:
- updatein interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The entity operation
- Returns:
- A publisher that emits the entity
 
- 
updateAll@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> updateAll(@NonNull @NonNull UpdateBatchOperation<T> operation) Description copied from interface:ReactiveRepositoryOperationsUpdates the entities for the given operation.- Specified by:
- updateAllin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The operation
- Returns:
- The updated entities
 
- 
persistAll@NonNull public <T> @NonNull org.reactivestreams.Publisher<T> persistAll(@NonNull @NonNull InsertBatchOperation<T> operation) Description copied from interface:ReactiveRepositoryOperationsPersist all the given entities.- Specified by:
- persistAllin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The batch operation
- Returns:
- The entities, possibly mutated
 
- 
executeUpdate@NonNull public @NonNull org.reactivestreams.Publisher<Number> executeUpdate(@NonNull @NonNull PreparedQuery<?, Number> preparedQuery) Description copied from interface:ReactiveRepositoryOperationsExecutes 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- ReactiveRepositoryOperations
- Parameters:
- preparedQuery- The prepared query
- Returns:
- A publisher that emits a boolean true if the update was successful
 
- 
delete@NonNull public <T> @NonNull org.reactivestreams.Publisher<Number> delete(@NonNull @NonNull DeleteOperation<T> operation) Description copied from interface:ReactiveRepositoryOperationsDeletes the entity.- Specified by:
- deletein interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The batch operation
- Returns:
- A publisher that emits the number of entities deleted
 
- 
deleteAll@NonNull public <T> @NonNull org.reactivestreams.Publisher<Number> deleteAll(@NonNull @NonNull DeleteBatchOperation<T> operation) Description copied from interface:ReactiveRepositoryOperationsDeletes all the entities of the given type.- Specified by:
- deleteAllin interface- ReactiveRepositoryOperations
- Type Parameters:
- T- The generic type
- Parameters:
- operation- The batch operation
- Returns:
- A publisher that emits the number of entities deleted
 
- 
getConversionServicepublic io.micronaut.core.convert.ConversionService getConversionService()- Specified by:
- getConversionServicein interface- io.micronaut.core.convert.ConversionServiceProvider
 
 
-