org.objectweb.jorm.mapper.rdb.adapter.api

Interface TypeAdapter

Known Subinterfaces:
RdbAdapter, RdbAdapter
Known Implementing Classes:
BasicRdbAdapter, CloudscapeAdapter, Db2Adapter, FirebirdAdapter, HsqlAdapter, MckoiAdapter, MysqlAdapter, Oracle8Adapter, OracleAdapter, PostgresAdapter, ProgressAdapter, SapdbAdapter, SqlserverAdapter, SybaseAdapter

public interface TypeAdapter

The supported type in the adapter.

Author:
S.Chassande-Barrioz

Field Summary

static short
TYPECODE_BIGDECIMAL
Defines the java.util.BigDecimal type.
static short
TYPECODE_BIGINTEGER
Defines the java.util.BigInteger type.
static short
TYPECODE_BOOLEAN
Defines the boolean type.
static short
TYPECODE_BYTE
Defines the byte type.
static short
TYPECODE_BYTEARRAY
Defines the byte[] type.
static short
TYPECODE_CHAR
Defines the char type.
static short
TYPECODE_CHARARRAY
Defines the char[] type.
static short
TYPECODE_DATE
Defines the java.util.Date type.
static short
TYPECODE_DOUBLE
Defines the double type.
static short
TYPECODE_FLOAT
Defines the float type.
static short
TYPECODE_INT
Defines the int type.
static short
TYPECODE_LONG
Defines the long type.
static short
TYPECODE_OBJBOOLEAN
Defines the java.lang.Boolean type.
static short
TYPECODE_OBJBYTE
Defines the java.lang.Character type.
static short
TYPECODE_OBJCHAR
Defines the java.lang.Boolean type.
static short
TYPECODE_OBJDOUBLE
Defines the java.lang.Double type.
static short
TYPECODE_OBJFLOAT
Defines the java.lang.Float type.
static short
TYPECODE_OBJINT
Defines the java.lang.Integer type.
static short
TYPECODE_OBJLONG
Defines the java.lang.Long type.
static short
TYPECODE_OBJSHORT
Defines the java.lang.Short type.
static short
TYPECODE_SERIALIZED
Defines the java.io.Serializable type.
static short
TYPECODE_SHORT
Defines the short type.
static short
TYPECODE_STRING
Defines the java.lang.String type.
static String[]
TYPE_NAMES
the name of the types TYPE_NAMES[TYPECODE_XXX]

Method Summary

String
getSqlType(int typeCode, boolean usedInPK, int size, int scale)
This method returns the SQL type linked to the java type
int
getSqlTypeCode(int typeCode)
This method returns the SQL type code linked to the java type specified in parameter.
int
getSqlTypeCode(int typeCode, String sqlColumnType)
This method returns the SQL type code linked to the java type specified in parameter.

Field Details

TYPECODE_BIGDECIMAL

public static final short TYPECODE_BIGDECIMAL
Defines the java.util.BigDecimal type. If you modify this value, beware about the jorm type

Field Value:
22


TYPECODE_BIGINTEGER

public static final short TYPECODE_BIGINTEGER
Defines the java.util.BigInteger type. If you modify this value, beware about the jorm type

Field Value:
21


TYPECODE_BOOLEAN

public static final short TYPECODE_BOOLEAN
Defines the boolean type. If you modify this value, beware about the jorm type

Field Value:
0


TYPECODE_BYTE

public static final short TYPECODE_BYTE
Defines the byte type. If you modify this value, beware about the jorm type

Field Value:
2


TYPECODE_BYTEARRAY

public static final short TYPECODE_BYTEARRAY
Defines the byte[] type. If you modify this value, beware about the jorm type

Field Value:
19


TYPECODE_CHAR

public static final short TYPECODE_CHAR
Defines the char type. If you modify this value, beware about the jorm type

Field Value:
1


TYPECODE_CHARARRAY

