org.oddjob.sql
Class ColumnExtractor<T>

java.lang.Object
  extended by org.oddjob.sql.ColumnExtractor<T>

public abstract class ColumnExtractor<T>
extends Object

Something that is able to extract a value from a column based on the SQL Type.

Author:
rob

Field Summary
static ColumnExtractor<BigDecimal> BIG_DECIMAL_EXTRACTOR
           
static ColumnExtractor<Boolean> BOOLEAN_EXTRACTOR
           
static ColumnExtractor<Date> DATE_EXTRACTOR
           
static ColumnExtractor<Object> DEFAULT_EXTRACTOR
           
static ColumnExtractor<Double> DOUBLE_EXTRACTOR
           
static ColumnExtractor<Integer> INT_EXTRACTOR
           
static ColumnExtractor<Long> LONG_EXTRACTOR
           
static ColumnExtractor<Short> SHORT_EXTRACTOR
           
static Map<Integer,String> SQL_TYPE_NAMES
           
static ColumnExtractor<String> STRING_EXTRACTOR
           
static ColumnExtractor<Time> TIME_EXTRACTOR
           
static ColumnExtractor<Timestamp> TIMESTAMP_EXTRACTOR
           
 
Constructor Summary
ColumnExtractor()
           
 
Method Summary
abstract  T extract(ResultSet rs, int columnIndex)
          Extract the value from the column.
static
<X> ColumnExtractor<X>
getColumnExtractor(Integer sqlType)
           
abstract  Class<T> getType()
          Get the class of this Column Extractor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_TYPE_NAMES

public static final Map<Integer,String> SQL_TYPE_NAMES

BOOLEAN_EXTRACTOR

public static final ColumnExtractor<Boolean> BOOLEAN_EXTRACTOR

SHORT_EXTRACTOR

public static final ColumnExtractor<Short> SHORT_EXTRACTOR

INT_EXTRACTOR

public static final ColumnExtractor<Integer> INT_EXTRACTOR

LONG_EXTRACTOR

public static final ColumnExtractor<Long> LONG_EXTRACTOR

DOUBLE_EXTRACTOR

public static final ColumnExtractor<Double> DOUBLE_EXTRACTOR

BIG_DECIMAL_EXTRACTOR

public static final ColumnExtractor<BigDecimal> BIG_DECIMAL_EXTRACTOR

STRING_EXTRACTOR

public static final ColumnExtractor<String> STRING_EXTRACTOR

DATE_EXTRACTOR

public static final ColumnExtractor<Date> DATE_EXTRACTOR

TIME_EXTRACTOR

public static final ColumnExtractor<Time> TIME_EXTRACTOR

TIMESTAMP_EXTRACTOR

public static final ColumnExtractor<Timestamp> TIMESTAMP_EXTRACTOR

DEFAULT_EXTRACTOR

public static final ColumnExtractor<Object> DEFAULT_EXTRACTOR
Constructor Detail

ColumnExtractor

public ColumnExtractor()
Method Detail

getColumnExtractor

public static <X> ColumnExtractor<X> getColumnExtractor(Integer sqlType)

getType

public abstract Class<T> getType()
Get the class of this Column Extractor.

Returns:
The class, never null.

extract

public abstract T extract(ResultSet rs,
                          int columnIndex)
                   throws SQLException
Extract the value from the column.

Parameters:
rs -
columnIndex -
Returns:
Throws:
SQLException