Package: org.apache.groovy.runtime.async

## [Java] Class FlowPublisherAdapter

- org.apache.groovy.runtime.async.FlowPublisherAdapter

- All Implemented Interfaces and Traits:
    AwaitableAdapter

      public final class FlowPublisherAdapter
      extends Object
      implements AwaitableAdapter

  Adapter for Publisher, the JDK's built-in Reactive Streams type. Enables:

  - `await publisher` — completes with the first `onNext` value, then cancels the subscription. Completes with `null` if the publisher signals `onComplete` without emitting.
  - `for await (item in publisher)` — iterates over emitted values with bounded backpressure (see DEFAULT_BATCH_SIZE).

  Conformance:

  - Reactive Streams §2.13: `onNext(null)` is treated as a protocol violation and surfaced as a NullPointerException.
  - A second `onSubscribe` after the first is cancelled.
  - Signals after a terminal `onError`/`onComplete` are ignored.

  This adapter is registered as the lowest-priority built-in (after SPI-loaded adapters) so framework-specific adapters (Reactor, RxJava) take precedence for their concrete types.

  Since:
    6.0.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static int` | `DEFAULT_BATCH_SIZE` | Default request batch size for `for await` iteration.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `supportsAwaitable(Class<?> type)`
    `` | `public boolean` | `supportsIterable(Class<?> type)`
    `<T>` | `public Awaitable<T>` | `toAwaitable(Object source)`
    `<T>` | `public Iterable<T>` | `toIterable(Object source)`

  - ### Inherited Methods Summary

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

- - ### Field Detail

    - #### public static final int DEFAULT_BATCH_SIZE

      Default request batch size for `for await` iteration. Chosen as a compromise between throughput (larger = fewer `request()` calls) and memory (larger = bigger in-flight buffer). Override per-call by wrapping with a custom adapter if needed.

  - ### Method Detail

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

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

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

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