ValueExpressionLiteral (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.el, class: ValueExpressionLiteral

# Class ValueExpressionLiteral

java.lang.Object
jakarta.el.Expression
jakarta.el.ValueExpression
org.apache.el.ValueExpressionLiteral

All Implemented Interfaces:
  `Externalizable, Serializable`

public final class ValueExpressionLiteral extends ValueExpression implements Externalizable
A literal value expression that represents a constant value.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ValueExpressionLiteral()`
  Constructs a new ValueExpressionLiteral for deserialization.
  `ValueExpressionLiteral(Object value, Class<?> expectedType)`
  Constructs a new ValueExpressionLiteral.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `boolean`
  `equals(ValueExpressionLiteral ve)`
  Compares this literal value expression with another for equality.
  `Class<?>`
  `getExpectedType()`
  Returns the expected type of the result of this expression.
  `String`
  `getExpressionString()`
  Returns the original string representation of this EL expression as it was parsed.
  `Class<?>`
  `getType(ELContext context)`
  Returns the type of the result produced by evaluating this expression.
  `<T> T`
  `getValue(ELContext context)`
  Evaluates this expression and returns the result.
  `int`
  `hashCode()`
  `boolean`
  `isLiteralText()`
  Returns whether this expression is a literal text expression, meaning it does not contain any variables, functions, or operators and evaluates to a constant value.
  `boolean`
  `isReadOnly(ELContext context)`
  Determines whether the property referenced by this expression is read-only.
  `void`
  `readExternal(ObjectInput in)`
  `void`
  `setValue(ELContext context, Object value)`
  Sets the value of the property referenced by this expression.
  `void`
  `writeExternal(ObjectOutput out)`

  ### Methods inherited from class ValueExpression

  `getValueReference`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ValueExpressionLiteral

    public ValueExpressionLiteral()
    Constructs a new ValueExpressionLiteral for deserialization.

  - ### ValueExpressionLiteral

    public ValueExpressionLiteral(Object value, Class<?> expectedType)
    Constructs a new ValueExpressionLiteral.
    Parameters:
      `value` - The literal value
      `expectedType` - The expected return type

- ## Method Details

  - ### getValue

    public <T> T getValue(ELContext context)
    Description copied from class: `jakarta.el.ValueExpression`
    Evaluates this expression and returns the result.
    Specified by:
      `getValue` in class `ValueExpression`
    Type Parameters:
      `T` - The expected type for the result of evaluating this value expression
    Parameters:
      `context` - The EL context for this evaluation
    Returns:
      The result of evaluating this value expression

  - ### setValue

    public void setValue(ELContext context, Object value)
    Description copied from class: `jakarta.el.ValueExpression`
    Sets the value of the property referenced by this expression.
    Specified by:
      `setValue` in class `ValueExpression`
    Parameters:
      `context` - The EL context for this evaluation
      `value` - The value to set the property to which this value expression refers

  - ### isReadOnly

    public boolean isReadOnly(ELContext context)
    Description copied from class: `jakarta.el.ValueExpression`
    Determines whether the property referenced by this expression is read-only.
    Specified by:
      `isReadOnly` in class `ValueExpression`
    Parameters:
      `context` - The EL context for this evaluation
    Returns:
      `true` if this expression is read only otherwise `false`

  - ### getType

    public Class<?> getType(ELContext context)
    Description copied from class: `jakarta.el.ValueExpression`
    Returns the type of the result produced by evaluating this expression.
    Specified by:
      `getType` in class `ValueExpression`
    Parameters:
      `context` - The EL context for this evaluation
    Returns:
      The type of the result of this value expression

  - ### getExpectedType

    public Class<?> getExpectedType()
    Description copied from class: `jakarta.el.ValueExpression`
    Returns the expected type of the result of this expression.
    Specified by:
      `getExpectedType` in class `ValueExpression`
    Returns:
      The expected result type, or `Object.class` if no specific type is expected

  - ### getExpressionString

    public String getExpressionString()
    Description copied from class: `jakarta.el.Expression`
    Returns the original string representation of this EL expression as it was parsed.
    Specified by:
      `getExpressionString` in class `Expression`
    Returns:
      the string representation of this expression

  - ### equals

    public boolean equals(Object obj)
    Specified by:
      `equals` in class `Expression`

  - ### equals

    public boolean equals(ValueExpressionLiteral ve)
    Compares this literal value expression with another for equality.
    Parameters:
      `ve` - The other literal value expression
    Returns:
      `true` if the values are equal, `false` otherwise

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in class `Expression`

  - ### isLiteralText

    public boolean isLiteralText()
    Description copied from class: `jakarta.el.Expression`
    Returns whether this expression is a literal text expression, meaning it does not contain any variables, functions, or operators and evaluates to a constant value.
    Specified by:
      `isLiteralText` in class `Expression`
    Returns:
      `true` if this expression is a literal text, `false` otherwise

  - ### writeExternal

    public void writeExternal(ObjectOutput out) throws IOException
    Specified by:
      `writeExternal` in interface `Externalizable`
    Throws:
      `IOException`

  - ### readExternal

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    Specified by:
      `readExternal` in interface `Externalizable`
    Throws:
      `IOException`
      `ClassNotFoundException`