Class SupplierExpression<T>
java.lang.Object
org.springframework.integration.expression.SupplierExpression<T>
- Type Parameters:
T- The type the Supplier will return.
- All Implemented Interfaces:
org.springframework.expression.Expression
public class SupplierExpression<T>
extends Object
implements org.springframework.expression.Expression
An
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.
- Since:
- 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringgetValue()<C> C<C> CgetValue(org.springframework.expression.EvaluationContext context) <C> C<C> CgetValue(org.springframework.expression.EvaluationContext context, Object rootObject, Class<C> desiredResultType) Class<?>Class<?>getValueType(Object rootObject) Class<?>getValueType(org.springframework.expression.EvaluationContext context) Class<?>getValueType(org.springframework.expression.EvaluationContext context, Object rootObject) org.springframework.core.convert.TypeDescriptororg.springframework.core.convert.TypeDescriptorgetValueTypeDescriptor(Object rootObject) org.springframework.core.convert.TypeDescriptorgetValueTypeDescriptor(org.springframework.expression.EvaluationContext context) org.springframework.core.convert.TypeDescriptorgetValueTypeDescriptor(org.springframework.expression.EvaluationContext context, Object rootObject) booleanisWritable(Object rootObject) booleanisWritable(org.springframework.expression.EvaluationContext context) booleanisWritable(org.springframework.expression.EvaluationContext context, Object rootObject) voidvoidvoid
-
Constructor Details
-
SupplierExpression
-
-
Method Details
-
getValue
- Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
- Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public <C> C getValue(Class<C> desiredResultType) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public <C> C getValue(Object rootObject, Class<C> desiredResultType) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public Object getValue(org.springframework.expression.EvaluationContext context) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public Object getValue(org.springframework.expression.EvaluationContext context, Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public <C> C getValue(org.springframework.expression.EvaluationContext context, Class<C> desiredResultType) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValue
public <C> C getValue(org.springframework.expression.EvaluationContext context, Object rootObject, Class<C> desiredResultType) throws org.springframework.expression.EvaluationException - Specified by:
getValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueType
- Specified by:
getValueTypein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueType
public Class<?> getValueType(Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueType
public Class<?> getValueType(org.springframework.expression.EvaluationContext context) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueType
public Class<?> getValueType(org.springframework.expression.EvaluationContext context, Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueTypeDescriptor
public org.springframework.core.convert.TypeDescriptor getValueTypeDescriptor() throws org.springframework.expression.EvaluationException- Specified by:
getValueTypeDescriptorin interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueTypeDescriptor
public org.springframework.core.convert.TypeDescriptor getValueTypeDescriptor(Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypeDescriptorin interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueTypeDescriptor
public org.springframework.core.convert.TypeDescriptor getValueTypeDescriptor(org.springframework.expression.EvaluationContext context) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypeDescriptorin interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getValueTypeDescriptor
public org.springframework.core.convert.TypeDescriptor getValueTypeDescriptor(org.springframework.expression.EvaluationContext context, Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
getValueTypeDescriptorin interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
setValue
public void setValue(org.springframework.expression.EvaluationContext context, Object value) throws org.springframework.expression.EvaluationException - Specified by:
setValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
setValue
public void setValue(Object rootObject, Object value) throws org.springframework.expression.EvaluationException - Specified by:
setValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
setValue
public void setValue(org.springframework.expression.EvaluationContext context, Object rootObject, Object value) throws org.springframework.expression.EvaluationException - Specified by:
setValuein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
isWritable
public boolean isWritable(org.springframework.expression.EvaluationContext context) throws org.springframework.expression.EvaluationException - Specified by:
isWritablein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
isWritable
public boolean isWritable(org.springframework.expression.EvaluationContext context, Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
isWritablein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
isWritable
public boolean isWritable(Object rootObject) throws org.springframework.expression.EvaluationException - Specified by:
isWritablein interfaceorg.springframework.expression.Expression- Throws:
org.springframework.expression.EvaluationException
-
getExpressionString
- Specified by:
getExpressionStringin interfaceorg.springframework.expression.Expression
-