org.ujorm.orm
Class TypeService

java.lang.Object
  extended by org.ujorm.orm.TypeService
All Implemented Interfaces:
ITypeService<Object,Object>

public class TypeService
extends Object
implements ITypeService<Object,Object>

A type service for popular Java types and more.


Field Summary
static char BIG_DECI
           
static char BIG_INTE
           
static char BLOB
           
static char BOOLEAN
           
static char BYTE
           
static char BYTES
           
static char BYTES_WRAP
           
static char CHAR
           
static char CLOB
           
static char COLOR
           
static char DATE_SQL
           
static char DATE_UTIL
           
static char DOUBLE
           
static char ENUM
           
static char EXPORT_ENUM
           
static char FLOAT
           
static char INT
           
static char LONG
           
static char SHORT
           
static char STRING
           
static char STRING_WRAP
           
static char TIME_SQL
           
static char TIMESTAMP
           
static char UNDEFINED
           
static char UUID
           
 
Constructor Summary
TypeService()
           
 
Method Summary
 Class getDbTypeClass(MetaColumn column)
          Return an converted Java type to database DDL statements by a generic test.
static char getTypeCode(MetaColumn column)
          The method returns a Java data type code.
 Object getValue(MetaColumn mColumn, CallableStatement rs, int c)
          GetValue from the stored precedure by position.
 Object getValue(MetaColumn mColumn, ResultSet rs, int c)
          GetValue from the result set by position It must be the same implementation as #of(org.ujorm.orm.metaModel.MetaColumn, java.sql.CallableStatement, int).
 void setValue(MetaColumn mColumn, PreparedStatement rs, Object value, int c)
          GetValue from the result set by position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final char UNDEFINED
See Also:
Constant Field Values

BOOLEAN

public static final char BOOLEAN
See Also:
Constant Field Values

BYTE

public static final char BYTE
See Also:
Constant Field Values

CHAR

public static final char CHAR
See Also:
Constant Field Values

SHORT

public static final char SHORT
See Also:
Constant Field Values

INT

public static final char INT
See Also:
Constant Field Values

LONG

public static final char LONG
See Also:
Constant Field Values

FLOAT

public static final char FLOAT
See Also:
Constant Field Values

DOUBLE

public static final char DOUBLE
See Also:
Constant Field Values

BIG_DECI

public static final char BIG_DECI
See Also:
Constant Field Values

BIG_INTE

public static final char BIG_INTE
See Also:
Constant Field Values

STRING

public static final char STRING
See Also:
Constant Field Values

BYTES

public static final char BYTES
See Also:
Constant Field Values

DATE_UTIL

public static final char DATE_UTIL
See Also:
Constant Field Values

DATE_SQL

public static final char DATE_SQL
See Also:
Constant Field Values

TIME_SQL

public static final char TIME_SQL
See Also:
Constant Field Values

TIMESTAMP

public static final char TIMESTAMP
See Also:
Constant Field Values

BLOB

public static final char BLOB
See Also:
Constant Field Values

CLOB

public static final char CLOB
See Also:
Constant Field Values

EXPORT_ENUM

public static final char EXPORT_ENUM
See Also:
Constant Field Values

STRING_WRAP

public static final char STRING_WRAP
See Also:
Constant Field Values

BYTES_WRAP

public static final char BYTES_WRAP
See Also:
Constant Field Values

ENUM

public static final char ENUM
See Also:
Constant Field Values

COLOR

public static final char COLOR
See Also:
Constant Field Values

UUID

public static final char UUID
See Also:
Constant Field Values
Constructor Detail

TypeService

public TypeService()
Method Detail

getTypeCode

public static char getTypeCode(MetaColumn column)
The method returns a Java data type code.

Parameters:
column - Colum provides a Type, there is supported a relation types too.
Returns:
Java type code for frequently used types.

getValue

public Object getValue(MetaColumn mColumn,
                       ResultSet rs,
                       int c)
                throws SQLException
GetValue from the result set by position It must be the same implementation as #of(org.ujorm.orm.metaModel.MetaColumn, java.sql.CallableStatement, int).

Specified by:
getValue in interface ITypeService<Object,Object>
Parameters:
mColumn - Meta-model column, where the typeCode must be assigned before.
rs - The ResultSet instance
c - Catabase column index starting at #1
Returns:
Value form the result set.
Throws:
SQLException

getValue

public Object getValue(MetaColumn mColumn,
                       CallableStatement rs,
                       int c)
                throws SQLException
GetValue from the stored precedure by position. It must be the same implementation as #of(org.ujorm.orm.metaModel.MetaColumn, java.sql.ResultSet, int).

Specified by:
getValue in interface ITypeService<Object,Object>
Parameters:
mColumn - Meta-model column, where the typeCode must be assigned before.
rs - The CallableStatement instance
c - Database column index starting at #1
Returns:
Value form the result set.
Throws:
SQLException

setValue

public void setValue(MetaColumn mColumn,
                     PreparedStatement rs,
                     Object value,
                     int c)
              throws SQLException
GetValue from the result set by position.

Specified by:
setValue in interface ITypeService<Object,Object>
Parameters:
mColumn - Meta-model column, where the typeCode must be assigned before.
rs - PreparedStatement
value - Value to assign
c - The database column index starts at #1
Throws:
SQLException

getDbTypeClass

public Class getDbTypeClass(MetaColumn column)
Return an converted Java type to database DDL statements by a generic test.

Specified by:
getDbTypeClass in interface ITypeService<Object,Object>


Copyright 2013, Pavel Ponec