Class ValueExpression
java.lang.Object
jakarta.el.Expression
jakarta.el.ValueExpression
- All Implemented Interfaces:
Serializable
Represents a parsed EL expression that can be evaluated to produce a value.
A value expression is created by parsing an EL expression string and can be evaluated multiple times in different contexts. It supports reading values, writing values, and introspecting the expression's type and mutability.
- Since:
- EL 2.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Class<?> Returns the expected type of the result of this expression.abstract Class<?> Returns the type of the result produced by evaluating this expression.abstract <T> TEvaluates this expression and returns the result.getValueReference(ELContext context) Returns a reference to the resolved property for this expression.abstract booleanisReadOnly(ELContext context) Determines whether the property referenced by this expression is read-only.abstract voidSets the value of the property referenced by this expression.Methods inherited from class Expression
equals, getExpressionString, hashCode, isLiteralText
-
Constructor Details
-
ValueExpression
public ValueExpression()Constructs a new value expression.
-
-
Method Details
-
getValue
Evaluates this expression and returns the result.- 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
- Throws:
NullPointerException- If the supplied context isnullPropertyNotFoundException- If a property/variable resolution failed because no match was found or a match was found but was not readableELException- Wraps any exception throw whilst resolving a property or variable
-
setValue
Sets the value of the property referenced by this expression.- Parameters:
context- The EL context for this evaluationvalue- The value to set the property to which this value expression refers- Throws:
NullPointerException- If the supplied context isnullPropertyNotFoundException- If a property/variable resolution failed because no match was foundPropertyNotWritableException- If a property/variable resolution failed because a match was found but was not writableELException- Wraps any exception throw whilst resolving a property or variable
-
isReadOnly
Determines whether the property referenced by this expression is read-only.- Parameters:
context- The EL context for this evaluation- Returns:
trueif this expression is read only otherwisefalse- Throws:
NullPointerException- If the supplied context isnullPropertyNotFoundException- If a property/variable resolution failed because no match was found or a match was found but was not readableELException- Wraps any exception throw whilst resolving a property or variable
-
getType
Returns the type of the result produced by evaluating this expression.- Parameters:
context- The EL context for this evaluation- Returns:
- The type of the result of this value expression
- Throws:
NullPointerException- If the supplied context isnullPropertyNotFoundException- If a property/variable resolution failed because no match was found or a match was found but was not readableELException- Wraps any exception throw whilst resolving a property or variable
-
getExpectedType
Returns the expected type of the result of this expression.- Returns:
- The expected result type, or
Object.classif no specific type is expected
-
getValueReference
Returns a reference to the resolved property for this expression.This default implementation always returns
null. Subclasses should override this method to provide the resolved base object and property.- Parameters:
context- The EL context for this evaluation- Returns:
- This default implementation always returns
null - Since:
- EL 2.2
-