Class PythonCoercion.AsyncMemberAdapter

java.lang.Object
io.micronaut.context.python.PythonCoercion.AsyncMemberAdapter
Enclosing class:
PythonCoercion

public static final class PythonCoercion.AsyncMemberAdapter extends Object
Adapter invoked from Python async member facades.
Since:
5.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Object
    adapt(org.graalvm.polyglot.Context context, @Nullable Object value)
    Adapt host values returned from Java members to values Python async code can consume.
    @Nullable org.graalvm.polyglot.Value
    adaptAwaitable(org.graalvm.polyglot.Context context, @Nullable Object value)
    Adapt a host async value returned from a Java member to a Python awaitable.
    @Nullable org.graalvm.polyglot.Value
    adaptAwaitable(org.graalvm.polyglot.Context context, @Nullable Object value, @Nullable PythonReactiveContext reactiveContext)
    Adapt a host async value returned from a Java member to a Python awaitable; a publisher is subscribed within the reactive context of the awaiting coroutine, so the Reactor context of the subscriber that started the coroutine (a reactive transaction status, for instance) reaches it.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • adapt

      public @Nullable Object adapt(org.graalvm.polyglot.Context context, @Nullable Object value)
      Adapt host values returned from Java members to values Python async code can consume.
      Parameters:
      context - The target Python context.
      value - The host value.
      Returns:
      The adapted value.
    • adaptAwaitable

      public @Nullable org.graalvm.polyglot.Value adaptAwaitable(org.graalvm.polyglot.Context context, @Nullable Object value)
      Adapt a host async value returned from a Java member to a Python awaitable.
      Parameters:
      context - The target Python context.
      value - The host value.
      Returns:
      The adapted Python awaitable, or null when the value is not async.
    • adaptAwaitable

      public @Nullable org.graalvm.polyglot.Value adaptAwaitable(org.graalvm.polyglot.Context context, @Nullable Object value, @Nullable PythonReactiveContext reactiveContext)
      Adapt a host async value returned from a Java member to a Python awaitable; a publisher is subscribed within the reactive context of the awaiting coroutine, so the Reactor context of the subscriber that started the coroutine (a reactive transaction status, for instance) reaches it.
      Parameters:
      context - The target Python context.
      value - The host value.
      reactiveContext - The reactive context of the coroutine, or null for none.
      Returns:
      The adapted Python awaitable, or null when the value is not async.