All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sfm.jdbc.spring.JdbcTemplateMapperFactory Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy