Class ScopedValueInjectionContextScope

java.lang.Object
dev.derklaro.aerogel.scopedvalue.ScopedValueInjectionContextScope
All Implemented Interfaces:
dev.derklaro.aerogel.internal.context.scope.InjectionContextScope

@API(status=INTERNAL, since="3.0") final class ScopedValueInjectionContextScope extends Object implements dev.derklaro.aerogel.internal.context.scope.InjectionContextScope
ScopedValueInjectionContextScope relies on preview features of the Java platform:
  • ScopedValueInjectionContextScope refers to one or more preview APIs: Carrier, ScopedValue<T>.
Programs can only use ScopedValueInjectionContextScope when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A context scope that uses scope value carries to set the scope during injection.
Since:
3.0
  • Field Details

    • context

      private final dev.derklaro.aerogel.internal.context.InjectionContext context
    • contextScopeCarrier

      private final ScopedValue.CarrierPREVIEW contextScopeCarrier
  • Constructor Details

    • ScopedValueInjectionContextScope

      public ScopedValueInjectionContextScope(@NotNull @NotNull dev.derklaro.aerogel.internal.context.InjectionContext context, @NotNull @NotNull ScopedValuePREVIEW<dev.derklaro.aerogel.internal.context.scope.InjectionContextScope> scopeScopedValue)
      Constructs a new injection context scope for the given context and scoped value.
      Parameters:
      context - the context that is bound to this scope.
      scopeScopedValue - the scoped value for the injection scopes.
  • Method Details

    • context

      @NotNull public @NotNull dev.derklaro.aerogel.internal.context.InjectionContext context()
      Specified by:
      context in interface dev.derklaro.aerogel.internal.context.scope.InjectionContextScope
    • executeScoped

      public <T> @UnknownNullability T executeScoped(@NotNull @NotNull Supplier<T> operation)
      Specified by:
      executeScoped in interface dev.derklaro.aerogel.internal.context.scope.InjectionContextScope