org.jasig.services.persondir.support.jdbc
Class ColumnMapParameterizedRowMapper

java.lang.Object
  extended by org.jasig.services.persondir.support.jdbc.ColumnMapParameterizedRowMapper
All Implemented Interfaces:
org.springframework.jdbc.core.RowMapper, org.springframework.jdbc.core.simple.ParameterizedRowMapper<Map<String,Object>>

public class ColumnMapParameterizedRowMapper
extends Object
implements org.springframework.jdbc.core.simple.ParameterizedRowMapper<Map<String,Object>>

JDK5 clone of ColumnMapRowMapper

Version:
$Revision$
Author:
Eric Dalquist

Constructor Summary
ColumnMapParameterizedRowMapper()
           
ColumnMapParameterizedRowMapper(boolean ignoreNull)
           
 
Method Summary
protected  Map<String,Object> 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.
 Map<String,Object> mapRow(ResultSet rs, int rowNum)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnMapParameterizedRowMapper

public ColumnMapParameterizedRowMapper()

ColumnMapParameterizedRowMapper

public ColumnMapParameterizedRowMapper(boolean ignoreNull)
Method Detail

mapRow

public final Map<String,Object> mapRow(ResultSet rs,
                                       int rowNum)
                                throws SQLException
Specified by:
mapRow in interface org.springframework.jdbc.core.RowMapper
Specified by:
mapRow in interface org.springframework.jdbc.core.simple.ParameterizedRowMapper<Map<String,Object>>
Throws:
SQLException

createColumnMap

protected Map<String,Object> createColumnMap(int columnCount)
Create a Map instance to be used as column map.
By default, a linked case-insensitive Map will be created

Parameters:
columnCount - the column count, to be used as initial capacity for the Map
Returns:
the new Map instance

getColumnKey

protected String getColumnKey(String columnName)
Determine the key to use for the given column in the column Map.

Parameters:
columnName - the column name as returned by the ResultSet
Returns:
the column key to use
See Also:
ResultSetMetaData.getColumnName(int)

getColumnValue

protected Object getColumnValue(ResultSet rs,
                                int index)
                         throws SQLException
Retrieve a JDBC object value for the specified column.
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.

Parameters:
rs - is the ResultSet holding the data
index - is the column index
Returns:
the Object returned
Throws:
SQLException
See Also:
JdbcUtils.getResultSetValue(java.sql.ResultSet, int, java.lang.Class)


Copyright © 2012 Jasig. All Rights Reserved.