Object subValue = this.metadata.getValueOfProperty(substring, this.object);
if (subValue == null){
try {
subValue = setter.getType().newInstance();
} catch (InstantiationException e) {
throw new Sql2oException("Could not instantiate a new instance of class "+ setter.getType().toString(), e);
} catch (IllegalAccessException e) {
throw new Sql2oException("Could not instantiate a new instance of class "+ setter.getType().toString(), e);
}
setter.setProperty(this.object, subValue);
}
PojoMetadata subMetadata = new PojoMetadata(setter.getType(), this.caseSensitive, this.metadata.isAutoDeriveColumnNames(), this.metadata.getColumnMappings());
Pojo subPojo = new Pojo(subMetadata, this.caseSensitive, subValue);
subPojo.setProperty(newPath, value, quirks);
}
else{
setter = metadata.getPropertySetter(propertyPath);
Converter converter;
try {
converter = throwIfNull(setter.getType(), quirks.converterOf(setter.getType()));
} catch (ConverterException e) {
throw new Sql2oException("Cannot convert column " + propertyPath + " to type " + setter.getType(), e);
}
try {
setter.setProperty(this.object, converter.convert( value ));
} catch (ConverterException e) {
throw new Sql2oException("Error trying to convert column " + propertyPath + " to type " + setter.getType(), e);
}
}
}