org.codehaus.modello.generator.database.model

Class TypeMap

public class TypeMap extends Object

A class that maps SQL type names to their JDBC type ID found in java.sql.Types.

 -------------------------------------------------------
 SQL Type      | Java Type            | Peer Type
 -------------------------------------------------------
 CHAR          | String               | String
 VARCHAR       | String               | String
 LONGVARCHAR   | String               | String
 NUMERIC       | java.math.BigDecimal | java.math.BigDecimal
 DECIMAL       | java.math.BigDecimal | java.math.BigDecimal
 BIT           | boolean OR Boolean   | Boolean
 TINYINT       | byte OR Byte         | Byte
 SMALLINT      | short OR Short       | Short
 INTEGER       | int OR Integer       | Integer
 BIGINT        | long OR Long         | Long
 REAL          | float OR Float       | Float
 FLOAT         | double OR Double     | Double
 DOUBLE        | double OR Double     | Double
 BINARY        | byte[]               | ?
 VARBINARY     | byte[]               | ?
 LONGVARBINARY | byte[]               | ?
 DATE          | java.sql.Date        | java.util.Date
 TIME          | java.sql.Time        | java.util.Date
 TIMESTAMP     | java.sql.Timestamp   | java.util.Date
 

------------------------------------------------------- A couple variations have been introduced to cover cases that may arise, but are not covered above BOOLEANCHAR | boolean OR Boolean | String BOOLEANINT | boolean OR Boolean | Integer

Version: $Revision: 149 $

Author: Jason van Zyl James Strachan

Field Summary
static StringBIGINT
static StringBINARY
static StringBIT
static StringBLOB
static StringBOOLEANCHAR
static StringBOOLEANINT
static StringCHAR
static StringCLOB
static StringDATE
static StringDECIMAL
static StringDOUBLE
static StringFLOAT
static StringINTEGER
static StringLONGVARBINARY
static StringLONGVARCHAR
static StringNUMERIC
static StringREAL
static StringSMALLINT
static StringTIME
static StringTIMESTAMP
static StringTINYINT
static StringVARBINARY
static StringVARCHAR
Method Summary
static intgetJdbcTypeCode(String typeName)
Returns the JDBC type name which maps to java.sql.Types for the given SQL name of type
static StringgetJdbcTypeName(int typeCode)
Returns the name which maps to the given java.sql.Types type code
static booleanisDecimalType(int type)
Returns true if values for the type need have size and scale measurements
static booleanisDecimalType(String type)
Returns true if values for the type need have size and scale measurements
static booleanisTextType(int type)
Returns true if values for the type need to be quoted.
static booleanisTextType(String type)
Returns true if values for the type need to be quoted.
protected static voidregisterSqlTypeID(Integer sqlTypeID, String name)
Registers the fact that the given Integer SQL ID maps to the given SQL name

Field Detail

BIGINT

public static final String BIGINT

BINARY

public static final String BINARY

BIT

public static final String BIT

BLOB

public static final String BLOB

BOOLEANCHAR

public static final String BOOLEANCHAR

BOOLEANINT

public static final String BOOLEANINT

CHAR

public static final String CHAR

CLOB

public static final String CLOB

DATE

public static final String DATE

DECIMAL

public static final String DECIMAL

DOUBLE

public static final String DOUBLE

FLOAT

public static final String FLOAT

INTEGER

public static final String INTEGER

LONGVARBINARY

public static final String LONGVARBINARY

LONGVARCHAR

public static final String LONGVARCHAR

NUMERIC

public static final String NUMERIC

REAL

public static final String REAL

SMALLINT

public static final String SMALLINT

TIME

public static final String TIME

TIMESTAMP

public static final String TIMESTAMP

TINYINT

public static final String TINYINT

VARBINARY

public static final String VARBINARY

VARCHAR

public static final String VARCHAR

Method Detail

getJdbcTypeCode

public static int getJdbcTypeCode(String typeName)
Returns the JDBC type name which maps to java.sql.Types for the given SQL name of type

getJdbcTypeName

public static String getJdbcTypeName(int typeCode)
Returns the name which maps to the given java.sql.Types type code

isDecimalType

public static final boolean isDecimalType(int type)
Returns true if values for the type need have size and scale measurements

Parameters: type The type to check.

isDecimalType

public static final boolean isDecimalType(String type)
Returns true if values for the type need have size and scale measurements

Parameters: type The type to check.

isTextType

public static final boolean isTextType(int type)
Returns true if values for the type need to be quoted.

Parameters: type The type to check.

isTextType

public static final boolean isTextType(String type)
Returns true if values for the type need to be quoted.

Parameters: type The type to check.

registerSqlTypeID

protected static void registerSqlTypeID(Integer sqlTypeID, String name)
Registers the fact that the given Integer SQL ID maps to the given SQL name
Copyright © 2001-2008 Codehaus. All Rights Reserved.