Add protected method to SpringELExpression

Issue: SWF-1476
This commit is contained in:
Rossen Stoyanchev
2014-03-31 21:46:17 -04:00
parent dbf71490c3
commit 70cf66111c
2 changed files with 20 additions and 1 deletions

View File

@@ -133,9 +133,17 @@ public class SpringELExpression implements Expression {
context.setVariables(getVariableValues(rootObject));
context.setTypeConverter(new StandardTypeConverter(conversionService));
context.getPropertyAccessors().addAll(propertyAccessors);
extendEvaluationContext(context);
return context;
}
/**
* Invoked every time an evaluation context is created allowing further
* initialization from sub-classes.
*/
protected void extendEvaluationContext(StandardEvaluationContext context) {
}
/**
* Turn the map of variable-names-to-expressions into a map of variable-names-to-plain-objects
* by evaluating each object against the input rootObject.

View File

@@ -78,7 +78,18 @@ public class SpringELExpressionParser implements ExpressionParser {
Class<?> expectedResultType = context.getExpectedEvaluationResultType();
org.springframework.core.convert.ConversionService cs = conversionService.getDelegateConversionService();
return new SpringELExpression(spelExpression, expressionVars, expectedResultType, cs, propertyAccessors);
return createSpringELExpression(expressionVars, spelExpression, expectedResultType, cs);
}
/**
* Create the {@link SpringELExpression}.
*/
protected SpringELExpression createSpringELExpression(Map<String, Expression> expressionVars,
org.springframework.expression.Expression spelExpression, Class<?> expectedResultType,
org.springframework.core.convert.ConversionService conversionService) {
return new SpringELExpression(spelExpression, expressionVars,
expectedResultType, conversionService, propertyAccessors);
}
private org.springframework.expression.Expression parseSpelExpression(String expression, ParserContext context) {