Class ScalarHandler<T>
java.lang.Object
org.apache.commons.dbutils.handlers.ScalarHandler<T>
- Type Parameters:
T- The type of the scalar
- All Implemented Interfaces:
ResultSetHandler<T>
ResultSetHandler implementation that converts one
ResultSet column into an Object. This class is thread safe.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of ScalarHandler.ScalarHandler(int columnIndex) Creates a new instance of ScalarHandler.ScalarHandler(String columnName) Creates a new instance of ScalarHandler. -
Method Summary
-
Constructor Details
-
ScalarHandler
public ScalarHandler()Creates a new instance of ScalarHandler. The first column will be returned fromhandle(). -
ScalarHandler
Creates a new instance of ScalarHandler.- Parameters:
columnIndex- The index of the column to retrieve from theResultSet.
-
ScalarHandler
Creates a new instance of ScalarHandler.- Parameters:
columnName- The name of the column to retrieve from theResultSet.
-
-
Method Details
-
handle
Returns oneResultSetcolumn as an object via theResultSet.getObject()method that performs type conversions.- Specified by:
handlein interfaceResultSetHandler<T>- Parameters:
resultSet-ResultSetto process.- Returns:
- The column or
nullif there are no rows in theResultSet. - Throws:
SQLException- if a database access error occursClassCastException- if the class datatype does not match the column type- See Also:
-