Package org.openhab.core.automation.util
Class ActionInputsHelper
java.lang.Object
org.openhab.core.automation.util.ActionInputsHelper
This is an utility class to convert the
Input
s of a ActionType
into a list of
ConfigDescriptionParameter
s and to convert serialised inputs to the Java types required by the
Input
s of a ActionType
.- Author:
- Laurent Garnier and Florian Hotze - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionMaps a list ofInput
s to a list ofConfigDescriptionParameter
s.Maps anInput
to aConfigDescriptionParameter
.mapSerializedInputsToActionInputs
(ActionType actionType, Map<String, Object> arguments) Maps serialised inputs to the Java types required by theInput
s of the givenActionType
.mapSerializedInputToActionInput
(Input input, Object argument) Maps a serialised input to the Java type required by the givenInput
.
-
Constructor Details
-
ActionInputsHelper
-
-
Method Details
-
mapActionInputsToConfigDescriptionParameters
public List<ConfigDescriptionParameter> mapActionInputsToConfigDescriptionParameters(List<Input> inputs) throws IllegalArgumentException Maps a list ofInput
s to a list ofConfigDescriptionParameter
s.- Parameters:
inputs
- the list of inputs to map to config description parameters- Returns:
- the list of config description parameters
- Throws:
IllegalArgumentException
- if at least one of the input parameters has an unsupported type
-
mapActionInputToConfigDescriptionParameter
public ConfigDescriptionParameter mapActionInputToConfigDescriptionParameter(Input input) throws IllegalArgumentException Maps anInput
to aConfigDescriptionParameter
.- Parameters:
input
- the input to map to a config description parameter- Returns:
- the config description parameter
- Throws:
IllegalArgumentException
- if the input parameter has an unsupported type
-
mapSerializedInputsToActionInputs
public Map<String,Object> mapSerializedInputsToActionInputs(ActionType actionType, Map<String, Object> arguments) Maps serialised inputs to the Java types required by theInput
s of the givenActionType
.- Parameters:
actionType
- the action type whose inputs to considerarguments
- the serialised arguments- Returns:
- the mapped arguments
-
mapSerializedInputToActionInput
public Object mapSerializedInputToActionInput(Input input, Object argument) throws IllegalArgumentException Maps a serialised input to the Java type required by the givenInput
.- Parameters:
input
- the input whose type to considerargument
- the serialised argument- Returns:
- the mapped argument
- Throws:
IllegalArgumentException
- if the mapping failed
-