org.javagen.revgen.mapping
Class Db2JavaUtil

java.lang.Object
  extended by org.javagen.revgen.mapping.Db2JavaUtil

public final class Db2JavaUtil
extends Object

Misc. static methods to support Java mapping.

Author:
Richard Easterling

Field Summary
(package private) static Map<org.javagen.agile.db.model.DbType,Class<?>> java2DbMapping
           
(package private) static Map<Class<?>,Class<?>> wrapperToPrimitive
           
 
Method Summary
static Class<?> booleanTypeCanidate(org.javagen.agile.db.model.Column column)
           
static Class<?> cardinalTypes(Integer precision)
           
static org.javagen.agile.oo.model.Class getClassFromTable(org.javagen.agile.db.model.Table table)
          Lookup mapped Class instance held in Table context filtering out link-tables.
static Class<?> javaType(org.javagen.agile.db.model.DbType dbType)
           
static Class<?> javaType(String dbType)
           
static Class<?> minimalJavaType(org.javagen.agile.db.model.Column column)
          Try to match best minimal Java numeric type needed to represent SQL type.
static Class<?> minimulNumericType(Integer precision, Integer scale)
           
static boolean notTrue(Boolean boolOrNull)
           
static Class<?> primitiveClass(Class<?> wrapperClass)
           
static Class<?> primitiveMappingCanidate(Class<?> wrapperClass, org.javagen.agile.db.model.Column column)
          Converts types to primitives if they are not keys and are not nullable.
static boolean zeroScale(Integer i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

java2DbMapping

static Map<org.javagen.agile.db.model.DbType,Class<?>> java2DbMapping

wrapperToPrimitive

static Map<Class<?>,Class<?>> wrapperToPrimitive
Method Detail

minimalJavaType

public static Class<?> minimalJavaType(org.javagen.agile.db.model.Column column)
Try to match best minimal Java numeric type needed to represent SQL type.

Parameters:
column -
Returns:
minimal sufficient type or null if no match found

cardinalTypes

public static Class<?> cardinalTypes(Integer precision)

minimulNumericType

public static Class<?> minimulNumericType(Integer precision,
                                          Integer scale)

zeroScale

public static boolean zeroScale(Integer i)

primitiveMappingCanidate

public static Class<?> primitiveMappingCanidate(Class<?> wrapperClass,
                                                org.javagen.agile.db.model.Column column)
Converts types to primitives if they are not keys and are not nullable.


booleanTypeCanidate

public static Class<?> booleanTypeCanidate(org.javagen.agile.db.model.Column column)

getClassFromTable

public static org.javagen.agile.oo.model.Class getClassFromTable(org.javagen.agile.db.model.Table table)
Lookup mapped Class instance held in Table context filtering out link-tables. This only works for 1-to-1 table to class mappings.

Parameters:
table -
Returns:
org.javagen.agile.java.model.Class instance

javaType

public static Class<?> javaType(org.javagen.agile.db.model.DbType dbType)

javaType

public static Class<?> javaType(String dbType)

notTrue

public static boolean notTrue(Boolean boolOrNull)

primitiveClass

public static Class<?> primitiveClass(Class<?> wrapperClass)
Parameters:
wrapperClass - - any Java class
Returns:
- primitive class if input is a wrapper class or null if the input in not a wrapper class


Copyright 2006-2006-2007 Outsource Cafe Inc.. All Rights Reserved.