diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java index ae122b77..a7cd3f8b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java @@ -21,6 +21,7 @@ import org.springframework.binding.convert.support.DefaultConversionService; import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.ExpressionParser; import org.springframework.binding.expression.SettableExpression; +import org.springframework.binding.expression.support.CollectionAddingExpression; import org.springframework.util.Assert; /** @@ -38,6 +39,7 @@ import org.springframework.util.Assert; * it can be reused to build another mapping. * * @author Keith Donald + * @author Erwin Vervaet */ public class MappingBuilder { @@ -116,6 +118,17 @@ public class MappingBuilder { return this; } + /** + * Sets the target collection of the mapping built by this builder. + * @param expressionString the expression string, resolving a collection + * @return this, to support call-chaining + */ + public MappingBuilder targetCollection(String expressionString) { + targetExpression = new CollectionAddingExpression( + expressionParser.parseSettableExpression(expressionString)); + return this; + } + /** * Sets the expected type of the object returned by evaluating the source * expression. Used in conjunction with {@link #to(Class)} to perform a type diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index 1ea6d066..73409b15 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -7,6 +7,7 @@ Changes in version 1.1.0 () Package org.springframework.binding * Fixed serializability problems in ConversionException, EvaluationException and MethodInvocationException. +* Added targetCollection(String) method to MappingBuilder. Package org.springframework.webflow.config * FlowExecutorFactoryBean now has an 'inputMapper' property to conveniently configure the 'inputMapper'