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
  • 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).