net.sf.eodsql
Interface TypeMapper<T>


public interface TypeMapper<T>

A TypeMapper allows for interaction with the SQL -> Java mapping process. Types in EoD SQL are mapped based on what the Java type is, not what the SQL type is, this allows for greater flexability since many Java types can all map to the same SQL type.

By default most datatypes you will need already have TypeMappers:

Author:
jason

Method Summary
 T get(ResultSet results, int column)
          Attempts to convert the result of the specified column in the ResultSet into the type this TypeMapper returns.
 void set(PreparedStatement statement, int column, T obj)
          Attempts to convert the specified object into a SQL object and place it into the PreparedStatement.
 

Method Detail

get

T get(ResultSet results,
      int column)
      throws SQLException
Attempts to convert the result of the specified column in the ResultSet into the type this TypeMapper returns.

Parameters:
results - the ResultSet to fetch data from
column - the column number in the ResultSet
Returns:
the Java version of the SQL type
Throws:
SQLException - if the SQL type cannot be mapped with this TypeMapper

set

void set(PreparedStatement statement,
         int column,
         T obj)
         throws SQLException
Attempts to convert the specified object into a SQL object and place it into the PreparedStatement.

Parameters:
statement - the PreparedStatement to place the data into
column - the column in the statement where the data should be put
obj - the object to map
Throws:
SQLException - if the object cannot be mapped with this TypeMapper