Class JexlScriptEngine

java.lang.Object
javax.script.AbstractScriptEngine
org.apache.commons.jexl3.scripting.JexlScriptEngine
All Implemented Interfaces:
Compilable, ScriptEngine

public class JexlScriptEngine extends AbstractScriptEngine implements Compilable
Implements the JEXL ScriptEngine for JSF-223.

This implementation gives access to both ENGINE_SCOPE and GLOBAL_SCOPE bindings. When a JEXL script accesses a variable for read or write, this implementation checks first ENGINE and then GLOBAL scope. The first one found is used. If no variable is found, and the JEXL script is writing to a variable, it will be stored in the ENGINE scope.

The implementation also creates the "JEXL" script object as an instance of the class JexlScriptEngine.JexlScriptObject for access to utility methods and variables.

See Java Scripting API Javadoc.
Since:
2.0
  • Field Details

    • ENGINE

      private static Reference<JexlEngine> ENGINE
      The shared engine instance.

      A single soft-reference JEXL engine and JexlUberspect is shared by all instances of JexlScriptEngine.

    • PERMISSIONS

      private static JexlPermissions PERMISSIONS
      The permissions used to create the script engine.
    • LOG

      static final org.apache.commons.logging.Log LOG
      The logger.
    • CACHE_SIZE

      static final int CACHE_SIZE
      The shared expression cache size.
      See Also:
    • CONTEXT_KEY

      public static final String CONTEXT_KEY
      Reserved key for context (mandated by JSR-223).
      See Also:
    • JEXL_OBJECT_KEY

      public static final String JEXL_OBJECT_KEY
      Reserved key for JexlScriptObject.
      See Also:
    • jexlObject

      The JexlScriptObject instance.
    • parentFactory

      final ScriptEngineFactory parentFactory
      The factory which created this instance.
    • jexlEngine

      final JexlEngine jexlEngine
      The JEXL EL engine.
  • Constructor Details

    • JexlScriptEngine

      public JexlScriptEngine()
      Default constructor.

      Only intended for use when not using a factory. Sets the factory to JexlScriptEngineFactory.

    • JexlScriptEngine

      public JexlScriptEngine(ScriptEngineFactory factory)
      Create a scripting engine using the supplied factory.
      Parameters:
      factory - the factory which created this instance.
      Throws:
      NullPointerException - if factory is null
  • Method Details