expression parser simplifications
This commit is contained in:
@@ -84,6 +84,7 @@ public abstract class AbstractExpressionParser implements ExpressionParser {
|
||||
return string.startsWith(expressionPrefix) && string.endsWith(expressionSuffix);
|
||||
}
|
||||
|
||||
// TODO - add back 1.0 and 2.0 m1 semantics
|
||||
public Expression parseExpression(String expressionString, ParserContext context) throws ParserException {
|
||||
Assert.notNull(expressionString, "The expression string to parse is required");
|
||||
Expression[] expressions = parseExpressions(expressionString, context);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ParserContextImpl implements ParserContext {
|
||||
return (ExpressionVariable[]) expressionVariables.toArray(new ExpressionVariable[expressionVariables.size()]);
|
||||
}
|
||||
|
||||
public ParserContextImpl context(Class contextType) {
|
||||
public ParserContextImpl eval(Class contextType) {
|
||||
evaluationContextType = contextType;
|
||||
return ParserContextImpl.this;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ELExpressionParserTests extends TestCase {
|
||||
|
||||
public void testParseEvalExpressionWithContextCustomTestBeanResolver() {
|
||||
String expressionString = "#{specialProperty}";
|
||||
Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().context(TestBean.class));
|
||||
Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().eval(TestBean.class));
|
||||
assertEquals("Custom resolver resolved this special property!", exp.getValue(new TestBean()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user