org.kuali.rice.core.framework.persistence.jpa.type
Class HibernateImmutableValueUserType

java.lang.Object
  extended by org.kuali.rice.core.framework.persistence.jpa.type.HibernateImmutableValueUserType
All Implemented Interfaces:
org.hibernate.usertype.UserType
Direct Known Subclasses:
HibernateKualiCharBooleanAIType, HibernateKualiDecimalFieldType, HibernateKualiEncryptDecryptUserType, HibernateKualiHashType, HibernateKualiIntegerFieldType, HibernateKualiIntegerPercentFieldType, HibernateKualiPercentFieldType, KualiDecimalIntegerPercentFieldType

public abstract class HibernateImmutableValueUserType
extends Object
implements org.hibernate.usertype.UserType

This is a description of what this class does - jksmith don't forget to fill this in.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
HibernateImmutableValueUserType()
           
 
Method Summary
 Object assemble(Serializable cached, Object owner)
          As the object is immutable, the immutable value will simply stay in the cache
 Object deepCopy(Object value)
          As the object is immutable, simply returns the value
 Serializable disassemble(Object value)
          As the object is immutable, returns the value if it is Serializable - otherwise returns null
 boolean equals(Object x, Object y)
          As the object is immutable, assumes it has a good equals method on it
 int hashCode(Object value)
          Returns the hashcode of the passed in value
 boolean isMutable()
          Immutable types aren't mutable...kind of by definintion
abstract  Object nullSafeGet(ResultSet rs, String[] names, Object owner)
          Abstract method for children classes to override - this returns the SQL value from the given ResultSet into a Java value
abstract  void nullSafeSet(PreparedStatement st, Object value, int index)
          Abstract method for children to override - takes a Java value and changes it to be correctly added to the given PreparedStatement
 Object replace(Object original, Object target, Object owner)
          Since the original is immutable, returns the original
abstract  Class returnedClass()
          Abstract method for children to override - returns the class of the Java value returned by nullSafeGet
abstract  int[] sqlTypes()
          Abstract method for children to override - returns the SQL type set in nullSafeSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateImmutableValueUserType

public HibernateImmutableValueUserType()
Method Detail

assemble

public Object assemble(Serializable cached,
                       Object owner)
                throws org.hibernate.HibernateException
As the object is immutable, the immutable value will simply stay in the cache

Specified by:
assemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.assemble(java.io.Serializable, java.lang.Object)

deepCopy

public Object deepCopy(Object value)
                throws org.hibernate.HibernateException
As the object is immutable, simply returns the value

Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.deepCopy(java.lang.Object)

disassemble

public Serializable disassemble(Object value)
                         throws org.hibernate.HibernateException
As the object is immutable, returns the value if it is Serializable - otherwise returns null

Specified by:
disassemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.disassemble(java.lang.Object)

equals

public boolean equals(Object x,
                      Object y)
               throws org.hibernate.HibernateException
As the object is immutable, assumes it has a good equals method on it

Specified by:
equals in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.equals(java.lang.Object, java.lang.Object)

hashCode

public int hashCode(Object value)
             throws org.hibernate.HibernateException
Returns the hashcode of the passed in value

Specified by:
hashCode in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.hashCode(java.lang.Object)

isMutable

public boolean isMutable()
Immutable types aren't mutable...kind of by definintion

Specified by:
isMutable in interface org.hibernate.usertype.UserType
See Also:
UserType.isMutable()

nullSafeGet

public abstract Object nullSafeGet(ResultSet rs,
                                   String[] names,
                                   Object owner)
                            throws org.hibernate.HibernateException,
                                   SQLException
Abstract method for children classes to override - this returns the SQL value from the given ResultSet into a Java value

Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException
See Also:
UserType.nullSafeGet(java.sql.ResultSet, java.lang.String[], java.lang.Object)

nullSafeSet

public abstract void nullSafeSet(PreparedStatement st,
                                 Object value,
                                 int index)
                          throws org.hibernate.HibernateException,
                                 SQLException
Abstract method for children to override - takes a Java value and changes it to be correctly added to the given PreparedStatement

Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException
See Also:
UserType.nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int)

replace

public Object replace(Object original,
                      Object target,
                      Object owner)
               throws org.hibernate.HibernateException
Since the original is immutable, returns the original

Specified by:
replace in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
See Also:
UserType.replace(java.lang.Object, java.lang.Object, java.lang.Object)

returnedClass

public abstract Class returnedClass()
Abstract method for children to override - returns the class of the Java value returned by nullSafeGet

Specified by:
returnedClass in interface org.hibernate.usertype.UserType
See Also:
UserType.returnedClass()

sqlTypes

public abstract int[] sqlTypes()
Abstract method for children to override - returns the SQL type set in nullSafeSet

Specified by:
sqlTypes in interface org.hibernate.usertype.UserType
See Also:
UserType.sqlTypes()


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.