}
final ThymeleafEvaluationContextWrapper evaluationContext =
new ThymeleafEvaluationContextWrapper(baseEvaluationContext, contextVariables);
final SpelExpression exp = getExpression(configuration, spelExpression);
final Object evaluationRoot =
(useSelectionAsRoot?
processingContext.getExpressionSelectionEvaluationRoot() :
processingContext.getExpressionEvaluationRoot());
setVariableRestrictions(expContext, evaluationRoot, contextVariables);
if (!expContext.getPerformTypeConversion()) {
return exp.getValue(evaluationContext, evaluationRoot);
}
final IStandardConversionService conversionService =
StandardExpressions.getConversionService(configuration);
if (conversionService instanceof SpringStandardConversionService) {
// The conversion service is a mere bridge with the Spring ConversionService, therefore
// this makes use of the complete Spring type conversion infrastructure, without needing
// to manually execute the conversion.
return exp.getValue(evaluationContext, evaluationRoot, String.class);
}
// We need type conversion, but conversion service is not a mere bridge to the Spring one,
// so we need manual execution.
final Object result = exp.getValue(evaluationContext, evaluationRoot);
return conversionService.convert(configuration, processingContext, result, String.class);
} catch (final TemplateProcessingException e) {
throw e;