Package org.apache.groovy.runtime

# Class MonadicCarrierRegistry

java.lang.Object
org.apache.groovy.runtime.MonadicCarrierRegistry

@Incubating public final class MonadicCarrierRegistry extends Object
The standard carrier allow-list for monadic comprehensions: stdlib and Groovy-core carriers whose bind/map method names diverge from the structural `flatMap`/`map` convention.

Carriers known by `Class` (always on the classpath) are matched by `isInstance`; carriers known only by name — third-party libraries that Groovy must not depend on, such as Functional Java and Vavr — are matched by walking the value's type hierarchy and comparing fully-qualified names. The `CompletionStage` entry covers `CompletableFuture`; the `Awaitable` entry covers `DataflowVariable`; the Functional Java entries use that library's `bind`/`map` convention; the Vavr entries use the structural `flatMap`/`map` convention.

Since:
  6.0.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `MonadicCarrierRegistry.Entry`
  One `Class`-keyed allow-list row.
  `static final class`
  `MonadicCarrierRegistry.NamedEntry`
  One name-keyed allow-list row, for carriers Groovy must not depend on.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<MonadicCarrierRegistry.Entry>`
  `entries()`
  The `Class`-keyed allow-list, exposed for the type-checking extension.
  `static String[]`
  `lookupBindMap(Object carrier)`
  The `[bind, map]` method names for the given carrier value, or `null` if it is not on either allow-list.
  `static List<MonadicCarrierRegistry.NamedEntry>`
  `namedEntries()`
  The name-keyed allow-list, exposed for the type-checking extension.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### entries

    public static List<MonadicCarrierRegistry.Entry> entries()
    The `Class`-keyed allow-list, exposed for the type-checking extension.

  - ### namedEntries

    public static List<MonadicCarrierRegistry.NamedEntry> namedEntries()
    The name-keyed allow-list, exposed for the type-checking extension.

  - ### lookupBindMap

    public static String[] lookupBindMap(Object carrier)
    The `[bind, map]` method names for the given carrier value, or `null` if it is not on either allow-list. `Class` entries are tried first (`isInstance`), then name entries against the value's full type hierarchy (so `fj.data.Some` matches `fj.data.Option`).