org.jcoderz.commons.util
Class BigDecimalUserTypeBase

java.lang.Object
  extended by org.jcoderz.commons.util.UserTypeBase
      extended by org.jcoderz.commons.util.BigDecimalUserTypeBase
All Implemented Interfaces:
Serializable, org.hibernate.usertype.UserType
Direct Known Subclasses:
SampleFixPointUserType, TestFixPointTwoUserType, TestFixPointUserType

public abstract class BigDecimalUserTypeBase
extends UserTypeBase

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

Author:
Andreas Mandel
See Also:
Serialized Form

Constructor Summary
BigDecimalUserTypeBase()
           
 
Method Summary
abstract  Object fromBigDecimal(BigDecimal 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  BigDecimal toBigDecimal(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

BigDecimalUserTypeBase

public BigDecimalUserTypeBase()
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

fromBigDecimal

public abstract Object fromBigDecimal(BigDecimal value)
Implement this method for the particular StrongType.

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

toBigDecimal

public abstract BigDecimal toBigDecimal(Object value)
Implement this method for the particular StrongType.

Parameters:
value - the StrongType to be converted into its BigDecimal 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.