public class ColumnMapRowMapper extends Object implements org.springframework.jdbc.core.RowMapper<com.alibaba.fastjson.JSONObject>
Constructor and Description |
---|
ColumnMapRowMapper(DbBase dbBase,
String... tableNames) |
Modifier and Type | Method and Description |
---|---|
protected com.alibaba.fastjson.JSONObject |
createColumnMap(int columnCount)
Create a Map instance to be used as column map.
|
protected String |
getColumnKey(String columnName)
Determine the key to use for the given column in the column Map.
|
protected Object |
getColumnValue(ResultSet rs,
int index)
Retrieve a JDBC object value for the specified column.
|
com.alibaba.fastjson.JSONObject |
mapRow(ResultSet rs,
int rowNum) |
public com.alibaba.fastjson.JSONObject mapRow(ResultSet rs, int rowNum) throws SQLException
mapRow
in interface org.springframework.jdbc.core.RowMapper<com.alibaba.fastjson.JSONObject>
SQLException
protected com.alibaba.fastjson.JSONObject createColumnMap(int columnCount)
By default, a linked case-insensitive Map will be created.
columnCount
- the column count, to be used as initial
capacity for the MapLinkedCaseInsensitiveMap
protected String getColumnKey(String columnName)
columnName
- the column name as returned by the ResultSetResultSetMetaData.getColumnName(int)
@Nullable protected Object getColumnValue(ResultSet rs, int index) throws SQLException
The default implementation uses the getObject
method.
Additionally, this implementation includes a "hack" to get around Oracle
returning a non standard object for their TIMESTAMP datatype.
rs
- is the ResultSet holding the dataindex
- is the column indexSQLException
JdbcUtils.getResultSetValue(java.sql.ResultSet, int, java.lang.Class<?>)
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.