diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/ParserContextImpl.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/FluentParserContext.java similarity index 83% rename from spring-binding/src/main/java/org/springframework/binding/expression/support/ParserContextImpl.java rename to spring-binding/src/main/java/org/springframework/binding/expression/support/FluentParserContext.java index 77262429..65aae654 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/ParserContextImpl.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/FluentParserContext.java @@ -11,7 +11,7 @@ import org.springframework.binding.expression.ParserContext; * Default implementation of the ParserContext interface that has a fluent API for building parser context attributes. * @author Keith Donald */ -public class ParserContextImpl implements ParserContext { +public class FluentParserContext implements ParserContext { private Class evaluationContextType; @@ -24,12 +24,12 @@ public class ParserContextImpl implements ParserContext { /** * Create a new parser context, initially with all context attributes as null. Post construction, call one or more * of the fluent builder methods to configure this context. - * @see #eval(Class) - * @see #expect(Class) + * @see #evaluate(Class) + * @see #expectResult(Class) * @see #variable(ExpressionVariable) * @see #template() */ - public ParserContextImpl() { + public FluentParserContext() { init(); } @@ -54,7 +54,7 @@ public class ParserContextImpl implements ParserContext { * @param contextType the type of context object the parsed expression will evaluate in * @return this */ - public ParserContextImpl eval(Class contextType) { + public FluentParserContext evaluate(Class contextType) { evaluationContextType = contextType; return this; } @@ -64,7 +64,7 @@ public class ParserContextImpl implements ParserContext { * @param resultType the type of result object the parsed expression should return when evaluated * @return this */ - public ParserContextImpl expect(Class resultType) { + public FluentParserContext expectResult(Class resultType) { evaluationResultType = resultType; return this; } @@ -74,7 +74,7 @@ public class ParserContextImpl implements ParserContext { * @param variable the expression variable * @return this */ - public ParserContextImpl variable(ExpressionVariable variable) { + public FluentParserContext variable(ExpressionVariable variable) { expressionVariables.add(variable); return this; } @@ -84,7 +84,7 @@ public class ParserContextImpl implements ParserContext { * @param variables the expression variables * @return this */ - public ParserContextImpl variables(ExpressionVariable[] variables) { + public FluentParserContext variables(ExpressionVariable[] variables) { expressionVariables.addAll(Arrays.asList(variables)); return this; } @@ -93,7 +93,7 @@ public class ParserContextImpl implements ParserContext { * Sets a flag indicating the expression to parse is a template. * @return this */ - public ParserContextImpl template() { + public FluentParserContext template() { template = true; return this; } diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java index 029c050f..d3fab5f1 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java @@ -15,7 +15,7 @@ import org.jboss.el.ExpressionFactoryImpl; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionVariable; import org.springframework.binding.expression.ParserException; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; public class ELExpressionParserTests extends TestCase { @@ -53,7 +53,8 @@ public class ELExpressionParserTests extends TestCase { public void testParseSimpleEvalExpressionNoEvalContextWithTypeCoersion() { String expressionString = "3 + 4"; - Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().expect(Integer.class)); + Expression exp = parser + .parseExpression(expressionString, new FluentParserContext().expectResult(Integer.class)); assertEquals(new Integer(7), exp.getValue(null)); } @@ -65,13 +66,13 @@ public class ELExpressionParserTests extends TestCase { public void testParseEvalExpressionWithContextTypeCoersion() { String expressionString = "maximum"; - Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().expect(Long.class)); + Expression exp = parser.parseExpression(expressionString, new FluentParserContext().expectResult(Long.class)); assertEquals(new Long(2), exp.getValue(new TestBean())); } public void testParseEvalExpressionWithContextCustomTestBeanResolver() { String expressionString = "specialProperty"; - Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().eval(TestBean.class)); + Expression exp = parser.parseExpression(expressionString, new FluentParserContext().evaluate(TestBean.class)); assertEquals("Custom resolver resolved this special property!", exp.getValue(new TestBean())); } @@ -81,25 +82,32 @@ public class ELExpressionParserTests extends TestCase { assertEquals("value", exp.getValue(null)); } + public void testParseTemplateExpression() { + String expressionString = "text text text #{value} text text text#{value}"; + Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template()); + TestBean target = new TestBean(); + assertEquals("text text text foo text text textfoo", exp.getValue(target)); + } + public void testParseTemplateExpressionWithVariables() { String expressionString = "#{value}#{max}"; - Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().template().variable( + Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template().variable( new ExpressionVariable("max", "maximum"))); TestBean target = new TestBean(); assertEquals("foo2", exp.getValue(target)); } public void testVariablesWithCoersion() { - Expression exp = parser.parseExpression("max", new ParserContextImpl().variable(new ExpressionVariable("max", - "maximum", new ParserContextImpl().expect(Long.class)))); + Expression exp = parser.parseExpression("max", new FluentParserContext().variable(new ExpressionVariable("max", + "maximum", new FluentParserContext().expectResult(Long.class)))); TestBean target = new TestBean(); assertEquals(new Long(2), exp.getValue(target)); } public void testTemplateNestedVariables() { String expressionString = "#{value}#{max}"; - Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().template().variable( - new ExpressionVariable("max", "#{maximum}#{var}", new ParserContextImpl().template().variable( + Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template().variable( + new ExpressionVariable("max", "#{maximum}#{var}", new FluentParserContext().template().variable( new ExpressionVariable("var", "'bar'"))))); TestBean target = new TestBean(); assertEquals("foo2bar", exp.getValue(target)); diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/ognl/OgnlExpressionParserTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/ognl/OgnlExpressionParserTests.java index f8596de2..28c778aa 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/ognl/OgnlExpressionParserTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/ognl/OgnlExpressionParserTests.java @@ -20,7 +20,7 @@ import junit.framework.TestCase; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionVariable; import org.springframework.binding.expression.ParserException; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; public class OgnlExpressionParserTests extends TestCase { @@ -56,20 +56,20 @@ public class OgnlExpressionParserTests extends TestCase { public void testParseTemplateSimpleLiteral() { String exp = "flag"; - Expression e = parser.parseExpression(exp, new ParserContextImpl().template()); + Expression e = parser.parseExpression(exp, new FluentParserContext().template()); assertNotNull(e); assertEquals("flag", e.getValue(bean)); } public void testParseTemplateEmpty() { - Expression e = parser.parseExpression("", new ParserContextImpl().template()); + Expression e = parser.parseExpression("", new FluentParserContext().template()); assertNotNull(e); assertEquals("", e.getValue(bean)); } public void testParseTemplateComposite() { String exp = "hello ${flag} ${flag} ${flag}"; - Expression e = parser.parseExpression(exp, new ParserContextImpl().template()); + Expression e = parser.parseExpression(exp, new FluentParserContext().template()); assertNotNull(e); String str = (String) e.getValue(bean); assertEquals("hello false false false", str); @@ -78,7 +78,7 @@ public class OgnlExpressionParserTests extends TestCase { public void testTemplateEnclosedCompositeNotSupported() { String exp = "${hello ${flag} ${flag} ${flag}}"; try { - parser.parseExpression(exp, new ParserContextImpl().template()); + parser.parseExpression(exp, new FluentParserContext().template()); fail("Should've failed - not intended use"); } catch (ParserException e) { } @@ -86,7 +86,7 @@ public class OgnlExpressionParserTests extends TestCase { public void testSyntaxError1() { try { - parser.parseExpression("${", new ParserContextImpl().template()); + parser.parseExpression("${", new FluentParserContext().template()); fail(); } catch (ParserException e) { } @@ -100,7 +100,7 @@ public class OgnlExpressionParserTests extends TestCase { public void testSyntaxError2() { try { - parser.parseExpression("${}", new ParserContextImpl().template()); + parser.parseExpression("${}", new FluentParserContext().template()); fail("Should've failed - not intended use"); } catch (ParserException e) { } @@ -115,40 +115,40 @@ public class OgnlExpressionParserTests extends TestCase { public void testCollectionConstructionSyntax() { // lists parser.parseExpression("name in {null, \"Untitled\"}", null); - parser.parseExpression("${name in {null, \"Untitled\"}}", new ParserContextImpl().template()); + parser.parseExpression("${name in {null, \"Untitled\"}}", new FluentParserContext().template()); // native arrays parser.parseExpression("new int[] {1, 2, 3}", null); - parser.parseExpression("${new int[] {1, 2, 3}}", new ParserContextImpl().template()); + parser.parseExpression("${new int[] {1, 2, 3}}", new FluentParserContext().template()); // maps parser.parseExpression("#{ 'foo' : 'foo value', 'bar' : 'bar value' }", null); - parser.parseExpression("${#{ 'foo' : 'foo value', 'bar' : 'bar value' }}", new ParserContextImpl().template()); + parser.parseExpression("${#{ 'foo' : 'foo value', 'bar' : 'bar value' }}", new FluentParserContext().template()); parser.parseExpression("#@java.util.LinkedHashMap@{ 'foo' : 'foo value', 'bar' : 'bar value' }", null); parser.parseExpression("${#@java.util.LinkedHashMap@{ 'foo' : 'foo value', 'bar' : 'bar value' }}", - new ParserContextImpl().template()); + new FluentParserContext().template()); // complex examples parser.parseExpression("b,#{1:2}", null); - parser.parseExpression("${b,#{1:2}}", new ParserContextImpl().template()); - parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new ParserContextImpl().template()); + parser.parseExpression("${b,#{1:2}}", new FluentParserContext().template()); + parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new FluentParserContext().template()); } public void testVariables() { - Expression exp = parser.parseExpression("#var", new ParserContextImpl().variable(new ExpressionVariable("var", + Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable("var", "flag"))); assertEquals(false, ((Boolean) exp.getValue(bean)).booleanValue()); } public void testVariablesWithCoersion() { - Expression exp = parser.parseExpression("#var", new ParserContextImpl().variable(new ExpressionVariable("var", - "number", new ParserContextImpl().expect(Long.class)))); + Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable("var", + "number", new FluentParserContext().expectResult(Long.class)))); assertEquals(new Long(0), exp.getValue(bean)); } public void testNestedVariablesWithTemplates() { - Expression exp = parser.parseExpression("#var", new ParserContextImpl() - .variable(new ExpressionVariable("var", "${flag}${#var}", new ParserContextImpl().template().variable( + Expression exp = parser.parseExpression("#var", new FluentParserContext() + .variable(new ExpressionVariable("var", "${flag}${#var}", new FluentParserContext().template().variable( new ExpressionVariable("var", "number"))))); assertEquals("false0", exp.getValue(bean)); } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfFinalResponseActionTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfFinalResponseActionTests.java index 98a9a6a5..690f7270 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfFinalResponseActionTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfFinalResponseActionTests.java @@ -20,7 +20,7 @@ import junit.framework.TestCase; import org.easymock.EasyMock; import org.jboss.el.ExpressionFactoryImpl; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; @@ -70,8 +70,8 @@ public class JsfFinalResponseActionTests extends TestCase { jsfMock.facesContext().setViewRoot(null); jsfMock.facesContext().getApplication().setViewHandler(viewHandler); lifecycle = new TestLifecycle(jsfMock.lifecycle()); - factory = new JsfViewFactory(parser.parseExpression("#{'" + VIEW_ID + "'}", new ParserContextImpl().template() - .eval(RequestContext.class).expect(String.class)), null, lifecycle); + factory = new JsfViewFactory(parser.parseExpression("#{'" + VIEW_ID + "'}", new FluentParserContext().template() + .evaluate(RequestContext.class).expectResult(String.class)), null, lifecycle); RequestContextHolder.setRequestContext(context); MockExternalContext ext = new MockExternalContext(); ext.setNativeContext(new MockServletContext()); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java index 643f9e48..4e312afc 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java @@ -18,7 +18,7 @@ import junit.framework.TestCase; import org.easymock.EasyMock; import org.jboss.el.ExpressionFactoryImpl; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.faces.ui.AjaxViewRoot; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -93,8 +93,8 @@ public class JsfViewFactoryTests extends TestCase { public final void testGetView_Create() { lifecycle = new NoExecutionLifecycle(jsfMock.lifecycle()); - factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new ParserContextImpl().template().eval( - RequestContext.class).expect(String.class)), null, lifecycle); + factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new FluentParserContext().template().evaluate( + RequestContext.class).expectResult(String.class)), null, lifecycle); UIViewRoot newRoot = new UIViewRoot(); newRoot.setViewId(VIEW_ID); @@ -116,8 +116,8 @@ public class JsfViewFactoryTests extends TestCase { public final void testGetView_Restore() { lifecycle = new NoExecutionLifecycle(jsfMock.lifecycle()); - factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new ParserContextImpl().template().eval( - RequestContext.class).expect(String.class)), null, lifecycle); + factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new FluentParserContext().template().evaluate( + RequestContext.class).expectResult(String.class)), null, lifecycle); UIViewRoot existingRoot = new UIViewRoot(); existingRoot.setViewId(VIEW_ID); @@ -140,8 +140,8 @@ public class JsfViewFactoryTests extends TestCase { public final void testGetView_Restore_Ajax() { lifecycle = new NoExecutionLifecycle(jsfMock.lifecycle()); - factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new ParserContextImpl().template().eval( - RequestContext.class).expect(String.class)), null, lifecycle); + factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new FluentParserContext().template().evaluate( + RequestContext.class).expectResult(String.class)), null, lifecycle); UIViewRoot existingRoot = new UIViewRoot(); existingRoot.setViewId(VIEW_ID); @@ -168,8 +168,8 @@ public class JsfViewFactoryTests extends TestCase { public final void testGetView_ExternalViewRoot() { lifecycle = new NoExecutionLifecycle(jsfMock.lifecycle()); - factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new ParserContextImpl().template().eval( - RequestContext.class).expect(String.class)), null, lifecycle); + factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new FluentParserContext().template().evaluate( + RequestContext.class).expectResult(String.class)), null, lifecycle); UIViewRoot newRoot = new UIViewRoot(); newRoot.setViewId(VIEW_ID); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java index aa9a92c8..4bb632f0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java @@ -17,7 +17,7 @@ import org.springframework.binding.expression.EvaluationException; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; import org.springframework.binding.expression.ParserContext; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.binding.mapping.Mapper; import org.springframework.binding.mapping.impl.DefaultMapper; import org.springframework.binding.mapping.impl.DefaultMapping; @@ -356,8 +356,8 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } else { value = name; } - Expression source = parser.parseExpression(name, new ParserContextImpl().eval(MutableAttributeMap.class)); - Expression target = parser.parseExpression(value, new ParserContextImpl().eval(RequestContext.class)); + Expression source = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class)); + Expression target = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class)); DefaultMapping mapping = new DefaultMapping(source, target); parseAndSetMappingConversionExecutor(input, mapping); parseAndSetMappingRequired(input, mapping); @@ -385,8 +385,8 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } else { value = name; } - Expression source = parser.parseExpression(value, new ParserContextImpl().eval(RequestContext.class)); - Expression target = parser.parseExpression(name, new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression source = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class)); + Expression target = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class)); DefaultMapping mapping = new DefaultMapping(source, target); parseAndSetMappingConversionExecutor(input, mapping); parseAndSetMappingRequired(input, mapping); @@ -414,8 +414,8 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } else { value = name; } - Expression source = parser.parseExpression(value, new ParserContextImpl().eval(RequestContext.class)); - Expression target = parser.parseExpression(name, new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression source = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class)); + Expression target = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class)); DefaultMapping mapping = new DefaultMapping(source, target); parseAndSetMappingConversionExecutor(output, mapping); parseAndSetMappingRequired(output, mapping); @@ -443,8 +443,8 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } else { value = name; } - Expression source = parser.parseExpression(name, new ParserContextImpl().eval(MutableAttributeMap.class)); - Expression target = parser.parseExpression(value, new ParserContextImpl().eval(RequestContext.class)); + Expression source = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class)); + Expression target = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class)); DefaultMapping mapping = new DefaultMapping(source, target); parseAndSetMappingConversionExecutor(output, mapping); parseAndSetMappingRequired(output, mapping); @@ -481,7 +481,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { MutableAttributeMap attributes = parseMetaAttributes(state.getAttributes()); if (state.getModel() != null) { attributes.put("model", getLocalContext().getExpressionParser().parseExpression(state.getModel(), - new ParserContextImpl().eval(RequestContext.class))); + new FluentParserContext().evaluate(RequestContext.class))); } parseAndPutSecured(state.getSecured(), attributes); getLocalContext().getFlowArtifactFactory().createViewState(state.getId(), flow, @@ -540,22 +540,22 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } else { view = getLocalContext().getViewFactoryCreator().getViewIdByConvention(stateId); Expression viewId = getLocalContext().getExpressionParser().parseExpression(view, - new ParserContextImpl().template().eval(RequestContext.class).expect(String.class)); + new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)); return createViewFactory(viewId); } } else if (view.startsWith("externalRedirect:")) { String encodedUrl = view.substring("externalRedirect:".length()); Expression externalUrl = getLocalContext().getExpressionParser().parseExpression(encodedUrl, - new ParserContextImpl().template().eval(RequestContext.class).expect(String.class)); + new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)); return new ActionExecutingViewFactory(new ExternalRedirectAction(externalUrl)); } else if (view.startsWith("flowRedirect:")) { String flowRedirect = view.substring("flowRedirect:".length()); Expression expression = getLocalContext().getExpressionParser().parseExpression(flowRedirect, - new ParserContextImpl().template().eval(RequestContext.class).expect(String.class)); + new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)); return new ActionExecutingViewFactory(new FlowDefinitionRedirectAction(expression)); } else { Expression viewId = getLocalContext().getExpressionParser().parseExpression(view, - new ParserContextImpl().template().eval(RequestContext.class).expect(String.class)); + new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)); return createViewFactory(viewId); } } @@ -609,7 +609,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { private Transition parseThen(IfModel ifModel) { Expression test = getLocalContext().getExpressionParser().parseExpression(ifModel.getTest(), - new ParserContextImpl().eval(RequestContext.class).expect(Boolean.class)); + new FluentParserContext().evaluate(RequestContext.class).expectResult(Boolean.class)); TransitionCriteria matchingCriteria = new DefaultTransitionCriteria(test); TargetStateResolver targetStateResolver = (TargetStateResolver) fromStringTo(TargetStateResolver.class) .execute(ifModel.getThen()); @@ -625,7 +625,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { private Expression parseSubflowExpression(String subflow) { Expression subflowId = getLocalContext().getExpressionParser().parseExpression(subflow, - new ParserContextImpl().template().eval(RequestContext.class).expect(String.class)); + new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)); return new SubflowExpression(subflowId, getLocalContext().getFlowDefinitionLocator()); } @@ -754,14 +754,14 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { private Action parseEvaluateAction(EvaluateModel evaluate) { String expressionString = evaluate.getExpression(); Expression expression = getLocalContext().getExpressionParser().parseExpression(expressionString, - new ParserContextImpl().eval(RequestContext.class)); + new FluentParserContext().evaluate(RequestContext.class)); return new EvaluateAction(expression, parseEvaluationActionResultExposer(evaluate)); } private ActionResultExposer parseEvaluationActionResultExposer(EvaluateModel evaluate) { if (StringUtils.hasText(evaluate.getResult())) { Expression resultExpression = getLocalContext().getExpressionParser().parseExpression(evaluate.getResult(), - new ParserContextImpl().eval(RequestContext.class)); + new FluentParserContext().evaluate(RequestContext.class)); Class expectedResultType = null; if (StringUtils.hasText(evaluate.getResultType())) { expectedResultType = (Class) fromStringTo(Class.class).execute(evaluate.getResultType()); @@ -776,7 +776,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { private Action parseRenderAction(RenderModel render) { String[] fragmentExpressionStrings = StringUtils.commaDelimitedListToStringArray(render.getFragments()); fragmentExpressionStrings = StringUtils.trimArrayElements(fragmentExpressionStrings); - ParserContext context = new ParserContextImpl().template().eval(RequestContext.class).expect(String.class); + ParserContext context = new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class); Expression[] fragments = new Expression[fragmentExpressionStrings.length]; for (int i = 0; i < fragmentExpressionStrings.length; i++) { String fragment = fragmentExpressionStrings[i]; @@ -787,9 +787,9 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { private Action parseSetAction(SetModel set) { Expression nameExpression = getLocalContext().getExpressionParser().parseExpression(set.getName(), - new ParserContextImpl().eval(RequestContext.class)); + new FluentParserContext().evaluate(RequestContext.class)); Expression valueExpression = getLocalContext().getExpressionParser().parseExpression(set.getValue(), - new ParserContextImpl().eval(RequestContext.class)); + new FluentParserContext().evaluate(RequestContext.class)); Class expectedType = null; if (StringUtils.hasText(set.getType())) { expectedType = (Class) fromStringTo(Class.class).execute(set.getType()); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTargetStateResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTargetStateResolver.java index 20b24c86..7073fa1f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTargetStateResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTargetStateResolver.java @@ -18,7 +18,7 @@ package org.springframework.webflow.engine.builder.support; import org.springframework.binding.convert.converters.AbstractConverter; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.util.StringUtils; import org.springframework.webflow.engine.TargetStateResolver; import org.springframework.webflow.engine.builder.FlowBuilderContext; @@ -69,8 +69,8 @@ class TextToTargetStateResolver extends AbstractConverter { return null; } ExpressionParser parser = flowBuilderContext.getExpressionParser(); - Expression expression = parser.parseExpression(targetStateId, new ParserContextImpl().template().eval( - RequestContext.class).expect(String.class)); + Expression expression = parser.parseExpression(targetStateId, new FluentParserContext().template().evaluate( + RequestContext.class).expectResult(String.class)); return new DefaultTargetStateResolver(expression); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java index 59da9af9..61243281 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java @@ -20,7 +20,7 @@ import org.springframework.binding.convert.converters.AbstractConverter; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; import org.springframework.binding.expression.ExpressionVariable; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.util.StringUtils; import org.springframework.webflow.engine.TransitionCriteria; import org.springframework.webflow.engine.WildcardTransitionCriteria; @@ -91,7 +91,7 @@ class TextToTransitionCriteria extends AbstractConverter { */ protected TransitionCriteria createBooleanExpressionTransitionCriteria(String encodedCriteria, ExpressionParser parser) throws ConversionException { - Expression expression = parser.parseExpression(encodedCriteria, new ParserContextImpl().template().eval( + Expression expression = parser.parseExpression(encodedCriteria, new FluentParserContext().template().evaluate( RequestContext.class).variable(new ExpressionVariable("result", "lastEvent.id"))); return new DefaultTransitionCriteria(expression); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java index 5044d806..383a2a6f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java @@ -5,7 +5,7 @@ import java.util.List; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.binding.format.Formatter; import org.springframework.binding.format.FormatterRegistry; import org.springframework.binding.mapping.MappingResult; @@ -65,7 +65,7 @@ public class BindingModel extends ViewRenderingErrors { } private Expression parseFieldExpression(String field) { - return expressionParser.parseExpression(field, new ParserContextImpl().eval(boundObject.getClass())); + return expressionParser.parseExpression(field, new FluentParserContext().evaluate(boundObject.getClass())); } private Object getFormattedValue(String field) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/MvcView.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/MvcView.java index 90ba357e..0c622075 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/MvcView.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/MvcView.java @@ -29,7 +29,7 @@ import org.springframework.binding.convert.ConversionExecutor; import org.springframework.binding.expression.EvaluationException; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.binding.format.Formatter; import org.springframework.binding.format.FormatterRegistry; import org.springframework.binding.format.InvalidFormatException; @@ -177,8 +177,8 @@ class MvcView implements View { for (Iterator it = requestParameters.asMap().keySet().iterator(); it.hasNext();) { String name = (String) it.next(); Expression source = expressionParser - .parseExpression(name, new ParserContextImpl().eval(MapAdaptable.class)); - Expression target = expressionParser.parseExpression(name, new ParserContextImpl().eval(model.getClass())); + .parseExpression(name, new FluentParserContext().evaluate(MapAdaptable.class)); + Expression target = expressionParser.parseExpression(name, new FluentParserContext().evaluate(model.getClass())); DefaultMapping mapping = new DefaultMapping(source, target); mapping.setTypeConverter(new FormatterBackedMappingConversionExecutor(formatterRegistry)); mapper.addMapping(mapping); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java index 8338b8f1..c6b45848 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java @@ -21,7 +21,7 @@ import org.springframework.binding.expression.EvaluationException; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; import org.springframework.binding.expression.support.AbstractGetValueExpression; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.binding.mapping.impl.DefaultMapper; import org.springframework.binding.mapping.impl.DefaultMapping; import org.springframework.webflow.core.collection.MutableAttributeMap; @@ -69,8 +69,8 @@ public class EndStateTests extends TestCase { EndState state = new EndState(flow, "end"); DefaultMapper mapper = new DefaultMapper(); ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser(); - Expression x = parser.parseExpression("flowScope.x", new ParserContextImpl().eval(RequestContext.class)); - Expression y = parser.parseExpression("y", new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression x = parser.parseExpression("flowScope.x", new FluentParserContext().evaluate(RequestContext.class)); + Expression y = parser.parseExpression("y", new FluentParserContext().evaluate(MutableAttributeMap.class)); mapper.addMapping(new DefaultMapping(x, y)); state.setOutputMapper(mapper); MockRequestControlContext context = new MockRequestControlContext(flow); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java index 96f88d30..ade0d504 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java @@ -21,7 +21,7 @@ import junit.framework.TestCase; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.binding.mapping.impl.DefaultMapper; import org.springframework.binding.mapping.impl.DefaultMapping; import org.springframework.webflow.TestException; @@ -201,8 +201,8 @@ public class FlowTests extends TestCase { public void testStartWithMapper() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser(); - Expression x = parser.parseExpression("attr", new ParserContextImpl().eval(AttributeMap.class)); - Expression y = parser.parseExpression("flowScope.attr", new ParserContextImpl().eval(RequestContext.class)); + Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class)); + Expression y = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setInputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); @@ -215,8 +215,8 @@ public class FlowTests extends TestCase { public void testStartWithMapperButNoInput() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser(); - Expression x = parser.parseExpression("attr", new ParserContextImpl().eval(AttributeMap.class)); - Expression y = parser.parseExpression("flowScope.attr", new ParserContextImpl().eval(RequestContext.class)); + Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class)); + Expression y = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setInputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); @@ -304,8 +304,8 @@ public class FlowTests extends TestCase { public void testEndWithOutputMapper() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser(); - Expression x = parser.parseExpression("flowScope.attr", new ParserContextImpl().eval(RequestContext.class)); - Expression y = parser.parseExpression("attr", new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression x = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); + Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setOutputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/expression/WebFlowOgnlExpressionParserTests.java b/spring-webflow/src/test/java/org/springframework/webflow/expression/WebFlowOgnlExpressionParserTests.java index be82e226..e4949484 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/expression/WebFlowOgnlExpressionParserTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/expression/WebFlowOgnlExpressionParserTests.java @@ -6,7 +6,7 @@ import junit.framework.TestCase; import org.springframework.beans.factory.support.StaticListableBeanFactory; import org.springframework.binding.expression.Expression; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.webflow.TestBean; import org.springframework.webflow.action.FormAction; import org.springframework.webflow.core.collection.AttributeMap; @@ -23,8 +23,8 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testResolveMap() { LocalAttributeMap map = new LocalAttributeMap(); map.put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(AttributeMap.class)); - Expression exp2 = parser.parseExpression("bogus", new ParserContextImpl().eval(AttributeMap.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(AttributeMap.class)); + Expression exp2 = parser.parseExpression("bogus", new FluentParserContext().evaluate(AttributeMap.class)); assertEquals("bar", exp.getValue(map)); assertEquals(null, exp2.getValue(map)); } @@ -32,8 +32,8 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testSetMap() { LocalAttributeMap map = new LocalAttributeMap(); map.put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(MutableAttributeMap.class)); - Expression exp2 = parser.parseExpression("bogus", new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(MutableAttributeMap.class)); + Expression exp2 = parser.parseExpression("bogus", new FluentParserContext().evaluate(MutableAttributeMap.class)); exp.setValue(map, "baz"); exp2.setValue(map, "new"); assertEquals("baz", exp.getValue(map)); @@ -42,29 +42,29 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testResolveFlowRequestContext() { MockRequestContext context = new MockRequestContext(); - Expression exp = parser.parseExpression("flowRequestContext", new ParserContextImpl() - .eval(RequestContext.class)); + Expression exp = parser.parseExpression("flowRequestContext", new FluentParserContext() + .evaluate(RequestContext.class)); assertSame(context, exp.getValue(context)); } public void testResolveCurrentUser() { MockRequestContext context = new MockRequestContext(); context.getMockExternalContext().setCurrentUser("Keith"); - Expression exp = parser.parseExpression("currentUser", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("currentUser", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("Keith", ((Principal) exp.getValue(context)).getName()); } public void testResolveRequestScope() { MockRequestContext context = new MockRequestContext(); context.getRequestScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetRequestScope() { MockRequestContext context = new MockRequestContext(); context.getRequestScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -72,14 +72,14 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testResolveFlashScope() { MockRequestContext context = new MockRequestContext(); context.getFlashScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetFlashScope() { MockRequestContext context = new MockRequestContext(); context.getFlashScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -87,14 +87,14 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testResolveFlowScope() { MockRequestContext context = new MockRequestContext(); context.getFlowScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetFlowScope() { MockRequestContext context = new MockRequestContext(); context.getFlowScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -102,14 +102,14 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testResolveConversationScope() { MockRequestContext context = new MockRequestContext(); context.getConversationScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetConversationScope() { MockRequestContext context = new MockRequestContext(); context.getConversationScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -122,7 +122,7 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { beanFactory.addBean("multiAction", new FormAction(TestBean.class)); context.getRootFlow().setBeanFactory(beanFactory); context.getConversationScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } @@ -131,7 +131,7 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); beanFactory.addBean("action", new TestAction()); context.getRootFlow().setBeanFactory(beanFactory); - Expression exp = parser.parseExpression("action", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("action", new FluentParserContext().evaluate(RequestContext.class)); assertSame(beanFactory.getBean("action"), exp.getValue(context)); } @@ -140,8 +140,8 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); beanFactory.addBean("multiAction", new FormAction()); context.getRootFlow().setBeanFactory(beanFactory); - Expression exp = parser.parseExpression("multiAction.setupForm", new ParserContextImpl() - .eval(RequestContext.class)); + Expression exp = parser.parseExpression("multiAction.setupForm", new FluentParserContext() + .evaluate(RequestContext.class)); AnnotatedAction action = (AnnotatedAction) exp.getValue(context); assertSame(beanFactory.getBean("multiAction"), action.getTargetAction()); assertEquals("setupForm", action.getMethod()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/expression/el/WebFlowELExpressionParserTests.java b/spring-webflow/src/test/java/org/springframework/webflow/expression/el/WebFlowELExpressionParserTests.java index 1fbb9635..714b6646 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/expression/el/WebFlowELExpressionParserTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/expression/el/WebFlowELExpressionParserTests.java @@ -7,7 +7,7 @@ import junit.framework.TestCase; import org.springframework.beans.factory.support.StaticListableBeanFactory; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.el.DefaultExpressionFactoryUtils; -import org.springframework.binding.expression.support.ParserContextImpl; +import org.springframework.binding.expression.support.FluentParserContext; import org.springframework.webflow.TestBean; import org.springframework.webflow.action.FormAction; import org.springframework.webflow.core.collection.AttributeMap; @@ -25,8 +25,8 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testResolveMap() { LocalAttributeMap map = new LocalAttributeMap(); map.put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(AttributeMap.class)); - Expression exp2 = parser.parseExpression("bogus", new ParserContextImpl().eval(AttributeMap.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(AttributeMap.class)); + Expression exp2 = parser.parseExpression("bogus", new FluentParserContext().evaluate(AttributeMap.class)); assertEquals("bar", exp.getValue(map)); assertEquals(null, exp2.getValue(map)); } @@ -34,8 +34,8 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testSetMap() { LocalAttributeMap map = new LocalAttributeMap(); map.put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(MutableAttributeMap.class)); - Expression exp2 = parser.parseExpression("bogus", new ParserContextImpl().eval(MutableAttributeMap.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(MutableAttributeMap.class)); + Expression exp2 = parser.parseExpression("bogus", new FluentParserContext().evaluate(MutableAttributeMap.class)); exp.setValue(map, "baz"); exp2.setValue(map, "new"); assertEquals("baz", exp.getValue(map)); @@ -44,29 +44,29 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testResolveFlowRequestContext() { MockRequestContext context = new MockRequestContext(); - Expression exp = parser.parseExpression("flowRequestContext", new ParserContextImpl() - .eval(RequestContext.class)); + Expression exp = parser.parseExpression("flowRequestContext", new FluentParserContext() + .evaluate(RequestContext.class)); assertSame(context, exp.getValue(context)); } public void testResolveCurrentUser() { MockRequestContext context = new MockRequestContext(); context.getMockExternalContext().setCurrentUser("Keith"); - Expression exp = parser.parseExpression("currentUser", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("currentUser", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("Keith", ((Principal) exp.getValue(context)).getName()); } public void testResolveRequestScope() { MockRequestContext context = new MockRequestContext(); context.getRequestScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetRequestScope() { MockRequestContext context = new MockRequestContext(); context.getRequestScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -74,14 +74,14 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testResolveFlashScope() { MockRequestContext context = new MockRequestContext(); context.getFlashScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetFlashScope() { MockRequestContext context = new MockRequestContext(); context.getFlashScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -89,14 +89,14 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testResolveFlowScope() { MockRequestContext context = new MockRequestContext(); context.getFlowScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetFlowScope() { MockRequestContext context = new MockRequestContext(); context.getFlowScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -104,14 +104,14 @@ public class WebFlowELExpressionParserTests extends TestCase { public void testResolveConversationScope() { MockRequestContext context = new MockRequestContext(); context.getConversationScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); assertEquals("bar", exp.getValue(context)); } public void testSetConversationScope() { MockRequestContext context = new MockRequestContext(); context.getConversationScope().put("foo", "bar"); - Expression exp = parser.parseExpression("foo", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class)); exp.setValue(context, "baz"); assertEquals("baz", exp.getValue(context)); } @@ -121,7 +121,7 @@ public class WebFlowELExpressionParserTests extends TestCase { StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); beanFactory.addBean("testBean", new TestBean()); context.getRootFlow().setBeanFactory(beanFactory); - Expression exp = parser.parseExpression("testBean", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("testBean", new FluentParserContext().evaluate(RequestContext.class)); assertSame(beanFactory.getBean("testBean"), exp.getValue(context)); } @@ -130,7 +130,7 @@ public class WebFlowELExpressionParserTests extends TestCase { StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); beanFactory.addBean("action", new TestAction()); context.getRootFlow().setBeanFactory(beanFactory); - Expression exp = parser.parseExpression("action", new ParserContextImpl().eval(RequestContext.class)); + Expression exp = parser.parseExpression("action", new FluentParserContext().evaluate(RequestContext.class)); assertSame(beanFactory.getBean("action"), exp.getValue(context)); } @@ -139,8 +139,8 @@ public class WebFlowELExpressionParserTests extends TestCase { StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); beanFactory.addBean("multiAction", new FormAction()); context.getRootFlow().setBeanFactory(beanFactory); - Expression exp = parser.parseExpression("multiAction.setupForm", new ParserContextImpl() - .eval(RequestContext.class)); + Expression exp = parser.parseExpression("multiAction.setupForm", new FluentParserContext() + .evaluate(RequestContext.class)); AnnotatedAction action = (AnnotatedAction) exp.getValue(context); assertSame(beanFactory.getBean("multiAction"), action.getTargetAction()); assertEquals("setupForm", action.getMethod());