Class ELResolution

java.lang.Object
io.micronaut.el.runtime.ELResolution

@Internal public final class ELResolution extends Object
The resolution of identifiers, properties and methods described in the sections 1.5 and 1.6 of the Jakarta Expression Language specification.

This class is invoked by the expressions generated at compilation time, it is not part of the public API of the module.

Since:
1.0
Author:
Denis Stepanov
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable Object
    assignIdentifier(jakarta.el.ELContext context, String name, @Nullable Object value)
    Assigns a value to an identifier and returns the assigned value, as described in the section 1.13 of the specification.
    static @Nullable Object
    assignProperty(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value)
    Assigns a value to a property and returns the assigned value, as described in the section 1.13 of the specification.
    static <T> T
    functionProvider(jakarta.el.ELContext context, Class<T> type)
    The instance a function declared on a bean is invoked on: the one registered in the context under its type, or the one the ELBeanProvider registered in the context returns.
    static @Nullable Class<?>
    getIdentifierType(jakarta.el.ELContext context, String name)
     
    static @Nullable Class<?>
    getType(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
     
    static @Nullable Object
    getValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
    Resolves a property of a base object, returning null when the base or the property is null as described for the getValue evaluation of the section 1.6 of the specification.
    static @Nullable Object
    getValueRequired(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
    Resolves a property of a base object, failing when the base or the property is null.
    static @Nullable Object
    invoke(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, Object... arguments)
    Invokes a method of a base object as described in the section 1.6 of the specification.
    static @Nullable Object
    invokeCallable(jakarta.el.ELContext context, @Nullable Object target, Object... arguments)
    Invokes the result of a function expression as described in the section 1.5.2 of the specification, which covers the invocation of lambda expressions returning lambda expressions.
    static @Nullable Object
    invokeMethod(jakarta.el.ELContext context, Object base, Method method, Object @Nullable [] arguments)
    Invokes a method found on the base object, which is how the section 1.6 of the specification invokes a method expression that does not provide its own parameters.
    static @Nullable Object
    invokeMethodExpression(jakarta.el.ELContext context, @Nullable Object target, @Nullable Object[] arguments)
    Invokes a method expression resolved from a single identifier, as described in the section 1.5.4 of the specification.
    static @Nullable Object
    invokeWithParams(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, @Nullable Object[] params)
    Invokes a method of a base object with the parameters passed to jakarta.el.MethodExpression.invoke(ELContext, Object[]).
    static @Nullable Object
    invokeWithParamTypes(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, Class<?> @Nullable [] paramTypes, @Nullable Object[] params)
    Invokes a method of a base object with the parameter types provided when the expression was created, which is how the section 1.6 of the specification resolves an overloaded method.
    static boolean
    isIdentifierReadOnly(jakarta.el.ELContext context, String name)
     
    static boolean
    isReadOnly(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
     
    static @Nullable Object
    listElement(@Nullable List<?> list, @Nullable Object index)
    Reads an element of a list, as the jakarta.el.ListELResolver does for a base the compiler knows to be a list: the index is coerced to an integer, an index out of the bounds of the list reads as null, and so does a null base or index, section 1.6 of the specification.
    static @Nullable Object
    mapValue(@Nullable Map<?,?> map, @Nullable Object key)
    Reads the value of a key of a map, as the jakarta.el.MapELResolver does for a base the compiler knows to be a map; a null base or key is null, section 1.6 of the specification.
    static Object
    newInstance(jakarta.el.ELContext context, jakarta.el.ELClass elClass, Object... arguments)
    Invokes the constructor of an imported class as described in the section 1.24.3 of the specification.
    static @Nullable Object
    resolveIdentifier(jakarta.el.ELContext context, String name)
    Evaluates an identifier as described in the section 1.5.1 of the specification.
    static @Nullable Object
    resolveStaticMember(jakarta.el.ELContext context, jakarta.el.ELClass base, String method)
     
    static @Nullable Object
    resolveVariable(jakarta.el.ELContext context, String name)
    Evaluates an identifier the compiler knows to be a declared variable: the steps of the section 1.5.1 of the specification that can denote a variable, a lambda argument of an enclosing scope, the variable mapper and the resolvers, without the static imports, which the compiler resolves itself.
    static void
    setIdentifier(jakarta.el.ELContext context, String name, @Nullable Object value)
    Assigns a value to an identifier, as used by the assignment operator.
    static void
    setValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value)
    Assigns a value to a property of a base object.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resolveIdentifier

      public static @Nullable Object resolveIdentifier(jakarta.el.ELContext context, String name)
      Evaluates an identifier as described in the section 1.5.1 of the specification.
      Parameters:
      context - The context
      name - The identifier
      Returns:
      The value of the identifier
    • resolveVariable

      public static @Nullable Object resolveVariable(jakarta.el.ELContext context, String name)
      Evaluates an identifier the compiler knows to be a declared variable: the steps of the section 1.5.1 of the specification that can denote a variable, a lambda argument of an enclosing scope, the variable mapper and the resolvers, without the static imports, which the compiler resolves itself.
      Parameters:
      context - The context
      name - The identifier
      Returns:
      The value of the variable
    • mapValue

      public static @Nullable Object mapValue(@Nullable Map<?,?> map, @Nullable Object key)
      Reads the value of a key of a map, as the jakarta.el.MapELResolver does for a base the compiler knows to be a map; a null base or key is null, section 1.6 of the specification.
      Parameters:
      map - The map
      key - The key
      Returns:
      The value
    • listElement

      public static @Nullable Object listElement(@Nullable List<?> list, @Nullable Object index)
      Reads an element of a list, as the jakarta.el.ListELResolver does for a base the compiler knows to be a list: the index is coerced to an integer, an index out of the bounds of the list reads as null, and so does a null base or index, section 1.6 of the specification.
      Parameters:
      list - The list
      index - The index
      Returns:
      The element
    • setIdentifier

      public static void setIdentifier(jakarta.el.ELContext context, String name, @Nullable Object value)
      Assigns a value to an identifier, as used by the assignment operator.
      Parameters:
      context - The context
      name - The identifier
      value - The value
    • getIdentifierType

      public static @Nullable Class<?> getIdentifierType(jakarta.el.ELContext context, String name)
      Parameters:
      context - The context
      name - The identifier
      Returns:
      The type of the identifier
    • isIdentifierReadOnly

      public static boolean isIdentifierReadOnly(jakarta.el.ELContext context, String name)
      Parameters:
      context - The context
      name - The identifier
      Returns:
      True if the identifier is read only
    • getValue

      public static @Nullable Object getValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
      Resolves a property of a base object, returning null when the base or the property is null as described for the getValue evaluation of the section 1.6 of the specification.
      Parameters:
      context - The context
      base - The base object
      property - The property
      Returns:
      The resolved value
    • getValueRequired

      public static @Nullable Object getValueRequired(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
      Resolves a property of a base object, failing when the base or the property is null.
      Parameters:
      context - The context
      base - The base object
      property - The property
      Returns:
      The resolved value
    • setValue

      public static void setValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value)
      Assigns a value to a property of a base object.
      Parameters:
      context - The context
      base - The base object
      property - The property
      value - The value to assign
    • getType

      public static @Nullable Class<?> getType(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
      Parameters:
      context - The context
      base - The base object
      property - The property
      Returns:
      The type of the property
    • isReadOnly

      public static boolean isReadOnly(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property)
      Parameters:
      context - The context
      base - The base object
      property - The property
      Returns:
      True if the property is read only
    • assignIdentifier

      public static @Nullable Object assignIdentifier(jakarta.el.ELContext context, String name, @Nullable Object value)
      Assigns a value to an identifier and returns the assigned value, as described in the section 1.13 of the specification.
      Parameters:
      context - The context
      name - The identifier
      value - The value
      Returns:
      The assigned value
    • assignProperty

      public static @Nullable Object assignProperty(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value)
      Assigns a value to a property and returns the assigned value, as described in the section 1.13 of the specification.
      Parameters:
      context - The context
      base - The base object
      property - The property
      value - The value
      Returns:
      The assigned value
    • invokeMethodExpression

      public static @Nullable Object invokeMethodExpression(jakarta.el.ELContext context, @Nullable Object target, @Nullable Object[] arguments)
      Invokes a method expression resolved from a single identifier, as described in the section 1.5.4 of the specification.
      Parameters:
      context - The context
      target - The resolved identifier
      arguments - The arguments
      Returns:
      The result of the invocation
    • invoke

      public static @Nullable Object invoke(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, Object... arguments)
      Invokes a method of a base object as described in the section 1.6 of the specification.
      Parameters:
      context - The context
      base - The base object
      method - The method name
      arguments - The arguments
      Returns:
      The result of the invocation
    • invokeWithParams

      public static @Nullable Object invokeWithParams(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, @Nullable Object[] params)
      Invokes a method of a base object with the parameters passed to jakarta.el.MethodExpression.invoke(ELContext, Object[]).
      Parameters:
      context - The context
      base - The base object
      method - The method name
      params - The parameters, can be null
      Returns:
      The result of the invocation
    • invokeWithParamTypes

      public static @Nullable Object invokeWithParamTypes(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, Class<?> @Nullable [] paramTypes, @Nullable Object[] params)
      Invokes a method of a base object with the parameter types provided when the expression was created, which is how the section 1.6 of the specification resolves an overloaded method.
      Parameters:
      context - The context
      base - The base object
      method - The method name
      paramTypes - The parameter types provided at parse time, can be null
      params - The arguments
      Returns:
      The result of the invocation
    • invokeMethod

      public static @Nullable Object invokeMethod(jakarta.el.ELContext context, Object base, Method method, Object @Nullable [] arguments)
      Invokes a method found on the base object, which is how the section 1.6 of the specification invokes a method expression that does not provide its own parameters.
      Parameters:
      context - The context
      base - The base object
      method - The method
      arguments - The arguments
      Returns:
      The result of the invocation
    • invokeCallable

      public static @Nullable Object invokeCallable(jakarta.el.ELContext context, @Nullable Object target, Object... arguments)
      Invokes the result of a function expression as described in the section 1.5.2 of the specification, which covers the invocation of lambda expressions returning lambda expressions.
      Parameters:
      context - The context
      target - The evaluated function name
      arguments - The arguments
      Returns:
      The result of the invocation
    • newInstance

      public static Object newInstance(jakarta.el.ELContext context, jakarta.el.ELClass elClass, Object... arguments)
      Invokes the constructor of an imported class as described in the section 1.24.3 of the specification.
      Parameters:
      context - The context
      elClass - The class
      arguments - The arguments
      Returns:
      The new instance
    • resolveStaticMember

      public static @Nullable Object resolveStaticMember(jakarta.el.ELContext context, jakarta.el.ELClass base, String method)
      Parameters:
      context - The context
      base - The base object
      method - The method name
      Returns:
      The static method or field reference of an imported class
    • functionProvider

      public static <T> T functionProvider(jakarta.el.ELContext context, Class<T> type)
      The instance a function declared on a bean is invoked on: the one registered in the context under its type, or the one the ELBeanProvider registered in the context returns.
      Type Parameters:
      T - The type declaring the function
      Parameters:
      context - The context
      type - The type declaring the function
      Returns:
      The instance