parent
a77fee9f18
commit
80652007b5
|
|
@ -229,6 +229,9 @@ public class RelaxedDataBinder extends DataBinder {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TypeDescriptor descriptor = parent.getMapValueTypeDescriptor();
|
TypeDescriptor descriptor = parent.getMapValueTypeDescriptor();
|
||||||
|
if (descriptor == null) {
|
||||||
|
descriptor = TypeDescriptor.valueOf(Object.class);
|
||||||
|
}
|
||||||
if (!descriptor.isMap() && !descriptor.isCollection()
|
if (!descriptor.isMap() && !descriptor.isCollection()
|
||||||
&& !descriptor.getType().equals(Object.class)) {
|
&& !descriptor.getType().equals(Object.class)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,13 @@ public class RelaxedDataBinderTests {
|
||||||
assertEquals("123", target.getNested().get("value"));
|
assertEquals("123", target.getNested().get("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBindNestedUntypedMap() throws Exception {
|
||||||
|
TargetWithNestedUntypedMap target = new TargetWithNestedUntypedMap();
|
||||||
|
bind(target, "nested.foo: bar\n" + "nested.value: 123");
|
||||||
|
assertEquals("123", target.getNested().get("value"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBindNestedMapOfString() throws Exception {
|
public void testBindNestedMapOfString() throws Exception {
|
||||||
TargetWithNestedMapOfString target = new TargetWithNestedMapOfString();
|
TargetWithNestedMapOfString target = new TargetWithNestedMapOfString();
|
||||||
|
|
@ -504,6 +511,22 @@ public class RelaxedDataBinderTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public static class TargetWithNestedUntypedMap {
|
||||||
|
|
||||||
|
private Map nested;
|
||||||
|
|
||||||
|
public Map getNested() {
|
||||||
|
return this.nested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNested(Map nested) {
|
||||||
|
this.nested = nested;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class TargetWithNestedMapOfString {
|
public static class TargetWithNestedMapOfString {
|
||||||
|
|
||||||
private Map<String, String> nested;
|
private Map<String, String> nested;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue