Interface ContextualExecutor

All Superinterfaces:
Executor

public interface ContextualExecutor extends Executor
Facility for contextual execution.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    execute(Runnable runner)
     
    default <T> T
    execute(Callable<T> caller)
    Executes the specified caller with a given context.
    default <V1, V2> void
    execute(BiConsumer<V1,V2> consumer, V1 value1, V2 value2)
    Executes the specified runner.
    default <V1, V2, R>
    R
    execute(BiFunction<V1,V2,R> function, V1 value1, V2 value2)
    Executes the specified supplier with a given context.
    default <V> void
    execute(Consumer<V> consumer, V value)
    Executes the specified consumer using the specified value.
    default <V, R> R
    execute(Function<V,R> function, V value)
    Executes the specified supplier with a given context.
    default <T> T
    execute(Supplier<T> supplier)
    Executes the specified supplier with a given context.
    <T, V, E extends Exception>
    void
    execute(org.wildfly.common.function.ExceptionBiConsumer<T,V,E> consumer, T value1, V value2)
    Executes the specified runner.
    <V1, V2, R, E extends Exception>
    R
    execute(org.wildfly.common.function.ExceptionBiFunction<V1,V2,R,E> function, V1 value1, V2 value2)
    Executes the specified supplier with a given context.
    <V, E extends Exception>
    void
    execute(org.wildfly.common.function.ExceptionConsumer<V,E> consumer, V value)
    Executes the specified consumer using the specified value.
    <V, R, E extends Exception>
    R
    execute(org.wildfly.common.function.ExceptionFunction<V,R,E> function, V value)
    Executes the specified supplier with a given context.
    <E extends Exception>
    void
    execute(org.wildfly.common.function.ExceptionRunnable<E> runner)
    Executes the specified runner.
    <T, E extends Exception>
    T
    execute(org.wildfly.common.function.ExceptionSupplier<T,E> supplier)
    Executes the specified supplier with a given context.
     
  • Method Details

    • execute

      default void execute(Runnable runner)
      Specified by:
      execute in interface Executor
    • execute

      <E extends Exception> void execute(org.wildfly.common.function.ExceptionRunnable<E> runner) throws E
      Executes the specified runner.
      Type Parameters:
      E - the exception type
      Parameters:
      runner - a runnable task
      Throws:
      E - if execution fails
    • execute

      default <V> void execute(Consumer<V> consumer, V value)
      Executes the specified consumer using the specified value.
      Type Parameters:
      V - the consumed value type
      Parameters:
      consumer - a consumer
      value - the consumed value
    • execute

      <V, E extends Exception> void execute(org.wildfly.common.function.ExceptionConsumer<V,E> consumer, V value) throws E
      Executes the specified consumer using the specified value.
      Type Parameters:
      V - the consumed value type
      E - the exception type
      Parameters:
      consumer - a consumer
      value - the consumed value
      Throws:
      E - if execution fails
    • execute

      default <V1, V2> void execute(BiConsumer<V1,V2> consumer, V1 value1, V2 value2)
      Executes the specified runner.
      Type Parameters:
      V1 - the 1st consumed value type
      V2 - the 2nd consumed value type
      Parameters:
      consumer - a consumer
      value1 - the 1st consumed value
      value2 - the 2nd consumed value
    • execute

      <T, V, E extends Exception> void execute(org.wildfly.common.function.ExceptionBiConsumer<T,V,E> consumer, T value1, V value2) throws E
      Executes the specified runner.
      Type Parameters:
      T - the 1st consumed value type
      V - the 2nd consumed value type
      E - the exception type
      Parameters:
      consumer - a consumer
      value1 - the 1st consumed value
      value2 - the 2nd consumed value
      Throws:
      E - if execution fails
    • execute

      default <T> T execute(Callable<T> caller) throws Exception
      Executes the specified caller with a given context.
      Type Parameters:
      T - the return type
      Parameters:
      caller - a callable task
      Returns:
      the result of the caller
      Throws:
      Exception - if execution fails
    • execute

      default <T> T execute(Supplier<T> supplier)
      Executes the specified supplier with a given context.
      Type Parameters:
      T - the return type
      Parameters:
      supplier - a supplier task
      Returns:
      the result of the supplier
    • execute

      <T, E extends Exception> T execute(org.wildfly.common.function.ExceptionSupplier<T,E> supplier) throws E
      Executes the specified supplier with a given context.
      Type Parameters:
      T - the return type
      E - the exception type
      Parameters:
      supplier - a supplier task
      Returns:
      the result of the supplier
      Throws:
      E - if execution fails
    • execute

      default <V, R> R execute(Function<V,R> function, V value)
      Executes the specified supplier with a given context.
      Type Parameters:
      V - the function parameter type
      R - the function return type
      Parameters:
      function - a function to apply
      value - the function parameter
      Returns:
      the result of the function
    • execute

      <V, R, E extends Exception> R execute(org.wildfly.common.function.ExceptionFunction<V,R,E> function, V value) throws E
      Executes the specified supplier with a given context.
      Type Parameters:
      V - the function parameter type
      R - the function return type
      E - the exception type
      Parameters:
      function - a function to apply
      value - the function parameter
      Returns:
      the result of the function
      Throws:
      E - if execution fails
    • execute

      default <V1, V2, R> R execute(BiFunction<V1,V2,R> function, V1 value1, V2 value2)
      Executes the specified supplier with a given context.
      Type Parameters:
      V1 - the 1st function parameter type
      V2 - the 2nd function parameter type
      R - the function return type
      Parameters:
      function - a function to apply
      value1 - the 1st function parameter
      value2 - the 2nd function parameter
      Returns:
      the result of the function
    • execute

      <V1, V2, R, E extends Exception> R execute(org.wildfly.common.function.ExceptionBiFunction<V1,V2,R,E> function, V1 value1, V2 value2) throws E
      Executes the specified supplier with a given context.
      Type Parameters:
      V1 - the 1st function parameter type
      V2 - the 2nd function parameter type
      R - the function return type
      E - the exception type
      Parameters:
      function - a function to apply
      value1 - the 1st function parameter
      value2 - the 2nd function parameter
      Returns:
      the result of the function
      Throws:
      E - if execution fails
    • withContextProvider

      static ContextualExecutor withContextProvider(Supplier<Context> provider)