Class BiFunctionWithContext<IN1,IN2,OUT>
- java.lang.Object
-
- nl.talsmasoftware.context.delegation.Wrapper<T>
-
- nl.talsmasoftware.context.delegation.WrapperWithContext<T>
-
- nl.talsmasoftware.context.functions.BiFunctionWithContext<IN1,IN2,OUT>
-
- All Implemented Interfaces:
BiFunction<IN1,IN2,OUT>
- Direct Known Subclasses:
BinaryOperatorWithContext
public class BiFunctionWithContext<IN1,IN2,OUT> extends WrapperWithContext<T> implements BiFunction<IN1,IN2,OUT>
A wrapper forBiFunctionthatreactivates a context snapshotbefore calling a delegate.- Author:
- Sjoerd Talsma
-
-
Field Summary
Fields Modifier and Type Field Description protected Consumer<ContextSnapshot>contextSnapshotConsumerThe context snapshot consumer to provide a new snapshot to after the function is completed, may benull.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBiFunctionWithContext(Supplier<ContextSnapshot> supplier, BiFunction<IN1,IN2,OUT> delegate, Consumer<ContextSnapshot> consumer)BiFunctionWithContext(ContextSnapshot snapshot, BiFunction<IN1,IN2,OUT> delegate)BiFunctionWithContext(ContextSnapshot snapshot, BiFunction<IN1,IN2,OUT> delegate, Consumer<ContextSnapshot> consumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <V> BiFunction<IN1,IN2,V>andThen(Function<? super OUT,? extends V> after)OUTapply(IN1 in1, IN2 in2)protected Optional<Consumer<ContextSnapshot>>consumer()Deprecated.The functional wrappers currently no longer use this method.-
Methods inherited from class nl.talsmasoftware.context.delegation.WrapperWithContext
equals, hashCode, snapshot, toString
-
Methods inherited from class nl.talsmasoftware.context.delegation.Wrapper
delegate, nonNullDelegate
-
-
-
-
Field Detail
-
contextSnapshotConsumer
protected final Consumer<ContextSnapshot> contextSnapshotConsumer
The context snapshot consumer to provide a new snapshot to after the function is completed, may benull.
-
-
Constructor Detail
-
BiFunctionWithContext
public BiFunctionWithContext(ContextSnapshot snapshot, BiFunction<IN1,IN2,OUT> delegate)
-
BiFunctionWithContext
public BiFunctionWithContext(ContextSnapshot snapshot, BiFunction<IN1,IN2,OUT> delegate, Consumer<ContextSnapshot> consumer)
-
BiFunctionWithContext
protected BiFunctionWithContext(Supplier<ContextSnapshot> supplier, BiFunction<IN1,IN2,OUT> delegate, Consumer<ContextSnapshot> consumer)
-
-
Method Detail
-
apply
public OUT apply(IN1 in1, IN2 in2)
- Specified by:
applyin interfaceBiFunction<IN1,IN2,OUT>
-
andThen
public <V> BiFunction<IN1,IN2,V> andThen(Function<? super OUT,? extends V> after)
- Specified by:
andThenin interfaceBiFunction<IN1,IN2,OUT>
-
consumer
@Deprecated protected Optional<Consumer<ContextSnapshot>> consumer()
Deprecated.The functional wrappers currently no longer use this method.- Returns:
- An optional post-action consumer to receive a new context snapshot taken after the action.
-
-