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
Inputs of a ActionType into a list of
ConfigDescriptionParameters and to convert serialised inputs to the Java types required by the
Inputs of a ActionType.- Author:
- Laurent Garnier and Florian Hotze - Initial contribution
-
Constructor Summary
ConstructorsConstructorDescriptionActionInputsHelper(TimeZoneProvider timeZoneProvider, UnitProvider unitProvider) -
Method Summary
Modifier and TypeMethodDescriptionMaps a list ofInputs to a list ofConfigDescriptionParameters.Maps anInputto aConfigDescriptionParameter.mapSerializedInputsToActionInputs(ActionType actionType, Map<String, Object> arguments) Maps serialised inputs to the Java types required by theInputs 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 ofInputs to a list ofConfigDescriptionParameters.- 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 anInputto 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 theInputs 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
-