Example usage for org.springframework.beans AbstractPropertyAccessor setPropertyValue

List of usage examples for org.springframework.beans AbstractPropertyAccessor setPropertyValue

Introduction

In this page you can find the example usage for org.springframework.beans AbstractPropertyAccessor setPropertyValue.

Prototype

@Override
    public void setPropertyValue(PropertyValue pv) throws BeansException 

Source Link

Usage

From source file:org.springframework.beans.AbstractPropertyAccessorTests.java

@Test
public void setUnknownOptionalProperty() {
    Simple target = new Simple("John", 2);
    AbstractPropertyAccessor accessor = createAccessor(target);

    try {/*w ww .j  ava  2  s .c  o  m*/
        PropertyValue value = new PropertyValue("foo", "value");
        value.setOptional(true);
        accessor.setPropertyValue(value);
    } catch (NotWritablePropertyException e) {
        fail("Should not have failed to set an unknown optional property.");
    }
}