Package org.openhab.core.automation.util
Class ConfigurationNormalizer
java.lang.Object
org.openhab.core.automation.util.ConfigurationNormalizer
This class provides utility methods used by
RuleRegistry
to resolve and normalize the RuleImpl
s
configuration values.- Author:
- Ana Dimova - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,
ConfigDescriptionParameter> getConfigDescriptionMap
(List<ConfigDescriptionParameter> configDesc) Converts a list ofConfigDescriptionParameter
s to a map with the parameter's names as keys.static void
normalizeConfiguration
(Configuration configuration, Map<String, ConfigDescriptionParameter> configDescriptionMap) Normalizes the types of the configuration's parameters to the allowed ones.static <T extends Module>
voidnormalizeModuleConfigurations
(List<T> modules, ModuleTypeRegistry mtRegistry) Normalizes the configurations of the providedModuleImpl
s.
-
Constructor Details
-
ConfigurationNormalizer
public ConfigurationNormalizer()
-
-
Method Details
-
normalizeModuleConfigurations
public static <T extends Module> void normalizeModuleConfigurations(List<T> modules, ModuleTypeRegistry mtRegistry) Normalizes the configurations of the providedModuleImpl
s.- Parameters:
modules
- a list ofModuleImpl
s to normalize.mtRegistry
- theModuleTypeRegistry
that provides the meta-data needed for the normalization.- See Also:
-
getConfigDescriptionMap
public static Map<String,ConfigDescriptionParameter> getConfigDescriptionMap(List<ConfigDescriptionParameter> configDesc) Converts a list ofConfigDescriptionParameter
s to a map with the parameter's names as keys.- Parameters:
configDesc
- the list to convert.- Returns:
- a map that maps parameter names to
ConfigDescriptionParameter
instances.
-
normalizeConfiguration
public static void normalizeConfiguration(Configuration configuration, Map<String, ConfigDescriptionParameter> configDescriptionMap) Normalizes the types of the configuration's parameters to the allowed ones. References are ignored. Null values are replaced with the defaults and then normalized.- Parameters:
configuration
- the configuration to normalize.configDescriptionMap
- the meta-data of the configuration.
-