T - The type the Supplier will return.public class SupplierExpression<T> extends Object implements Expression
Expression that simply invokes Supplier.get() on its
provided Supplier.
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 SupplierExpression can be specified instead of a
SpelExpression
as an alternative to evaluate the value from the Lambda, rather than runtime SpEL resolution.
The SupplierExpression 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 |
|---|
SupplierExpression(java.util.function.Supplier<T> supplier) |
public SupplierExpression(java.util.function.Supplier<T> supplier)
public Object getValue() throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic Object getValue(Object rootObject) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic <C> C getValue(Class<C> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic <C> C getValue(Object rootObject, Class<C> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic Object getValue(EvaluationContext context) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic <C> C getValue(EvaluationContext context, Class<C> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic <C> C getValue(EvaluationContext context, Object rootObject, Class<C> desiredResultType) throws EvaluationException
getValue in interface ExpressionEvaluationExceptionpublic Class<?> getValueType() throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(Object rootObject) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(EvaluationContext context) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic Class<?> getValueType(EvaluationContext context, Object rootObject) throws EvaluationException
getValueType in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor() throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException
getValueTypeDescriptor in interface ExpressionEvaluationExceptionpublic void setValue(EvaluationContext context, Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic void setValue(Object rootObject, Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException
setValue in interface ExpressionEvaluationExceptionpublic boolean isWritable(EvaluationContext context) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic boolean isWritable(Object rootObject) throws EvaluationException
isWritable in interface ExpressionEvaluationExceptionpublic final String getExpressionString()
getExpressionString in interface Expression