Class BiConsumerWithContext<T,U>
- java.lang.Object
-
- nl.talsmasoftware.context.delegation.Wrapper<T>
-
- nl.talsmasoftware.context.delegation.WrapperWithContext<T>
-
- nl.talsmasoftware.context.functions.BiConsumerWithContext<T,U>
-
- All Implemented Interfaces:
BiConsumer<T,U>
public class BiConsumerWithContext<T,U> extends WrapperWithContext<T> implements BiConsumer<T,U>
A wrapper forBiConsumerthatreactivates 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 protectedBiConsumerWithContext(Supplier<ContextSnapshot> supplier, BiConsumer<T,U> delegate, Consumer<ContextSnapshot> consumer)BiConsumerWithContext(ContextSnapshot snapshot, BiConsumer<T,U> delegate)BiConsumerWithContext(ContextSnapshot snapshot, BiConsumer<T,U> delegate, Consumer<ContextSnapshot> consumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(T t, U u)BiConsumer<T,U>andThen(BiConsumer<? super T,? super U> after)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
-
BiConsumerWithContext
public BiConsumerWithContext(ContextSnapshot snapshot, BiConsumer<T,U> delegate)
-
BiConsumerWithContext
public BiConsumerWithContext(ContextSnapshot snapshot, BiConsumer<T,U> delegate, Consumer<ContextSnapshot> consumer)
-
BiConsumerWithContext
protected BiConsumerWithContext(Supplier<ContextSnapshot> supplier, BiConsumer<T,U> delegate, Consumer<ContextSnapshot> consumer)
-
-
Method Detail
-
andThen
public BiConsumer<T,U> andThen(BiConsumer<? super T,? super U> after)
- Specified by:
andThenin interfaceBiConsumer<T,U>
-
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.
-
-