org.sfm.jdbc.spring.JdbcTemplateMapperFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.sfm.jdbc.spring;
import org.sfm.jdbc.JdbcColumnKey;
import org.sfm.jdbc.JdbcMapperFactory;
import org.sfm.map.FieldMapperErrorHandler;
import org.sfm.map.MapperBuilderErrorHandler;
import org.sfm.map.MapperBuildingException;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import java.util.List;
public final class JdbcTemplateMapperFactory {
public static JdbcTemplateMapperFactory newInstance() {
return new JdbcTemplateMapperFactory();
}
private final JdbcMapperFactory jdbcMapperFactory = JdbcMapperFactory.newInstance();
public JdbcTemplateMapperFactory fieldMapperErrorHandler(FieldMapperErrorHandler fieldMapperErrorHandler) {
jdbcMapperFactory.fieldMapperErrorHandler(fieldMapperErrorHandler);
return this;
}
public JdbcTemplateMapperFactory mapperBuilderErrorHandler(
MapperBuilderErrorHandler mapperBuilderErrorHandler) {
jdbcMapperFactory.mapperBuilderErrorHandler(mapperBuilderErrorHandler);
return this;
}
public JdbcTemplateMapperFactory useAsm(boolean useAsm) {
jdbcMapperFactory.useAsm(useAsm);
return this;
}
public RowMapper newRowMapper(Class target)
throws MapperBuildingException {
return newMapper(target);
}
public JdbcTemplateMapper newMapper(Class target) {
return new JdbcTemplateMapper(jdbcMapperFactory.newMapper(target));
}
public PreparedStatementCallback> newPreparedStatementCallback(Class target)
throws MapperBuildingException {
return newMapper(target);
}
public ResultSetExtractor> newResultSetExtractor(Class target)
throws MapperBuildingException {
return newMapper(target);
}
}