public class RxJavaAwaitableAdapter
extends Object
implements AwaitableAdapter
Adapter for RxJava 3 types, enabling:
await single — awaits a Singleawait maybe — awaits a Maybe (nullable result)await completable — awaits a Completablefor await (item in observable) — iterates over an Observablefor await (item in flowable) — iterates over a Flowable
Auto-discovered via ServiceLoader when groovy-rxjava
is on the classpath.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
supportsAwaitable(Class<?> type)Returns whether the supplied type can be awaited as an RxJava single-result source. |
|
public boolean |
supportsIterable(Class<?> type)Returns whether the supplied type can be exposed as an iterable RxJava multi-result source. |
<T> |
public Awaitable<T> |
toAwaitable(Object source)Converts supported RxJava single-result sources into an Awaitable. |
<T> |
public Iterable<T> |
toIterable(Object source)Converts supported RxJava multi-result sources into blocking iterables suitable for for await consumption. |
Returns whether the supplied type can be awaited as an RxJava single-result source.
type - candidate type to inspecttrue if type is a Single, Maybe,
Completable, or one of their subtypesReturns whether the supplied type can be exposed as an iterable RxJava multi-result source.
type - candidate type to inspecttrue if type is an Observable,
Flowable, or one of their subtypes Converts supported RxJava single-result sources into an Awaitable.
A Single yields its item, a Maybe yields its item or
null when empty, and a Completable completes with
null.
source is not a supported RxJava typesource - source object to adaptT - awaited value type Converts supported RxJava multi-result sources into blocking iterables
suitable for for await consumption.
source is not a supported RxJava typesource - source object to adaptT - iterated element type