org.codehaus.modello.generator.database.model
Class TypeMap

java.lang.Object
  extended by org.codehaus.modello.generator.database.model.TypeMap

public class TypeMap
extends java.lang.Object

A class that maps SQL type names to their JDBC type ID found in 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 java.lang.String BIGINT
           
static java.lang.String BINARY
           
static java.lang.String BIT
           
static java.lang.String BLOB
           
static java.lang.String BOOLEANCHAR
           
static java.lang.String BOOLEANINT
           
static java.lang.String CHAR
           
static java.lang.String CLOB
           
static java.lang.String DATE
           
static java.lang.String DECIMAL
           
static java.lang.String DOUBLE
           
static java.lang.String FLOAT
           
static java.lang.String INTEGER
           
static java.lang.String LONGVARBINARY
           
static java.lang.String LONGVARCHAR
           
static java.lang.String NUMERIC
           
static java.lang.String REAL
           
static java.lang.String SMALLINT
           
static java.lang.String TIME
           
static java.lang.String TIMESTAMP
           
static java.lang.String TINYINT
           
static java.lang.String VARBINARY
           
static java.lang.String VARCHAR
           
 
Constructor Summary
TypeMap()
           
 
Method Summary
static int getJdbcTypeCode(java.lang.String typeName)
          Returns the JDBC type name which maps to Types for the given SQL name of type
static java.lang.String getJdbcTypeName(int typeCode)
          Returns the name which maps to the given Types type code
static boolean isDecimalType(int type)
          Returns true if values for the type need have size and scale measurements
static boolean isDecimalType(java.lang.String type)
          Returns true if values for the type need have size and scale measurements
static boolean isTextType(int type)
          Returns true if values for the type need to be quoted.
static boolean isTextType(java.lang.String type)
          Returns true if values for the type need to be quoted.
protected static void registerSqlTypeID(java.lang.Integer sqlTypeID, java.lang.String name)
          Registers the fact that the given Integer SQL ID maps to the given SQL name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR

public static final java.lang.String CHAR
See Also:
Constant Field Values

VARCHAR

public static final java.lang.String VARCHAR
See Also:
Constant Field Values

LONGVARCHAR

public static final java.lang.String LONGVARCHAR
See Also:
Constant Field Values

CLOB

public static final java.lang.String CLOB
See Also:
Constant Field Values

NUMERIC

public static final java.lang.String NUMERIC
See Also:
Constant Field Values

DECIMAL

public static final java.lang.String DECIMAL
See Also:
Constant Field Values

BIT

public static final java.lang.String BIT
See Also:
Constant Field Values

TINYINT

public static final java.lang.String TINYINT
See Also:
Constant Field Values

SMALLINT

public static final java.lang.String SMALLINT
See Also:
Constant Field Values

INTEGER

public static final java.lang.String INTEGER
See Also:
Constant Field Values

BIGINT

public static final java.lang.String BIGINT
See Also:
Constant Field Values

REAL

public static final java.lang.String REAL
See Also:
Constant Field Values

FLOAT

public static final java.lang.String FLOAT
See Also:
Constant Field Values

DOUBLE

public static final java.lang.String DOUBLE
See Also:
Constant Field Values

BINARY

public static final java.lang.String BINARY
See Also:
Constant Field Values

VARBINARY

public static final java.lang.String VARBINARY
See Also:
Constant Field Values

LONGVARBINARY

public static final java.lang.String LONGVARBINARY
See Also:
Constant Field Values

BLOB

public static final java.lang.String BLOB
See Also:
Constant Field Values

DATE

public static final java.lang.String DATE
See Also:
Constant Field Values

TIME

public static final java.lang.String TIME
See Also:
Constant Field Values

TIMESTAMP

public static final java.lang.String TIMESTAMP
See Also:
Constant Field Values

BOOLEANCHAR

public static final java.lang.String BOOLEANCHAR
See Also:
Constant Field Values

BOOLEANINT

public static final java.lang.String BOOLEANINT
See Also:
Constant Field Values
Constructor Detail

TypeMap

public TypeMap()
Method Detail

getJdbcTypeCode

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


getJdbcTypeName

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


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(java.lang.String type)
Returns true if values for the type need to be quoted.

Parameters:
type - The type to check.

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(java.lang.String type)
Returns true if values for the type need have size and scale measurements

Parameters:
type - The type to check.

registerSqlTypeID

protected static void registerSqlTypeID(java.lang.Integer sqlTypeID,
                                        java.lang.String name)
Registers the fact that the given Integer SQL ID maps to the given SQL name



Copyright © 2001-2007 Codehaus. All Rights Reserved.