Interface Contextualizer
public interface Contextualizer
Facility for creating contextual tasks.
- Author:
- Paul Ferraro
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Contextualizercomposite(Iterable<Contextualizer> contextualizers) Creates a composite contextualizer from multiple contextualizers.contextualize(Runnable runner) Decorates the specified runner with a given context.<T> Callable<T> contextualize(Callable<T> caller) Decorates the specified caller with a given context.<V1,V2> BiConsumer <V1, V2> contextualize(BiConsumer<V1, V2> consumer) Decorates the specified consumer with a given context.<V1,V2, R> BiFunction <V1, V2, R> contextualize(BiFunction<V1, V2, R> function) Decorates the specified function with a given context.<V> Consumer<V> contextualize(Consumer<V> consumer) Decorates the specified consumer with a given context.<V,R> Function <V, R> contextualize(Function<V, R> function) Decorates the specified function with a given context.<T> Supplier<T> contextualize(Supplier<T> supplier) Decorates the specified supplier with a given context.static <C> ContextualizerwithContextProvider(Supplier<Context<C>> provider) Creates a contextualizer from the specified context provider.
-
Field Details
-
NONE
A pass-through contextualizer.
-
-
Method Details
-
contextualize
-
contextualize
-
contextualize
-
contextualize
-
contextualize
Decorates the specified consumer with a given context.- Type Parameters:
V1- the 1st consumed value typeV2- the 2nd consumed value type- Parameters:
consumer- a consumer- Returns:
- a contextual consumer
-
contextualize
-
contextualize
Decorates the specified function with a given context.- Type Parameters:
V1- the 1st function parameter typeV2- the 2nd function parameter typeR- the function return type- Parameters:
function- a function- Returns:
- a contextual function
-
withContextProvider
Creates a contextualizer from the specified context provider.- Type Parameters:
C- the context type- Parameters:
provider- a supplier of a context- Returns:
- a contextualizer using the specified context provider.
-
composite
Creates a composite contextualizer from multiple contextualizers.- Parameters:
contextualizers- a list of contextualizers.- Returns:
- a composite contextualizer
-