Class Transformation

java.lang.Object
org.openhab.core.transform.actions.Transformation

@NonNullByDefault public class Transformation extends Object
This class holds static "action" methods that can be used from within rules to execute transformations.
Author:
Kai Kreuzer - Initial contribution
  • Constructor Details

    • Transformation

      public Transformation()
  • Method Details

    • transform

      public static @Nullable String transform(String type, String function, String value)
      Applies a transformation of a given type with some function to a value.
      Parameters:
      type - the transformation type, e.g. REGEX or MAP
      function - the function to call, this value depends on the transformation type
      value - the value to apply the transformation to
      Returns:
      the transformed value or the original one, if there was no service registered for the given type or a transformation exception occurred.
    • transformRaw

      public static @Nullable String transformRaw(String type, String function, String value) throws TransformationException
      Applies a transformation of a given type with some function to a value.
      Parameters:
      type - the transformation type, e.g. REGEX or MAP
      function - the function to call, this value depends on the transformation type
      value - the value to apply the transformation to
      Returns:
      the transformed value
      Throws:
      TransformationException