Class JexlRuleValidator

java.lang.Object
net.simplace.core.jexl.JexlRuleValidator

public final class JexlRuleValidator extends Object
Checks a rule of a solution without evaluating it, e.g. for editors (Redmine #62): the syntax is checked by compiling the rule like JexlRuleScript does (${component.var} replaced, expression or script depending on JexlRuleScript.analyseComplexity(String)), the position of a syntax error is given in the original rule, the used variables can be checked against the known ones, unknown namespaces are reported, and hints are given for symbol operators (the SIMPLACE convention is eq ne lt le gt ge and or not) and for rules that look like an expression but have no ${...} (they are used as plain value).
Author:
Andreas Enders, Claude (Anthropic), co-author
  • Method Details

    • validate

      public static JexlRuleValidator.Result validate(String aRule)
      Checks the syntax of a rule (variables are not checked).
      Parameters:
      aRule - the rule
      Returns:
      the result
    • validate

      public static JexlRuleValidator.Result validate(String aRule, FWSimVarMap aVarMap)
      Checks a rule and its variables against a var map (e.g. the template var map of a solution).
      Parameters:
      aRule - the rule
      aVarMap - the var map with the known variables
      Returns:
      the result
    • validate

      public static JexlRuleValidator.Result validate(String aRule, Predicate<String> aKnownVariable)
      Checks a rule.
      Parameters:
      aRule - the rule
      aKnownVariable - tells whether a variable name is known, or null to skip the check of the variables
      Returns:
      the result