Class DslExtensionState<R>

Type Parameters:
R - The result type to expect from functions applied to extended contexts.

public final class DslExtensionState<R> extends Object
A utility class holding the state of the extension contexts found in several DSLs.
  • Constructor Details

    • DslExtensionState

      public DslExtensionState()
  • Method Details

    • returnIfSupported

      public static <E> E returnIfSupported(Object extension, Optional<E> extendedContextOptional)
    • ifSupported

      public <E> void ifSupported(Object extension, Optional<E> extendedContextOptional, Function<E,? extends R> extendedContextFunction)
    • orElse

      public <T> R orElse(T defaultContext, Consumer<T> defaultContextConsumer)
    • orElse

      public <T> R orElse(T defaultContext, Function<T,? extends R> defaultContextFunction)
    • orElseFail

      public R orElseFail()