org.ujac.util.db
Class DefaultDataTypeMapper

java.lang.Object
  extended by org.ujac.util.db.DefaultDataTypeMapper
All Implemented Interfaces:
DataTypeMapper

public class DefaultDataTypeMapper
extends Object
implements DataTypeMapper

Name: DefaultDataTypeMapper
Description: Default implementation of the interface DataTypeMapper.

Author:
lauerc

Field Summary
 
Fields inherited from interface org.ujac.util.db.DataTypeMapper
JAVA_TYPE_BOOLEAN, JAVA_TYPE_DATE, JAVA_TYPE_DOUBLE, JAVA_TYPE_FLOAT, JAVA_TYPE_INT, JAVA_TYPE_LONG, JAVA_TYPE_OBJECT, JAVA_TYPE_STRING, JAVA_TYPE_TIME, JAVA_TYPE_TIMESTAMP
 
Constructor Summary
DefaultDataTypeMapper()
           
 
Method Summary
 int getJavaType(int sqlType, int columnSize, int decimalDigits)
          Gets the JAVA type of the given SQL type.
 String getJavaTypeName(int sqlType, int columnSize, int decimalDigits, boolean allowPrimitive, boolean fullyQualified)
          Gets the name of the given SQL type
 String getSqlTypeName(int sqlType)
          Gets the name of the given SQL type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDataTypeMapper

public DefaultDataTypeMapper()
Method Detail

getJavaType

public int getJavaType(int sqlType,
                       int columnSize,
                       int decimalDigits)
Gets the JAVA type of the given SQL type.

Specified by:
getJavaType in interface DataTypeMapper
Parameters:
sqlType - The SQL type ID from java.sql.Types.
columnSize - The size of the SQL type.
decimalDigits - The number of decimal digits.
Returns:
The SQL type name.
See Also:
DataTypeMapper.JAVA_TYPE_OBJECT, DataTypeMapper.JAVA_TYPE_INT, DataTypeMapper.JAVA_TYPE_LONG, DataTypeMapper.JAVA_TYPE_FLOAT, DataTypeMapper.JAVA_TYPE_DOUBLE, DataTypeMapper.JAVA_TYPE_BOOLEAN, DataTypeMapper.JAVA_TYPE_STRING, DataTypeMapper.JAVA_TYPE_DATE, DataTypeMapper.JAVA_TYPE_TIME, DataTypeMapper.JAVA_TYPE_TIMESTAMP

getJavaTypeName

public String getJavaTypeName(int sqlType,
                              int columnSize,
                              int decimalDigits,
                              boolean allowPrimitive,
                              boolean fullyQualified)
Gets the name of the given SQL type

Specified by:
getJavaTypeName in interface DataTypeMapper
Parameters:
sqlType - The SQL type ID from java.sql.Types.
columnSize - The size of the SQL type.
decimalDigits - The number of decimal digits.
allowPrimitive - If true, uses the simple types (int, long, float, double, ...) for numeric values, otherwise returns the wrapper classed for these types.
fullyQualified - If true, returns the fully qualified class names for system classes, else returns the system class names without java.lang package prefix.
Returns:
The SQL type name.

getSqlTypeName

public String getSqlTypeName(int sqlType)
Gets the name of the given SQL type

Specified by:
getSqlTypeName in interface DataTypeMapper
Parameters:
sqlType - The SQL type ID from java.sql.Types.
Returns:
The SQL type name.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.