3.1.2: 2012-07-31

net.sf.basedb.core.hibernate
Class TypeWrapper<T extends Type>

java.lang.Object
  extended by net.sf.basedb.core.hibernate.TypeWrapper<T>

public class TypeWrapper<T extends Type>
extends Object

Wrapper class for Hibernate types that will try to "hide" issues with the redesign of the type system in Hibernate that is going on in Hibernate 3.5.2 --> Hibernate 3.6.

Since:
2.16
Author:
Nicklas
Last modified
$Date: 2011-11-15 14:45:50 +0100 (Tue, 15 Nov 2011) $

Field Summary
static TypeWrapper<BooleanType> BOOLEAN
           
static TypeWrapper<DateType> DATE
           
static TypeWrapper<DoubleType> DOUBLE
           
static TypeWrapper<FloatType> FLOAT
           
private  T hibernateType
           
static TypeWrapper<IntegerType> INTEGER
           
static TypeWrapper<LongType> LONG
           
static TypeWrapper<ShortType> SHORT
           
private  int size
           
private  int sqlType
           
static TypeWrapper<StringType> STRING
           
static TypeWrapper<TextType> TEXT
           
static TypeWrapper<TimestampType> TIMESTAMP
           
 
Constructor Summary
protected TypeWrapper(T hibernateType, int size)
           
 
Method Summary
 int getApproximateSize()
          Get the number of bytes a single value for this type occupies in a database (approximately).
 T getHibernateType()
          Get the underlying Hibernate type.
 int getSQLType()
          Get the SQL code for database columns that can store this type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHORT

public static final TypeWrapper<ShortType> SHORT

INTEGER

public static final TypeWrapper<IntegerType> INTEGER

LONG

public static final TypeWrapper<LongType> LONG

FLOAT

public static final TypeWrapper<FloatType> FLOAT

DOUBLE

public static final TypeWrapper<DoubleType> DOUBLE

STRING

public static final TypeWrapper<StringType> STRING

TEXT

public static final TypeWrapper<TextType> TEXT

BOOLEAN

public static final TypeWrapper<BooleanType> BOOLEAN

DATE

public static final TypeWrapper<DateType> DATE

TIMESTAMP

public static final TypeWrapper<TimestampType> TIMESTAMP

hibernateType

private final T extends Type hibernateType

sqlType

private final int sqlType

size

private final int size
Constructor Detail

TypeWrapper

protected TypeWrapper(T hibernateType,
                      int size)
Method Detail

getHibernateType

public T getHibernateType()
Get the underlying Hibernate type.


getSQLType

public int getSQLType()
Get the SQL code for database columns that can store this type.

Returns:
A code, or 0 if not applicable to the given type
See Also:
Types

getApproximateSize

public int getApproximateSize()
Get the number of bytes a single value for this type occupies in a database (approximately). If the type represents a variable-length property, 0 is returned.

Returns:
The number of bytes required in the database or 0 if not known
Since:
3.1

3.1.2: 2012-07-31