Errors_CTFM_SETTER_NOT_FOUND - arnaudroger/SimpleFlatMapper GitHub Wiki
Why ?
When mapping from an object to a target - ie. PreparedStatement - sfm could not find a setter on the target that can take the type of the property.
Then what?
You will need to provide a custom setter to the framework that will build the specific type from the source object. you can also provide a setter factory that will build a getter based on the field key.
example
JdbcMapperFactory
.newInstance()
.addColumnProperty("bar", new SetterProperty(new Setter<PreparedStatement, Bar2Prop>() {
@Override
public void set(PreparedStatement target, Bar2Prop value) throws Exception {
target.setString(3, value.getVal());
target.setInt(4, value.getI());
}
}))
.buildFrom(Foo2.class)
.addColumn("bar")
.mapper();
CsvWriter
.from(Foo2.class)
.column("bar", new SetterProperty(new Setter<Appendable, Bar2Prop>() {
@Override
public void set(Appendable target, Bar2Prop value) throws Exception {
target.append(value.getVal()).append(":").append(String.valueOf(value.getI()));
}
}))
.to(sb)
.append(new Foo2(new Bar2Prop("val", 3)));