Class StandardELContext

java.lang.Object
jakarta.el.ELContext
jakarta.el.StandardELContext

public class StandardELContext extends ELContext
Standard implementation of ELContext that provides a complete EL resolution environment. It maintains a composite resolver chain, variable mapper, function mapper, and supports custom resolvers and local beans. This is the default context implementation used by ELProcessor.
Since:
EL 3.0
  • Constructor Details

    • StandardELContext

      public StandardELContext(ExpressionFactory factory)
      Constructs a new instance backed by the given expression factory.

      Initializes the standard resolver chain with built-in resolvers and a function mapper populated from the factory's initial function map.

      Parameters:
      factory - the expression factory providing the initial resolver and function configuration
    • StandardELContext

      public StandardELContext(ELContext context)
      Constructs a new instance that wraps the given context.

      The variable mapper, function mapper, and EL resolver from the wrapped context are used, with additional standard resolvers prepended.

      Parameters:
      context - the context to wrap
  • Method Details

    • putContext

      public void putContext(Class<?> key, Object contextObject)
      Description copied from class: ELContext
      Add an object to this EL context under the given key.
      Overrides:
      putContext in class ELContext
      Parameters:
      key - The key under which to store the object
      contextObject - The object to add
    • getContext

      public Object getContext(Class<?> key)
      Description copied from class: ELContext
      Obtain the context object for the given key.
      Overrides:
      getContext in class ELContext
      Parameters:
      key - The key of the required context object
      Returns:
      The value of the context object associated with the given key
    • getELResolver

      public ELResolver getELResolver()
      Description copied from class: ELContext
      Returns the ELResolver used to resolve properties and method invocations during expression evaluation.
      Specified by:
      getELResolver in class ELContext
      Returns:
      the ELResolver for this context
    • addELResolver

      public void addELResolver(ELResolver resolver)
      Adds a custom EL resolver to the resolver chain.

      Custom resolvers are inserted after the bean name resolver and before the standard resolvers, allowing them to intercept resolution before the built-in resolvers are consulted.

      Parameters:
      resolver - the resolver to add
    • getFunctionMapper

      public FunctionMapper getFunctionMapper()
      Description copied from class: ELContext
      Returns the FunctionMapper used to resolve EL function names to Java methods during expression evaluation.
      Specified by:
      getFunctionMapper in class ELContext
      Returns:
      the FunctionMapper for this context
    • getVariableMapper

      public VariableMapper getVariableMapper()
      Description copied from class: ELContext
      Returns the VariableMapper used to resolve EL variable names to ValueExpression instances during expression evaluation.
      Specified by:
      getVariableMapper in class ELContext
      Returns:
      the VariableMapper for this context