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

org.onetwo.dbm.jdbc.mapper.DataRowMapper Maven / Gradle / Ivy

package org.onetwo.dbm.jdbc.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.onetwo.common.spring.SpringUtils;
import org.onetwo.dbm.exception.DbmException;
import org.springframework.beans.BeanWrapper;
import org.springframework.jdbc.core.RowMapper;

/**
 * @author weishao zeng
 * 
*/ public interface DataRowMapper extends RowMapper { default BeanWrapper mapRowWithBeanWrapper(ResultSet rs, int rowNum) throws SQLException { T data = mapRow(rs, rowNum);; return SpringUtils.newBeanWrapper(data); } /*default void setColumnValue(ResultSetWrappingSqlRowSet resutSetWrapper, BeanWrapper bw, int rowNumber, int columnIndex, String column) { throw new DbmException(this.getClass() + " not supported operation!"); } */ final public class NoDataRowMapper implements DataRowMapper { @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { throw new DbmException("not supported operation!"); } } }