public static final short TYPECODE_CHARARRAY
Defines the char[] type. If you modify this value, beware about the jorm type

Field Value:
18


TYPECODE_DATE

public static final short TYPECODE_DATE
Defines the java.util.Date type. If you modify this value, beware about the jorm type

Field Value:
17


TYPECODE_DOUBLE

public static final short TYPECODE_DOUBLE
Defines the double type. If you modify this value, beware about the jorm type

Field Value:
7


TYPECODE_FLOAT

public static final short TYPECODE_FLOAT
Defines the float type. If you modify this value, beware about the jorm type

Field Value:
6


TYPECODE_INT

public static final short TYPECODE_INT
Defines the int type. If you modify this value, beware about the jorm type

Field Value:
4


TYPECODE_LONG

public static final short TYPECODE_LONG
Defines the long type. If you modify this value, beware about the jorm type

Field Value:
5


TYPECODE_OBJBOOLEAN

public static final short TYPECODE_OBJBOOLEAN
Defines the java.lang.Boolean type. If you modify this value, beware about the jorm type

Field Value:
8


TYPECODE_OBJBYTE

public static final short TYPECODE_OBJBYTE
Defines the java.lang.Character type. If you modify this value, beware about the jorm type

Field Value:
10


TYPECODE_OBJCHAR

public static final short TYPECODE_OBJCHAR
Defines the java.lang.Boolean type. If you modify this value, beware about the jorm type

Field Value:
9


TYPECODE_OBJDOUBLE

public static final short TYPECODE_OBJDOUBLE
Defines the java.lang.Double type. If you modify this value, beware about the jorm type

Field Value:
15


TYPECODE_OBJFLOAT

public static final short TYPECODE_OBJFLOAT
Defines the java.lang.Float type. If you modify this value, beware about the jorm type

Field Value:
14


TYPECODE_OBJINT

public static final short TYPECODE_OBJINT
Defines the java.lang.Integer type. If you modify this value, beware about the jorm type

Field Value:
12


TYPECODE_OBJLONG

public static final short TYPECODE_OBJLONG
Defines the java.lang.Long type. If you modify this value, beware about the jorm type

Field Value:
13


TYPECODE_OBJSHORT

public static final short TYPECODE_OBJSHORT
Defines the java.lang.Short type. If you modify this value, beware about the jorm type

Field Value:
11


TYPECODE_SERIALIZED

public static final short TYPECODE_SERIALIZED
Defines the java.io.Serializable type. If you modify this value, beware about the jorm type

Field Value:
20


TYPECODE_SHORT

public static final short TYPECODE_SHORT
Defines the short type. If you modify this value, beware about the jorm type

Field Value:
3


TYPECODE_STRING

public static final short TYPECODE_STRING
Defines the java.lang.String type. If you modify this value, beware about the jorm type

Field Value:
16


TYPE_NAMES

public static final String[] TYPE_NAMES
the name of the types TYPE_NAMES[TYPECODE_XXX]

Method Details

getSqlType

public String getSqlType(int typeCode,
                         boolean usedInPK,
                         int size,
                         int scale)
            throws RdbAdapterException
This method returns the SQL type linked to the java type

Parameters:
typeCode - is the type code of the java type
usedInPK - indicates if the type has to be used into a Primary key
size - can indicates the expected size of the type. If it equals to NO_SIZE that means no size is expected. This parameter can be used for float, BigXXX numbers, String,...
scale - can indicates the expected scale of the type. If it equals to NO_SIZE that means no scale is expected.


getSqlTypeCode

public int getSqlTypeCode(int typeCode)
            throws RdbAdapterException
This method returns the SQL type code linked to the java type specified in parameter.

Returns:
An int constant defined in the java.sql.Types class


getSqlTypeCode

public int getSqlTypeCode(int typeCode,
                          String sqlColumnType)
            throws RdbAdapterException
This method returns the SQL type code linked to the java type specified in parameter.

Returns:
An int constant defined in the java.sql.Types class