-
Notifications
You must be signed in to change notification settings - Fork 76
Errors_CSFM_GETTER_NOT_FOUND
Arnaud Roger edited this page Feb 21, 2016
·
12 revisions
When mapping from a source - ie. ResultSet - to an object sfm could not find a getter that would return the type of the property.
You will need to provide a custom getter to the framework that will build the specific type from the source object. you can also provide a getter factory that will build a getter based on the field key.
JdbcMapperFactory
.newInstance()
.addColumnProperty("bar",
new GetterProperty(new Getter<ResultSet, Bar2>() {
@Override
public Bar2 get(ResultSet target) throws Exception {
return new Bar2(target.getString("bar"), 2);
}
}))
.newBuilder(Foo2.class)
.addKey("bar").mapper();
CsvMapperFactory
.newInstance()
.addColumnProperty("bar",
new CustomReaderProperty(new CellValueReader<Bar2>() {
@Override
public Bar2 read(char[] chars, int offset, int length,
ParsingContext parsingContext) {
return new Bar2(
StringCellValueReader
.readString(chars, offset, length), 2);
}
}))
.newBuilder(Foo2.class)
.addMapping("bar").mapper();