Class JxltEngine

java.lang.Object
org.apache.commons.jexl3.JxltEngine
Direct Known Subclasses:
TemplateEngine

public abstract class JxltEngine extends Object
A simple "JeXL Template" engine.

At the base is an evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL. At the top is a template engine inspired by Velocity that uses JEXL (instead of OGNL/VTL) as the scripting language.

The evaluator is intended to be used in configuration modules, XML based frameworks or JSP taglibs and facilitate the implementation of expression evaluation.

The template engine is intended to output any form of text; html, XML, CSV...

Since:
3.0
  • Constructor Details

    • JxltEngine

      public JxltEngine()
  • Method Details

    • clearCache

      public abstract void clearCache()
      Clears the cache.
    • createExpression

      public abstract JxltEngine.Expression createExpression(JexlInfo info, String expression)
      Creates a JxltEngine.Expression from an expression string. Uses and fills up the expression cache if any.

      If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.

      Parameters:
      info - the JexlInfo source information
      expression - the JxltEngine.Template string expression
      Returns:
      the JxltEngine.Expression, null if silent and an error occurred
      Throws:
      JxltEngine.Exception - if an error occurs and the JexlEngine is not silent
    • createExpression

      public JxltEngine.Expression createExpression(String expression)
      Creates a JxltEngine.Expression from an expression string. Uses and fills up the expression cache if any.

      If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.

      Parameters:
      expression - the JxltEngine.Template string expression
      Returns:
      the JxltEngine.Expression, null if silent and an error occurred
      Throws:
      JxltEngine.Exception - if an error occurs and the JexlEngine is not silent
    • createTemplate

      public JxltEngine.Template createTemplate(JexlInfo info, String source)
      Creates a new template.
      Parameters:
      info - the source info
      source - the source
      Returns:
      the template
    • createTemplate

      public abstract JxltEngine.Template createTemplate(JexlInfo info, String prefix, Reader source, String... parms)
      Creates a new template.
      Parameters:
      info - the jexl info (file, line, column)
      prefix - the directive prefix
      source - the source
      parms - the parameter names
      Returns:
      the template
    • createTemplate

      public JxltEngine.Template createTemplate(JexlInfo info, String source, String... parms)
      Creates a new template.
      Parameters:
      info - the source info
      source - the source
      parms - the parameter names
      Returns:
      the template
    • createTemplate

      public JxltEngine.Template createTemplate(String source)
      Creates a new template.
      Parameters:
      source - the source
      Returns:
      the template
    • createTemplate

      public JxltEngine.Template createTemplate(String prefix, Reader source, String... parms)
      Creates a new template.
      Parameters:
      prefix - the directive prefix
      source - the source
      parms - the parameter names
      Returns:
      the template
    • createTemplate

      public JxltEngine.Template createTemplate(String source, String... parms)
      Creates a new template.
      Parameters:
      source - the source
      parms - the parameter names
      Returns:
      the template
    • getEngine

      public abstract JexlEngine getEngine()
      Gets the JexlEngine underlying this template engine.
      Returns:
      the JexlEngine