- java.lang.Object
-
- jakarta.el.Expression
-
- jakarta.el.ValueExpression
-
- org.omnifaces.el.ReadOnlyValueExpression
-
- All Implemented Interfaces:
Serializable
public class ReadOnlyValueExpression extends ValueExpression
Implementation of a read only value expression that can be used when the value is not yet available at construction time, or when the value would be too expensive to create and it's not yet clear if the expression will actually be evaluated.A callback (lambda in Java 8) that obtains the value can be provided, or the getValue() method can be overridden.
- Since:
- 2.0
- Author:
- Arjan Tijms
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyValueExpression()
Construct a read only value expression.ReadOnlyValueExpression(Class<?> expectedType)
Construct a read only value expression.ReadOnlyValueExpression(Class<?> expectedType, Callback.SerializableReturning<Object> callback)
Construct a read only value expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
Callback.SerializableReturning<Object>
getCallbackReturning()
Returns the functional interface that will be called when the value expression is resolvedClass<?>
getExpectedType()
String
getExpressionString()
Class<?>
getType(ELContext context)
Object
getValue(ELContext context)
int
hashCode()
boolean
isLiteralText()
boolean
isReadOnly(ELContext context)
void
setCallbackReturning(Callback.SerializableReturning<Object> callbackReturning)
Sets the functional interface that will be called when the value expression is resolvedvoid
setValue(ELContext context, Object value)
-
Methods inherited from class jakarta.el.ValueExpression
getValueReference
-
-
-
-
Constructor Detail
-
ReadOnlyValueExpression
public ReadOnlyValueExpression(Class<?> expectedType, Callback.SerializableReturning<Object> callback)
Construct a read only value expression.- Parameters:
expectedType
- The type the result of the expression will be coerced to after evaluation.callback
- The functional interface that will be called when the value expression is resolved.
-
ReadOnlyValueExpression
public ReadOnlyValueExpression(Class<?> expectedType)
Construct a read only value expression.- Parameters:
expectedType
- The type the result of the expression will be coerced to after evaluation.
-
ReadOnlyValueExpression
public ReadOnlyValueExpression()
Construct a read only value expression.
-
-
Method Detail
-
getValue
public Object getValue(ELContext context)
- Specified by:
getValue
in classValueExpression
-
setValue
public void setValue(ELContext context, Object value)
- Specified by:
setValue
in classValueExpression
-
isReadOnly
public boolean isReadOnly(ELContext context)
- Specified by:
isReadOnly
in classValueExpression
-
getType
public Class<?> getType(ELContext context)
- Specified by:
getType
in classValueExpression
-
getExpectedType
public Class<?> getExpectedType()
- Specified by:
getExpectedType
in classValueExpression
-
getExpressionString
public String getExpressionString()
- Specified by:
getExpressionString
in classExpression
-
equals
public boolean equals(Object object)
- Specified by:
equals
in classExpression
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classExpression
-
isLiteralText
public boolean isLiteralText()
- Specified by:
isLiteralText
in classExpression
-
getCallbackReturning
public Callback.SerializableReturning<Object> getCallbackReturning()
Returns the functional interface that will be called when the value expression is resolved- Returns:
- the functional interface that will be called when the value expression is resolved
- Since:
- 2.1
-
setCallbackReturning
public void setCallbackReturning(Callback.SerializableReturning<Object> callbackReturning)
Sets the functional interface that will be called when the value expression is resolved- Parameters:
callbackReturning
- functional interface returning what the value expression will return- Since:
- 2.1
-
-