Module xyz.ronella.casual.trivial
Package xyz.ronella.trivial.handy
Class AbstractKeyedMapLogic<TYPE_KEY,TYPE_LOGIC,TYPE_OUTPUT>
java.lang.Object
xyz.ronella.trivial.handy.AbstractKeyedMapLogic<TYPE_KEY,TYPE_LOGIC,TYPE_OUTPUT>
- Type Parameters:
TYPE_KEY- The type of the key that can be matched.TYPE_LOGIC- The type of logic that the map will hold.TYPE_OUTPUT- The type of output that the logic will create.
- Direct Known Subclasses:
AbstractBooleanSupplierKeyedMapLogic,AbstractStringKeyedMapLogic
The base class of the KeyedMapLogic implementations.
- Since:
- 2.4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final TYPE_LOGICHolds the default logic if the key doesn't exist in internalMap.protected final Map<TYPE_KEY,TYPE_LOGIC> The instance of Map received. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractKeyedMapLogic(Map<TYPE_KEY, TYPE_LOGIC> map, TYPE_LOGIC defaultLogic, List<Map.Entry<TYPE_KEY, TYPE_LOGIC>> logics) A standard way of creating an instance of AbstractKeyedMapLogic -
Method Summary
Modifier and TypeMethodDescriptionThe default logic that will be executed if none of the keys matched.protected abstract TYPE_LOGIChandleDefaultLogicConstructorArgument(TYPE_LOGIC defaultLogic) Must have the implementation to handle the null defaultLogic.
-
Field Details
-
internalMap
The instance of Map received. -
defaultLogic
Holds the default logic if the key doesn't exist in internalMap.
-
-
Constructor Details
-
AbstractKeyedMapLogic
public AbstractKeyedMapLogic(Map<TYPE_KEY, TYPE_LOGIC> map, TYPE_LOGIC defaultLogic, List<Map.Entry<TYPE_KEY, TYPE_LOGIC>> logics) A standard way of creating an instance of AbstractKeyedMapLogic- Parameters:
map- The map that holds the keyed map logics.defaultLogic- The default logic if no matching key was found.logics- The logics that will be stored to the map parameter.
-
-
Method Details
-
getDefaultLogic
The default logic that will be executed if none of the keys matched.- Returns:
- The default logic.
-
handleDefaultLogicConstructorArgument
Must have the implementation to handle the null defaultLogic.- Parameters:
defaultLogic- The default argument received from the constructor.- Returns:
- The initial value of the internal defaultLogic.
-