Package: org.apache.groovy.rxjava

## [Java] Class RxJavaAwaitableAdapter

- org.apache.groovy.rxjava.RxJavaAwaitableAdapter

- All Implemented Interfaces and Traits:
    AwaitableAdapter

      public class RxJavaAwaitableAdapter
      extends Object
      implements AwaitableAdapter

  Adapter for RxJava 3 types, enabling:

  - `await single` — awaits a Single
  - `await maybe` — awaits a Maybe (nullable result)
  - `await completable` — awaits a Completable
  - `for await (item in observable)` — iterates over an Observable
  - `for await (item in flowable)` — iterates over a Flowable

  Auto-discovered via ServiceLoader when `groovy-rxjava` is on the classpath.

  Since:
    6.0.0

- - ### Methods Summary

    Methods
    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.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public boolean supportsAwaitable(Class<?> type)

      Returns whether the supplied type can be awaited as an RxJava single-result source.

      Parameters:
        `type` - candidate type to inspect
      Returns:
        `true` if `type` is a Single, Maybe, Completable, or one of their subtypes

    - #### public boolean supportsIterable(Class<?> type)

      Returns whether the supplied type can be exposed as an iterable RxJava multi-result source.

      Parameters:
        `type` - candidate type to inspect
      Returns:
        `true` if `type` is an Observable, Flowable, or one of their subtypes

    - #### <T> public Awaitable<T> toAwaitable(Object source)

      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`.

      throws:
        IllegalArgumentException if `source` is not a supported RxJava type
      Parameters:
        `source` - source object to adapt
      Type Parameters:
        `T` - awaited value type
      Returns:
        awaitable representation of the supplied source

    - #### <T> public Iterable<T> toIterable(Object source)

      Converts supported RxJava multi-result sources into blocking iterables suitable for `for await` consumption.

      throws:
        IllegalArgumentException if `source` is not a supported RxJava type
      Parameters:
        `source` - source object to adapt
      Type Parameters:
        `T` - iterated element type
      Returns:
        iterable representation of the supplied Observable or Flowable