toolbox.dao
Class JDBCTypeMapper

Package class diagram package JDBCTypeMapper
java.lang.Object
  extended by toolbox.dao.JDBCTypeMapper

public final class JDBCTypeMapper
extends java.lang.Object

Utility class to perform Java Object to JDBC and JDBC to Java Object type mappings.


Constructor Summary
JDBCTypeMapper()
           
 
Method Summary
static int getSQLTypeForString(java.lang.String typeStr)
          Return the int representing the SQL type for the given text description of the type.
static int mapForSetObject(java.lang.Object obj)
          Map given Object instances to JDBC types for setObject methods.
static java.util.Date toJavaDate(java.sql.Date date)
          Performs a conversion from java.sql.Date to java.util.Date.
static java.util.Date toJavaDate(java.sql.Timestamp date)
          Performs a conversion from java.sql.Timestamp to java.util.Date.
static java.sql.Date toSQLDate(java.util.Date date)
          Performs a conversion from java.util.Date to java.sql.Date.
static java.sql.Timestamp toSQLTimestamp(java.util.Date date)
          Performs a conversion from java.util.Date to java.sql.Timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCTypeMapper

public JDBCTypeMapper()
Method Detail

mapForSetObject

public static int mapForSetObject(java.lang.Object obj)
Map given Object instances to JDBC types for setObject methods.

Parameters:
obj - Object instance to map.
Returns:
int indicating JDBC type.

getSQLTypeForString

public static int getSQLTypeForString(java.lang.String typeStr)
Return the int representing the SQL type for the given text description of the type.

Parameters:
typeStr - String containing SQL type name.
Returns:
int representing the SQL type.

toSQLDate

public static java.sql.Date toSQLDate(java.util.Date date)
Performs a conversion from java.util.Date to java.sql.Date.

Parameters:
date - Date to convert.
Returns:
java.sql.Date instance.

toSQLTimestamp

public static java.sql.Timestamp toSQLTimestamp(java.util.Date date)
Performs a conversion from java.util.Date to java.sql.Timestamp.

Parameters:
date - Date to convert.
Returns:
java.sql.Timestamp instance.

toJavaDate

public static java.util.Date toJavaDate(java.sql.Date date)
Performs a conversion from java.sql.Date to java.util.Date.

Parameters:
date - SQL date to convert.
Returns:
java.util.Date instance.

toJavaDate

public static java.util.Date toJavaDate(java.sql.Timestamp date)
Performs a conversion from java.sql.Timestamp to java.util.Date.

Parameters:
date - SQL timestamp to convert.
Returns:
java.util.Date instance.