Class SpELExpressionParameterValueProvider<P extends PersistentProperty<P>>
java.lang.Object
org.springframework.data.mapping.model.SpELExpressionParameterValueProvider<P>
- All Implemented Interfaces:
ParameterValueProvider<P>
public class SpELExpressionParameterValueProvider<P extends PersistentProperty<P>>
extends Object
implements ParameterValueProvider<P>
ParameterValueProvider
that can be used to front a ParameterValueProvider
delegate to prefer a SpEL
expression evaluation over directly resolving the parameter value with the delegate.- Author:
- Oliver Gierke, Mark Paluch
-
Constructor Summary
ConstructorDescriptionSpELExpressionParameterValueProvider
(SpELExpressionEvaluator evaluator, ConversionService conversionService, ParameterValueProvider<P> delegate) -
Method Summary
Modifier and TypeMethodDescription<T> T
getParameterValue
(Parameter<T, P> parameter) Returns the value to be used for the givenParameter
(usually when entity instances are created).protected <T> T
potentiallyConvertSpelValue
(Object object, Parameter<T, P> parameter) Hook to allow to massage the value resulting from the Spel expression evaluation.
-
Constructor Details
-
SpELExpressionParameterValueProvider
public SpELExpressionParameterValueProvider(SpELExpressionEvaluator evaluator, ConversionService conversionService, ParameterValueProvider<P> delegate)
-
-
Method Details
-
getParameterValue
Description copied from interface:ParameterValueProvider
Returns the value to be used for the givenParameter
(usually when entity instances are created).- Specified by:
getParameterValue
in interfaceParameterValueProvider<P extends PersistentProperty<P>>
- Parameters:
parameter
- must not be null.- Returns:
-
potentiallyConvertSpelValue
Hook to allow to massage the value resulting from the Spel expression evaluation. Default implementation will leverage the configuredConversionService
to massage the value into the parameter type.- Parameters:
object
- the value to massage, will never be null.parameter
- theParameter
we create the value for- Returns:
-