Object parentValue;
try {
parentValue = getPropertyValue(parentPropertyName);
}
catch (NotReadablePropertyException e) {
throw new NotWritablePropertyException(getTargetClass(), propertyName, "parent property is not readable", e);
}
if (parentValue == null) {
if (isWritableProperty(parentPropertyName)) {
throw new NullValueInNestedPathException(getTargetClass(), propertyName);
}
else {
throw new NotWritablePropertyException(getTargetClass(), propertyName);
}
}
Object[] indices;
try {
indices = getIndices(propertyName);
}
catch (Exception e) {
throw new NotWritablePropertyException(getTargetClass(), propertyName, "wrong index type", e);
}
Object index = indices[indices.length - 1];
Object newParentValue = setAssemblageValue(getPropertyType(parentPropertyName), parentValue, index, value);
if (newParentValue != parentValue) {
setPropertyValue(parentPropertyName, newParentValue);