Class RuleUtil

java.lang.Object
org.openhab.core.automation.util.RuleUtil

@NonNullByDefault public class RuleUtil extends Object
The RuleUtil class contains utility methods for Rule objects. This class cannot be instantiated, it only contains static methods.
Author:
Ravi Nadahar - Initial contribution
  • Constructor Details

    • RuleUtil

      public RuleUtil()
  • Method Details

    • isValidRuleUID

      public static boolean isValidRuleUID(String uid)
      Returns true if the specified UID is a valid rule UID, otherwise false.

      A valid rule UID is any string that doesn't contain /, \ and has no leading or trailing whitespace.

      Parameters:
      uid - the UID of the rule to be checked.
      Returns:
      true if the specified UID is a valid rule UID, false otherwise.
    • assertValidRuleUID

      public static void assertValidRuleUID(String uid) throws IllegalArgumentException
      Ensures that the specified rule UID is valid.

      If the rule UID is invalid an IllegalArgumentException is thrown, otherwise this method returns silently.

      A valid rule UID is any string that doesn't contain /, \ and has no leading or trailing whitespace.

      Parameters:
      uid - the UID of the rule to be checked.
      Throws:
      IllegalArgumentException - If the specified rule UID is invalid.