Package org.apache.groovy.reactor
Class ReactorAwaitableAdapter
java.lang.Object
org.apache.groovy.reactor.ReactorAwaitableAdapter
- All Implemented Interfaces:
AwaitableAdapter
Adapter for Project Reactor types, enabling:
await mono— awaits a single-valueMonofor await (item in flux)— iterates over aFlux
Auto-discovered via ServiceLoader when groovy-reactor
is on the classpath.
- Since:
- 6.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleansupportsAwaitable(Class<?> type) Returns whether the supplied type can be awaited as a Reactor single-result source.booleansupportsIterable(Class<?> type) Returns whether the supplied type can be exposed as an iterable Reactor multi-result source.<T> Awaitable<T>toAwaitable(Object source) Converts aMonointo anAwaitablebacked by the mono's future view.<T> Iterable<T>toIterable(Object source)
-
Constructor Details
-
ReactorAwaitableAdapter
public ReactorAwaitableAdapter()
-
-
Method Details
-
supportsAwaitable
Returns whether the supplied type can be awaited as a Reactor single-result source.- Specified by:
supportsAwaitablein interfaceAwaitableAdapter- Parameters:
type- candidate type to inspect- Returns:
trueiftypeis aMonoor one of its subtypes
-
toAwaitable
Converts aMonointo anAwaitablebacked by the mono's future view.- Specified by:
toAwaitablein interfaceAwaitableAdapter- Type Parameters:
T- awaited value type- Parameters:
source- source object to adapt- Returns:
- awaitable representation of the supplied
Mono - Throws:
IllegalArgumentException- ifsourceis not aMono
-
supportsIterable
Returns whether the supplied type can be exposed as an iterable Reactor multi-result source.- Specified by:
supportsIterablein interfaceAwaitableAdapter- Parameters:
type- candidate type to inspect- Returns:
trueiftypeis aFluxor one of its subtypes
-
toIterable
- Specified by:
toIterablein interfaceAwaitableAdapter- Type Parameters:
T- iterated element type- Parameters:
source- source object to adapt- Returns:
- iterable view of the supplied
Flux - Throws:
IllegalArgumentException- ifsourceis not aFlux
-