Example usage for org.springframework.beans AbstractNestablePropertyAccessor setPropertyValue

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

Introduction

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

Prototype

protected void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) throws BeansException 

Source Link

Usage

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

@Override
public void setPropertyValue(String propertyName, @Nullable Object value) throws BeansException {
    AbstractNestablePropertyAccessor nestedPa;
    try {/*  w  ww.  j  a  va  2s . c om*/
        nestedPa = getPropertyAccessorForPropertyPath(propertyName);
    } catch (NotReadablePropertyException ex) {
        throw new NotWritablePropertyException(getRootClass(), this.nestedPath + propertyName,
                "Nested property in path '" + propertyName + "' does not exist", ex);
    }
    PropertyTokenHolder tokens = getPropertyNameTokens(getFinalPath(nestedPa, propertyName));
    nestedPa.setPropertyValue(tokens, new PropertyValue(propertyName, value));
}

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

@Override
public void setPropertyValue(PropertyValue pv) throws BeansException {
    PropertyTokenHolder tokens = (PropertyTokenHolder) pv.resolvedTokens;
    if (tokens == null) {
        String propertyName = pv.getName();
        AbstractNestablePropertyAccessor nestedPa;
        try {/*from ww  w  .j  a  v  a 2  s . c  o  m*/
            nestedPa = getPropertyAccessorForPropertyPath(propertyName);
        } catch (NotReadablePropertyException ex) {
            throw new NotWritablePropertyException(getRootClass(), this.nestedPath + propertyName,
                    "Nested property in path '" + propertyName + "' does not exist", ex);
        }
        tokens = getPropertyNameTokens(getFinalPath(nestedPa, propertyName));
        if (nestedPa == this) {
            pv.getOriginalPropertyValue().resolvedTokens = tokens;
        }
        nestedPa.setPropertyValue(tokens, pv);
    } else {
        setPropertyValue(tokens, pv);
    }
}