org.jcoderz.commons.util
Class IntUserTypeBase

java.lang.Object
  extended by org.jcoderz.commons.util.UserTypeBase
      extended by org.jcoderz.commons.util.IntUserTypeBase
All Implemented Interfaces:
Serializable, org.hibernate.usertype.UserType
Direct Known Subclasses:
TestEnumAsNumericUserType, TestEnumExpliciteValueUserType

public abstract class IntUserTypeBase
extends UserTypeBase

This class is used by the Hibernate binding for numeric strong types.

Author:
Andreas Mandel
See Also:
Serialized Form

Constructor Summary
IntUserTypeBase()
           
 
Method Summary
abstract  Object fromInt(int value)
          Implement this method for the particular StrongType.
 Object nullSafeGet(ResultSet resultSet, String[] types, Object owner)
          
 void nullSafeSet(PreparedStatement statement, Object value, int index)
          
 int[] sqlTypes()
          
abstract  int toInt(Object value)
          Implement this method for the particular StrongType.
 
Methods inherited from class org.jcoderz.commons.util.UserTypeBase
assemble, deepCopy, disassemble, equals, hashCode, isMutable, replace, returnedClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntUserTypeBase

public IntUserTypeBase()
Method Detail

nullSafeGet

public Object nullSafeGet(ResultSet resultSet,
                          String[] types,
                          Object owner)
                   throws org.hibernate.HibernateException,
                          SQLException

Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Specified by:
nullSafeGet in class UserTypeBase
Throws:
org.hibernate.HibernateException
SQLException

fromInt

public abstract Object fromInt(int value)
Implement this method for the particular StrongType.

Parameters:
value - the int representation of the mapped class
Returns:
the instance of the mapped class

toInt

public abstract int toInt(Object value)
Implement this method for the particular StrongType.

Parameters:
value - the StrongType to be converted into its numeric representation.
Returns:
the int representation of the value given.

nullSafeSet

public void nullSafeSet(PreparedStatement statement,
                        Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        SQLException

Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Specified by:
nullSafeSet in class UserTypeBase
Throws:
org.hibernate.HibernateException
SQLException

sqlTypes

public int[] sqlTypes()

Specified by:
sqlTypes in interface org.hibernate.usertype.UserType
Specified by:
sqlTypes in class UserTypeBase


Copyright 2007 The jCoderZ Project.