Class BooleanSupplierWithContext
- java.lang.Object
-
- nl.talsmasoftware.context.delegation.Wrapper<T>
-
- nl.talsmasoftware.context.delegation.WrapperWithContext<T>
-
- nl.talsmasoftware.context.functions.BooleanSupplierWithContext
-
- All Implemented Interfaces:
BooleanSupplier
public class BooleanSupplierWithContext extends WrapperWithContext<T> implements BooleanSupplier
A wrapper forBooleanSupplierthatreactivates 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 protectedBooleanSupplierWithContext(Supplier<ContextSnapshot> supplier, BooleanSupplier delegate, Consumer<ContextSnapshot> consumer)BooleanSupplierWithContext(ContextSnapshot snapshot, BooleanSupplier delegate)BooleanSupplierWithContext(ContextSnapshot snapshot, BooleanSupplier delegate, Consumer<ContextSnapshot> consumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Optional<Consumer<ContextSnapshot>>consumer()Deprecated.The functional wrappers currently no longer use this method.booleangetAsBoolean()-
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
-
BooleanSupplierWithContext
public BooleanSupplierWithContext(ContextSnapshot snapshot, BooleanSupplier delegate)
-
BooleanSupplierWithContext
public BooleanSupplierWithContext(ContextSnapshot snapshot, BooleanSupplier delegate, Consumer<ContextSnapshot> consumer)
-
BooleanSupplierWithContext
protected BooleanSupplierWithContext(Supplier<ContextSnapshot> supplier, BooleanSupplier delegate, Consumer<ContextSnapshot> consumer)
-
-
Method Detail
-
getAsBoolean
public boolean getAsBoolean()
- Specified by:
getAsBooleanin interfaceBooleanSupplier
-
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.
-
-