org.apache.commons.dbutils.handlers
Class ScalarHandler

java.lang.Object
  extended byorg.apache.commons.dbutils.handlers.ScalarHandler
All Implemented Interfaces:
ResultSetHandler

public class ScalarHandler
extends java.lang.Object
implements ResultSetHandler

ResultSetHandler implementation that converts one ResultSet column into an Object. This class is thread safe.

See Also:
ResultSetHandler

Constructor Summary
ScalarHandler()
          Creates a new instance of ScalarHandler.
ScalarHandler(int columnIndex)
          Creates a new instance of ScalarHandler.
ScalarHandler(java.lang.String columnName)
          Creates a new instance of ScalarHandler.
 
Method Summary
 java.lang.Object handle(java.sql.ResultSet rs)
          Returns one ResultSet column as an object via the ResultSet.getObject() method that performs type conversions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalarHandler

public ScalarHandler()
Creates a new instance of ScalarHandler. The first column will be returned from handle().


ScalarHandler

public ScalarHandler(int columnIndex)
Creates a new instance of ScalarHandler.

Parameters:
columnIndex - The index of the column to retrieve from the ResultSet.

ScalarHandler

public ScalarHandler(java.lang.String columnName)
Creates a new instance of ScalarHandler.

Parameters:
columnName - The name of the column to retrieve from the ResultSet.
Method Detail

handle

public java.lang.Object handle(java.sql.ResultSet rs)
                        throws java.sql.SQLException
Returns one ResultSet column as an object via the ResultSet.getObject() method that performs type conversions.

Specified by:
handle in interface ResultSetHandler
Parameters:
rs - The ResultSet to handle. It has not been touched before being passed to this method.
Returns:
The column or null if there are no rows in the ResultSet.
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
ResultSetHandler.handle(java.sql.ResultSet)


Copyright © 2002-2006 The Apache Software Foundation. All Rights Reserved.