org.ujac.util.db
Interface DataTypeMapper

All Known Implementing Classes:
DefaultDataTypeMapper

public interface DataTypeMapper

Name: DataTypeMapper
Description: A interface intended to make the type conversion from database types to java types more customizable.

Author:
lauerc

Field Summary
static int JAVA_TYPE_BOOLEAN
          Constant for the java type boolean.
static int JAVA_TYPE_DATE
          Constant for the java type Date.
static int JAVA_TYPE_DOUBLE
          Constant for the java type double.
static int JAVA_TYPE_FLOAT
          Constant for the java type float.
static int JAVA_TYPE_INT
          Constant for the java type int.
static int JAVA_TYPE_LONG
          Constant for the java type long.
static int JAVA_TYPE_OBJECT
          Constant for the java type Object.
static int JAVA_TYPE_STRING
          Constant for the java type String.
static int JAVA_TYPE_TIME
          Constant for the java type Time.
static int JAVA_TYPE_TIMESTAMP
          Constant for the java type Timestamp.
 
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
 

Field Detail

JAVA_TYPE_OBJECT

static final int JAVA_TYPE_OBJECT
Constant for the java type Object.

See Also:
Constant Field Values

JAVA_TYPE_INT

static final int JAVA_TYPE_INT
Constant for the java type int.

See Also:
Constant Field Values

JAVA_TYPE_LONG

static final int JAVA_TYPE_LONG
Constant for the java type long.

See Also:
Constant Field Values

JAVA_TYPE_FLOAT

static final int JAVA_TYPE_FLOAT
Constant for the java type float.

See Also:
Constant Field Values

JAVA_TYPE_DOUBLE

static final int JAVA_TYPE_DOUBLE
Constant for the java type double.

See Also:
Constant Field Values

JAVA_TYPE_BOOLEAN

static final int JAVA_TYPE_BOOLEAN
Constant for the java type boolean.

See Also:
Constant Field Values

JAVA_TYPE_STRING

static final int JAVA_TYPE_STRING
Constant for the java type String.

See Also:
Constant Field Values

JAVA_TYPE_DATE

static final int JAVA_TYPE_DATE
Constant for the java type Date.

See Also:
Constant Field Values

JAVA_TYPE_TIME

static final int JAVA_TYPE_TIME
Constant for the java type Time.

See Also:
Constant Field Values

JAVA_TYPE_TIMESTAMP

static final int JAVA_TYPE_TIMESTAMP
Constant for the java type Timestamp.

See Also:
Constant Field Values
Method Detail

getJavaType

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

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:
JAVA_TYPE_OBJECT, JAVA_TYPE_INT, JAVA_TYPE_LONG, JAVA_TYPE_FLOAT, JAVA_TYPE_DOUBLE, JAVA_TYPE_BOOLEAN, JAVA_TYPE_STRING, JAVA_TYPE_DATE, JAVA_TYPE_TIME, JAVA_TYPE_TIMESTAMP

getJavaTypeName

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

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 JAVA type name.

getSqlTypeName

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

Parameters:
sqlType - The SQL type ID from java.sql.Types.
Returns:
The SQL type name.


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