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>

public class ScalarHandler<T> extends Object implements ResultSetHandler<T>
ResultSetHandler implementation that converts one ResultSet column into an Object. This class is thread safe.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The column number to retrieve.
    private final String
    The column name to retrieve.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates a new instance of ScalarHandler.
     
    ScalarHandler(int columnIndex)
    Creates a new instance of ScalarHandler.
    private
    ScalarHandler(int columnIndex, String columnName)
    Helper constructor
     
    ScalarHandler(String columnName)
    Creates a new instance of ScalarHandler.
  • Method Summary

    Modifier and Type
    Method
    Description
    handle(ResultSet resultSet)
    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
  • Field Details

    • columnIndex

      private final int columnIndex
      The column number to retrieve.
    • columnName

      private final String columnName
      The column name to retrieve. Either columnName or columnIndex will be used but never both.
  • Constructor Details

    • 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

      private ScalarHandler(int columnIndex, String columnName)
      Helper constructor
      Parameters:
      columnIndex - The index of the column to retrieve from the ResultSet.
      columnName - The name of the column to retrieve from the ResultSet.
    • ScalarHandler

      public ScalarHandler(String columnName)
      Creates a new instance of ScalarHandler.
      Parameters:
      columnName - The name of the column to retrieve from the ResultSet.
  • Method Details