Package: org.apache.groovy.reactor

## [Java] Class ReactorAwaitableAdapter

- org.apache.groovy.reactor.ReactorAwaitableAdapter

- All Implemented Interfaces and Traits:
    AwaitableAdapter

      public class ReactorAwaitableAdapter
      extends Object
      implements AwaitableAdapter

  Adapter for Project Reactor types, enabling:

  - `await mono` — awaits a single-value Mono
  - `for await (item in flux)` — iterates over a Flux

  Auto-discovered via ServiceLoader when `groovy-reactor` 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 a Reactor single-result source.
    `` | `public boolean` | `supportsIterable(Class<?> type)` Returns whether the supplied type can be exposed as an iterable Reactor multi-result source.
    `<T>` | `public Awaitable<T>` | `toAwaitable(Object source)` Converts a Mono into an Awaitable backed by the mono's {@linkplain Mono#toFuture() future view}.
    `<T>` | `public Iterable<T>` | `toIterable(Object source)` Converts a Flux into a blocking Iterable 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 a Reactor single-result source.

      Parameters:
        `type` - candidate type to inspect
      Returns:
        `true` if `type` is a Mono or one of its subtypes

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

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

      Parameters:
        `type` - candidate type to inspect
      Returns:
        `true` if `type` is a Flux or one of its subtypes

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

      Converts a Mono into an Awaitable backed by the mono's {@linkplain Mono#toFuture() future view}.

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

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

      Converts a Flux into a blocking Iterable suitable for `for await` consumption.

      throws:
        IllegalArgumentException if `source` is not a Flux
      Parameters:
        `source` - source object to adapt
      Type Parameters:
        `T` - iterated element type
      Returns:
        iterable view of the supplied Flux