expression parser simplifications

This commit is contained in:
Keith Donald
2008-01-18 07:00:40 +00:00
parent bc5adf803f
commit 87bb511460
5 changed files with 15 additions and 12 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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()));
}