Class CompiledValueExpression

java.lang.Object
jakarta.el.Expression
jakarta.el.ValueExpression
io.micronaut.el.runtime.CompiledValueExpression
All Implemented Interfaces:
CompiledExpression, Serializable
Direct Known Subclasses:
LiteralValueExpression

public abstract class CompiledValueExpression extends jakarta.el.ValueExpression implements CompiledExpression
The base class of the ValueExpression implementations generated at compilation time.

Subclasses implement evaluate(ELContext), which contains the compiled form of the expression. Expressions that are lvalues additionally override setValue(ELContext, Object), getType(ELContext) and isReadOnly(ELContext).

Since:
1.0
Author:
Denis Stepanov
See Also:
  • Constructor Details

    • CompiledValueExpression

      protected CompiledValueExpression(String expressionString, Class<?> expectedType)
      Parameters:
      expressionString - The original expression
      expectedType - The expected type of the evaluation result
    • CompiledValueExpression

      protected CompiledValueExpression(String expressionString, String canonicalForm, Class<?> expectedType)
      Parameters:
      expressionString - The original expression
      canonicalForm - The canonical form of the expression, which is what equality compares
      expectedType - The expected type of the evaluation result
    • CompiledValueExpression

      protected CompiledValueExpression(String expressionString, String canonicalForm, Class<?> expectedType, boolean coerced)
      Parameters:
      expressionString - The original expression
      canonicalForm - The canonical form of the expression, which is what equality compares
      expectedType - The expected type of the evaluation result
      coerced - Whether the result of the evaluation has to be coerced to the expected type, which the compiler knows not to be the case when the static type of the expression is the expected type
  • Method Details

    • evaluate

      protected abstract @Nullable Object evaluate(jakarta.el.ELContext context)
      Evaluates the compiled expression.
      Parameters:
      context - The context
      Returns:
      The result of the evaluation, before the coercion to the expected type
    • getValue

      public <T> @Nullable T getValue(jakarta.el.ELContext context)
      Specified by:
      getValue in class jakarta.el.ValueExpression
    • setValue

      public void setValue(jakarta.el.ELContext context, @Nullable Object value)
      Specified by:
      setValue in class jakarta.el.ValueExpression
    • isReadOnly

      public boolean isReadOnly(jakarta.el.ELContext context)
      Specified by:
      isReadOnly in class jakarta.el.ValueExpression
    • getType

      public @Nullable Class<?> getType(jakarta.el.ELContext context)
      Specified by:
      getType in class jakarta.el.ValueExpression
    • getExpectedType

      public Class<?> getExpectedType()
      Specified by:
      getExpectedType in class jakarta.el.ValueExpression
    • getExpressionString

      public final String getExpressionString()
      Specified by:
      getExpressionString in interface CompiledExpression
      Specified by:
      getExpressionString in class jakarta.el.Expression
      Returns:
      The original expression string
    • isLiteralText

      public boolean isLiteralText()
      Specified by:
      isLiteralText in class jakarta.el.Expression
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class jakarta.el.Expression
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class jakarta.el.Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object