for Keith and his binder: fault in support for maps (if attempt made to reference into null map) and for general objects, e.g. foo.bar if foo was null, attempt to dynamically build foo.

This commit is contained in:
Andy Clement 2009-07-10 19:43:32 +00:00
parent e85a6740d8
commit 85eda27cd4
2 changed files with 1 additions and 3 deletions

View File

@ -104,7 +104,7 @@ public class GenericBinder implements Binder {
Assert.notNull(model, "The model to bind to is required"); Assert.notNull(model, "The model to bind to is required");
this.model = model; this.model = model;
bindingFactories = new LinkedHashSet<BindingFactory>(); bindingFactories = new LinkedHashSet<BindingFactory>();
int parserConfig = SpelExpressionParserConfiguration.CreateListsOnAttemptToIndexIntoNull int parserConfig = SpelExpressionParserConfiguration.CreateObjectIfAttemptToReferenceNull
| SpelExpressionParserConfiguration.GrowListsOnIndexBeyondSize; | SpelExpressionParserConfiguration.GrowListsOnIndexBeyondSize;
expressionParser = new SpelExpressionParser(parserConfig); expressionParser = new SpelExpressionParser(parserConfig);
typeConverter = new DefaultTypeConverter(); typeConverter = new DefaultTypeConverter();

View File

@ -357,7 +357,6 @@ public class GenericBinderTests {
} }
@Test @Test
@Ignore
public void bindToMapElements() { public void bindToMapElements() {
binder.addBinding("favoriteFoodsByGroup"); binder.addBinding("favoriteFoodsByGroup");
Map<String, String> values = new LinkedHashMap<String, String>(); Map<String, String> values = new LinkedHashMap<String, String>();
@ -401,7 +400,6 @@ public class GenericBinderTests {
} }
@Test @Test
@Ignore
public void bindToNullObjectPath() { public void bindToNullObjectPath() {
binder.addBinding("primaryAddress.street"); binder.addBinding("primaryAddress.street");
binder.addBinding("primaryAddress.city"); binder.addBinding("primaryAddress.city");