Module xyz.ronella.casual.trivial
Package xyz.ronella.trivial.handy.impl
Class BooleanSupplierKeyedMapExecutor
java.lang.Object
xyz.ronella.trivial.handy.AbstractKeyedMapLogic<BooleanSupplier,TYPE_LOGIC,TYPE_OUTPUT>
xyz.ronella.trivial.handy.AbstractBooleanSupplierKeyedMapLogic<Sink,Object>
xyz.ronella.trivial.handy.impl.BooleanSupplierKeyedMapExecutor
public class BooleanSupplierKeyedMapExecutor
extends AbstractBooleanSupplierKeyedMapLogic<Sink,Object>
A convenience class for creating a map as an executor.
- Since:
- 2.4.0
-
Field Summary
Fields inherited from class xyz.ronella.trivial.handy.AbstractKeyedMapLogic
defaultLogic, internalMap -
Constructor Summary
ConstructorsConstructorDescriptionBooleanSupplierKeyedMapExecutor(Map.Entry<BooleanSupplier, Sink>... logics) Creates an instance of BooleanSupplierKeyedMapExecutorCreates an instance of BooleanSupplierKeyedMapExecutorBooleanSupplierKeyedMapExecutor(Map<BooleanSupplier, Sink> map, Sink defaultLogic, Map.Entry<BooleanSupplier, Sink>... logics) Creates an instance of BooleanSupplierKeyedMapExecutorBooleanSupplierKeyedMapExecutor(Sink defaultLogic, Map.Entry<BooleanSupplier, Sink>... logics) Creates an instance of BooleanSupplierKeyedMapExecutor -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the logic of the first key that return true otherwise the default will be executed.get()This will always return empty values.protected SinkhandleDefaultLogicConstructorArgument(Sink defaultLogic) Must have the implementation to handle the null defaultLogic.Methods inherited from class xyz.ronella.trivial.handy.AbstractKeyedMapLogic
getDefaultLogic
-
Constructor Details
-
BooleanSupplierKeyedMapExecutor
@SafeVarargs public BooleanSupplierKeyedMapExecutor(Map<BooleanSupplier, Sink> map, Sink defaultLogic, Map.Entry<BooleanSupplier, Sink>... logics) Creates an instance of BooleanSupplierKeyedMapExecutor- Parameters:
map- An external map that will be used as storage of logics.defaultLogic- The default create logic if the key used was not in the map.logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapExecutor
@SafeVarargs public BooleanSupplierKeyedMapExecutor(Sink defaultLogic, Map.Entry<BooleanSupplier, Sink>... logics) Creates an instance of BooleanSupplierKeyedMapExecutor- Parameters:
defaultLogic- The default create logic if the key used was not in the map.logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapExecutor
Creates an instance of BooleanSupplierKeyedMapExecutor- Parameters:
logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapExecutor
Creates an instance of BooleanSupplierKeyedMapExecutor- Parameters:
map- An external map that already contains logics.
-
-
Method Details
-
handleDefaultLogicConstructorArgument
Description copied from class:AbstractKeyedMapLogicMust have the implementation to handle the null defaultLogic.- Specified by:
handleDefaultLogicConstructorArgumentin classAbstractKeyedMapLogic<BooleanSupplier,Sink, Object> - Parameters:
defaultLogic- The default argument received from the constructor.- Returns:
- The initial value of the internal defaultLogic.
-
execute
public void execute()Executes the logic of the first key that return true otherwise the default will be executed. -
get
This will always return empty values. Use the execute method instead to perform any logic.- Specified by:
getin classAbstractBooleanSupplierKeyedMapLogic<Sink,Object> - Returns:
- Always empty.
-