io.github.jinghui70.rainbow.dbaccess.mapper.MapRowMapper Maven / Gradle / Ivy
The newest version!
package io.github.jinghui70.rainbow.dbaccess.mapper;
import io.github.jinghui70.rainbow.dbaccess.fieldmapper.FieldMapper;
import org.h2.value.CaseInsensitiveMap;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.jdbc.support.JdbcUtils;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
/**
* {@link org.springframework.jdbc.core.RowMapper} implementation that creates a {@link Map}
* for each row, representing all columns as key-value pairs: one entry for each column,
* with the column name as key.
*
* This RowMapper is useful when you want to access all columns of a row without
* having to define a class for it.
*
*
This class is thread-safe.
*
* @author jinghui70
*/
public class MapRowMapper extends ColumnMapRowMapper {
public static MapRowMapper INSTANCE = new MapRowMapper();
private Map> mapperMap;
private boolean ignoreNull;
private Set ignoreKeySet;
private Consumer