S - The evaluation context root object type.public class FunctionExpression<S> extends Object implements Expression
Expression that simply invokes Function.apply(Object) on its
provided Function.
This is a powerful alternative to the SpEL, when Java 8 and its Lambda support is in use.
If the target component has support for an Expression property,
a FunctionExpression can be specified instead of a
SpelExpression
as an alternative to evaluate the value from the Lambda, rather than runtime SpEL resolution.
The FunctionExpression is 'read-only', hence only getValue() operations
are allowed.
Any setValue(org.springframework.expression.EvaluationContext, java.lang.Object) operations and getValueType() related operations
throw EvaluationException.
| Constructor and Description |
|---|
FunctionExpression(java.util.function.Function<S,?> function) |
public FunctionExpression(java.util.function.Function<S,?> function)
@Nullable public Object getValue() throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public Object getValue(@Nullable Object rootObject) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public <T> T getValue(@Nullable Class<T> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public <T> T getValue(@Nullable Object rootObject, @Nullable Class<T> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public Object getValue(EvaluationContext context) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public Object getValue(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public <T> T getValue(EvaluationContext context, @Nullable Class<T> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationException@Nullable public <T> T getValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Class<T> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic Class<?> getValueType() throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(@Nullable Object rootObject) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(EvaluationContext context) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor() throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(@Nullable Object rootObject) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic void setValue(EvaluationContext context, @Nullable Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic void setValue(@Nullable Object rootObject, @Nullable Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic void setValue(EvaluationContext context, @Nullable Object rootObject, @Nullable Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic boolean isWritable(EvaluationContext context) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic boolean isWritable(EvaluationContext context, @Nullable Object rootObject) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic boolean isWritable(@Nullable Object rootObject) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic final String getExpressionString()
getExpressionString in interface Expression