org.springframework.jdbc.core
Class DefaultColumnExtractor


public class DefaultColumnExtractor
implements ColumnExtractor

Default implementation of the ColumnExtractor interface. Tested in Oracle 8 and Access. As it isn't a critical part of the JDBC framework in this package, it has not been tested more rigorously.

Author:
Rod Johnson
Since: May 2, 2001

Method Summary
 ObjectextractColumn(String columnName, Class requiredType, ResultSet rs)
          Extract the given column from this row of the given ResultSet, ensuring that the returned object is of the required type.
 ObjectextractColumn(int i, Class requiredType, ResultSet rs)
          Extract the given column from this row of the given ResultSet, ensuring that the returned object is of the required type.

Method Detail

extractColumn

public Object extractColumn(String columnName, Class requiredType, ResultSet rs)
throws java.sql.SQLException
Extract the given column from this row of the given ResultSet, ensuring that the returned object is of the required type.

This implementation works on Oracle 8 and Access.

Parameters:
columnName - name of the column we want from the ResultSet
requiredType - class of object we must return
rs - ResultSet to extract the column value from
Returns: the value of the specified column in the ResultSet as an instance of the required type
Throws:
SQLException - if there is any problem getting this column value

extractColumn

public Object extractColumn(int i, Class requiredType, ResultSet rs)
throws java.sql.SQLException
Extract the given column from this row of the given ResultSet, ensuring that the returned object is of the required type. Should implement the same conversion as extractColumn(columnName...).
Parameters:
i - index (from 1) of the column we want from the ResultSet
requiredType - class of object we must return
rs - ResultSet to extract the column value from
Returns: the value of the specified column in the ResultSet as an instance of the required type
Throws:
SQLException - if there is any problem getting this column value. Implementations of this interface do not need to worry about handling such exceptions; they can assume they will only be called by code that correctly cleans up after any SQLExceptions