Module xyz.ronella.casual.trivial
Package xyz.ronella.trivial.handy.impl
Class BooleanSupplierKeyedMapGenerator<TYPE_OUTPUT>
java.lang.Object
xyz.ronella.trivial.handy.AbstractKeyedMapLogic<BooleanSupplier,TYPE_LOGIC,TYPE_OUTPUT>
xyz.ronella.trivial.handy.AbstractBooleanSupplierKeyedMapLogic<Supplier<TYPE_OUTPUT>,TYPE_OUTPUT>
xyz.ronella.trivial.handy.impl.BooleanSupplierKeyedMapGenerator<TYPE_OUTPUT>
- Type Parameters:
TYPE_OUTPUT- The type of the output that the factory will create.
public class BooleanSupplierKeyedMapGenerator<TYPE_OUTPUT>
extends AbstractBooleanSupplierKeyedMapLogic<Supplier<TYPE_OUTPUT>,TYPE_OUTPUT>
A convenience class for creating a map as factory.
- Since:
- 2.4.0
-
Field Summary
Fields inherited from class xyz.ronella.trivial.handy.AbstractKeyedMapLogic
defaultLogic, internalMap -
Constructor Summary
ConstructorsConstructorDescriptionBooleanSupplierKeyedMapGenerator(Supplier<TYPE_OUTPUT> defaultLogic, Map.Entry<BooleanSupplier, Supplier<TYPE_OUTPUT>>... logics) Creates an instance of BooleanSupplierKeyedMapFactoryCreates an instance of BooleanSupplierKeyedMapFactoryCreates an instance of BooleanSupplierKeyedMapFactoryBooleanSupplierKeyedMapGenerator(Map<BooleanSupplier, Supplier<TYPE_OUTPUT>> map, Supplier<TYPE_OUTPUT> defaultLogic, Map.Entry<BooleanSupplier, Supplier<TYPE_OUTPUT>>... logics) Creates an instance of BooleanSupplierKeyedMapFactory -
Method Summary
Modifier and TypeMethodDescriptionget()Executes the logic of the first truth key.protected Supplier<TYPE_OUTPUT>handleDefaultLogicConstructorArgument(Supplier<TYPE_OUTPUT> defaultLogic) Must have the implementation to handle the null defaultLogic.Methods inherited from class xyz.ronella.trivial.handy.AbstractKeyedMapLogic
getDefaultLogic
-
Constructor Details
-
BooleanSupplierKeyedMapGenerator
@SafeVarargs public BooleanSupplierKeyedMapGenerator(Map<BooleanSupplier, Supplier<TYPE_OUTPUT>> map, Supplier<TYPE_OUTPUT> defaultLogic, Map.Entry<BooleanSupplier, Supplier<TYPE_OUTPUT>>... logics) Creates an instance of BooleanSupplierKeyedMapFactory- Parameters:
map- An external map that will be used as storage of factory.defaultLogic- The default create logic if the key used was not in the map.logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapGenerator
@SafeVarargs public BooleanSupplierKeyedMapGenerator(Supplier<TYPE_OUTPUT> defaultLogic, Map.Entry<BooleanSupplier, Supplier<TYPE_OUTPUT>>... logics) Creates an instance of BooleanSupplierKeyedMapFactory- Parameters:
defaultLogic- The default create logic if the key used was not in the map.logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapGenerator
@SafeVarargs public BooleanSupplierKeyedMapGenerator(Map.Entry<BooleanSupplier, Supplier<TYPE_OUTPUT>>... logics) Creates an instance of BooleanSupplierKeyedMapFactory- Parameters:
logics- An arrays of create logic mapped to key.
-
BooleanSupplierKeyedMapGenerator
Creates an instance of BooleanSupplierKeyedMapFactory- Parameters:
map- An external map that already contains logics.
-
-
Method Details
-
handleDefaultLogicConstructorArgument
protected Supplier<TYPE_OUTPUT> handleDefaultLogicConstructorArgument(Supplier<TYPE_OUTPUT> defaultLogic) Description copied from class:AbstractKeyedMapLogicMust have the implementation to handle the null defaultLogic.- Specified by:
handleDefaultLogicConstructorArgumentin classAbstractKeyedMapLogic<BooleanSupplier,Supplier<TYPE_OUTPUT>, TYPE_OUTPUT> - Parameters:
defaultLogic- The default argument received from the constructor.- Returns:
- The initial value of the internal defaultLogic.
-
get
Executes the logic of the first truth key.- Specified by:
getin classAbstractBooleanSupplierKeyedMapLogic<Supplier<TYPE_OUTPUT>,TYPE_OUTPUT> - Returns:
- The typed object generated by the logic of the first truth key.
-