Module xyz.ronella.casual.trivial
Package xyz.ronella.trivial.handy.impl
Class StringKeyedMapExecutor
java.lang.Object
xyz.ronella.trivial.handy.AbstractKeyedMapLogic<String,TYPE_LOGIC,TYPE_OUTPUT>
xyz.ronella.trivial.handy.AbstractStringKeyedMapLogic<Sink,Object>
xyz.ronella.trivial.handy.impl.StringKeyedMapExecutor
A convenience class for creating a map as executor.
- Since:
- 2.2.0
-
Field Summary
Fields inherited from class xyz.ronella.trivial.handy.AbstractStringKeyedMapLogic
DEFAULT_LOGICFields inherited from class xyz.ronella.trivial.handy.AbstractKeyedMapLogic
defaultLogic, internalMap -
Constructor Summary
ConstructorsConstructorDescriptionStringKeyedMapExecutor(Map.Entry<String, Sink>... logics) Creates an instance of StringKeyedMapExecutorStringKeyedMapExecutor(Map<String, Sink> map) Creates an instance of StringKeyedMapExecutorCreates an instance of StringKeyedMapExecutorStringKeyedMapExecutor(Sink defaultLogic, Map.Entry<String, Sink>... logics) Creates an instance of StringKeyedMapExecutor -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes the logic that corresponds to a particular key.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
-
StringKeyedMapExecutor
@SafeVarargs public StringKeyedMapExecutor(Map<String, Sink> map, Sink defaultLogic, Map.Entry<String, Sink>... logics) Creates an instance of StringKeyedMapExecutor- 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.
-
StringKeyedMapExecutor
Creates an instance of StringKeyedMapExecutor- Parameters:
defaultLogic- The default create logic if the key used was not in the map.logics- An arrays of create logic mapped to key.
-
StringKeyedMapExecutor
Creates an instance of StringKeyedMapExecutor- Parameters:
logics- An arrays of create logic mapped to key.
-
StringKeyedMapExecutor
Creates an instance of StringKeyedMapExecutor- 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<String,Sink, Object> - Parameters:
defaultLogic- The default argument received from the constructor.- Returns:
- The initial value of the internal defaultLogic.
-
get
This will always return empty values. Use the execute method instead to perform any logic.- Specified by:
getin classAbstractStringKeyedMapLogic<Sink,Object> - Parameters:
key- The target key of the corresponding logic.- Returns:
- Always empty.
-
execute
Executes the logic that corresponds to a particular key.- Parameters:
key- The target key of the corresponding logic.
-