org.apache.ojb.broker.metadata
Class JdbcTypesHelper

java.lang.Object
  extended by org.apache.ojb.broker.metadata.JdbcTypesHelper
Direct Known Subclasses:
JdbcTypesHelper

public class JdbcTypesHelper
extends java.lang.Object

Helper class which provide all supported JdbcType classes (based on the Types) as inner classes.

Version:
$Id: JdbcTypesHelper.java 365232 2005-12-21 22:36:07Z tomdz $
See Also:
JdbcType

Nested Class Summary
static class JdbcTypesHelper.BaseType
           
static class JdbcTypesHelper.T_Array
           
static class JdbcTypesHelper.T_BigInt
           
static class JdbcTypesHelper.T_Binary
           
static class JdbcTypesHelper.T_Bit
           
static class JdbcTypesHelper.T_Blob
           
static class JdbcTypesHelper.T_Boolean
           
static class JdbcTypesHelper.T_Char
           
static class JdbcTypesHelper.T_Clob
           
static class JdbcTypesHelper.T_Datalink
           
static class JdbcTypesHelper.T_Date
           
static class JdbcTypesHelper.T_Decimal
           
static class JdbcTypesHelper.T_Double
           
static class JdbcTypesHelper.T_Float
           
static class JdbcTypesHelper.T_Integer
           
static class JdbcTypesHelper.T_LongVarBinary
           
static class JdbcTypesHelper.T_LongVarChar
           
static class JdbcTypesHelper.T_Numeric
           
static class JdbcTypesHelper.T_Real
           
static class JdbcTypesHelper.T_Ref
           
static class JdbcTypesHelper.T_SmallInt
           
static class JdbcTypesHelper.T_Struct
           
static class JdbcTypesHelper.T_Time
           
static class JdbcTypesHelper.T_Timestamp
           
static class JdbcTypesHelper.T_TinyInt
           
static class JdbcTypesHelper.T_VarBinary
           
static class JdbcTypesHelper.T_Varchar
           
 
Constructor Summary
JdbcTypesHelper()
           
 
Method Summary
static JdbcType getJdbcTypeByName(java.lang.String typeName)
          Lookup the JdbcType by name.
static JdbcType getJdbcTypeByReflection(java.lang.String fieldType)
          Try to automatically assign a jdbc type for the given java type name.
static JdbcType getJdbcTypeByTypesIndex(java.lang.Integer type)
          Return the JdbcType for the given jdbc type.
static java.lang.Object getObjectFromColumn(java.sql.ResultSet rs, java.lang.Integer jdbcType, int columnId)
          Returns an java object read from the specified ResultSet column.
static java.lang.String getSqlTypeAsString(int jdbcType)
          Returns a string representation of the given Types value.
static void setJdbcType(java.lang.String typeName, int typeIndex, JdbcType type)
          Set the JdbcType by name and index.
static void setJdbcTypeByName(java.lang.String typeName, JdbcType type)
          Set the JdbcType by name.
static void setJdbcTypeByTypesIndex(int typeIndex, JdbcType type)
          Set the JdbcType by index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcTypesHelper

public JdbcTypesHelper()
Method Detail

setJdbcType

public static void setJdbcType(java.lang.String typeName,
                               int typeIndex,
                               JdbcType type)
Set the JdbcType by name and index.

Parameters:
typeName - Name of the type
typeIndex - index of the type
type - the type

getJdbcTypeByTypesIndex

public static JdbcType getJdbcTypeByTypesIndex(java.lang.Integer type)
Return the JdbcType for the given jdbc type.


setJdbcTypeByTypesIndex

public static void setJdbcTypeByTypesIndex(int typeIndex,
                                           JdbcType type)
Set the JdbcType by index.

Parameters:
typeIndex - index of the type
type - the type

getJdbcTypeByName

public static JdbcType getJdbcTypeByName(java.lang.String typeName)
Lookup the JdbcType by name. If name was not found an exception is thrown.


setJdbcTypeByName

public static void setJdbcTypeByName(java.lang.String typeName,
                                     JdbcType type)
Set the JdbcType by name.

Parameters:
typeName - Name of the type
type - the type

getJdbcTypeByReflection

public static JdbcType getJdbcTypeByReflection(java.lang.String fieldType)
Try to automatically assign a jdbc type for the given java type name. This method is used if e.g. in metadata a column type was not set.

See Also:
FieldDescriptor.getJdbcType()

getObjectFromColumn

public static java.lang.Object getObjectFromColumn(java.sql.ResultSet rs,
                                                   java.lang.Integer jdbcType,
                                                   int columnId)
                                            throws java.sql.SQLException
Returns an java object read from the specified ResultSet column.

Throws:
java.sql.SQLException

getSqlTypeAsString

public static java.lang.String getSqlTypeAsString(int jdbcType)
Returns a string representation of the given Types value.



(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30