List of usage examples for org.springframework.beans AbstractPropertyAccessor setPropertyValues
@Override public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException
From source file:org.springframework.beans.AbstractPropertyAccessorTests.java
@Test public void setIndexedPropertyIgnored() { MutablePropertyValues values = new MutablePropertyValues(); values.add("toBeIgnored[0]", 42); AbstractPropertyAccessor accessor = createAccessor(new Object()); accessor.setPropertyValues(values, true); }
From source file:org.springframework.beans.AbstractPropertyAccessorTests.java
@Test public void setPropertyValuesIgnoresInvalidNestedOnRequest() { ITestBean target = new TestBean(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("name", "rod")); pvs.addPropertyValue(new PropertyValue("graceful.rubbish", "tony")); pvs.addPropertyValue(new PropertyValue("more.garbage", new Object())); AbstractPropertyAccessor accessor = createAccessor(target); accessor.setPropertyValues(pvs, true); assertTrue("Set valid and ignored invalid", target.getName().equals("rod")); try {/*from w ww .j a v a2s . co m*/ // Don't ignore: should fail accessor.setPropertyValues(pvs, false); fail("Shouldn't have ignored invalid updates"); } catch (NotWritablePropertyException ex) { // OK: but which exception?? } }