org.codehaus.groovy.grails.orm.hibernate.cfg
Class IdentityEnumType

java.lang.Object
  extended by org.codehaus.groovy.grails.orm.hibernate.cfg.IdentityEnumType
All Implemented Interfaces:
java.io.Serializable, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public class IdentityEnumType
extends java.lang.Object
implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType, java.io.Serializable

Hibernate Usertype that enum values by their ID.

Since:
1.1
See Also:
Serialized Form

Field Summary
static java.lang.String ENUM_ID_ACCESSOR
           
static java.lang.String PARAM_ENUM_CLASS
           
 
Constructor Summary
IdentityEnumType()
           
 
Method Summary
 java.lang.Object assemble(java.io.Serializable cached, java.lang.Object owner)
           
 java.lang.Object deepCopy(java.lang.Object o)
           
 java.io.Serializable disassemble(java.lang.Object o)
           
 boolean equals(java.lang.Object o1, java.lang.Object o2)
           
static org.codehaus.groovy.grails.orm.hibernate.cfg.IdentityEnumType.BidiEnumMap getBidiEnumMap(java.lang.Class<? extends java.lang.Enum<?>> cls)
           
 int hashCode(java.lang.Object o)
           
static boolean isEnabled()
           
 boolean isMutable()
           
 java.lang.Object nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, java.lang.Object owner)
           
 void nullSafeSet(java.sql.PreparedStatement pstmt, java.lang.Object value, int idx)
           
 java.lang.Object replace(java.lang.Object orig, java.lang.Object target, java.lang.Object owner)
           
 java.lang.Class<?> returnedClass()
           
 void setParameterValues(java.util.Properties properties)
           
 int[] sqlTypes()
           
static boolean supports(java.lang.Class enumClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENUM_ID_ACCESSOR

public static final java.lang.String ENUM_ID_ACCESSOR
See Also:
Constant Field Values

PARAM_ENUM_CLASS

public static final java.lang.String PARAM_ENUM_CLASS
See Also:
Constant Field Values
Constructor Detail

IdentityEnumType

public IdentityEnumType()
Method Detail

getBidiEnumMap

public static org.codehaus.groovy.grails.orm.hibernate.cfg.IdentityEnumType.BidiEnumMap getBidiEnumMap(java.lang.Class<? extends java.lang.Enum<?>> cls)
                                                                                                throws java.lang.IllegalAccessException,
                                                                                                       java.lang.NoSuchMethodException,
                                                                                                       java.lang.reflect.InvocationTargetException
Throws:
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException

isEnabled

public static boolean isEnabled()

supports

public static boolean supports(java.lang.Class enumClass)

setParameterValues

public void setParameterValues(java.util.Properties properties)
Specified by:
setParameterValues in interface org.hibernate.usertype.ParameterizedType

sqlTypes

public int[] sqlTypes()
Specified by:
sqlTypes in interface org.hibernate.usertype.UserType

returnedClass

public java.lang.Class<?> returnedClass()
Specified by:
returnedClass in interface org.hibernate.usertype.UserType

equals

public boolean equals(java.lang.Object o1,
                      java.lang.Object o2)
               throws org.hibernate.HibernateException
Specified by:
equals in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

hashCode

public int hashCode(java.lang.Object o)
             throws org.hibernate.HibernateException
Specified by:
hashCode in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

nullSafeGet

public java.lang.Object nullSafeGet(java.sql.ResultSet resultSet,
                                    java.lang.String[] names,
                                    java.lang.Object owner)
                             throws org.hibernate.HibernateException,
                                    java.sql.SQLException
Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement pstmt,
                        java.lang.Object value,
                        int idx)
                 throws org.hibernate.HibernateException,
                        java.sql.SQLException
Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

deepCopy

public java.lang.Object deepCopy(java.lang.Object o)
                          throws org.hibernate.HibernateException
Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

isMutable

public boolean isMutable()
Specified by:
isMutable in interface org.hibernate.usertype.UserType

disassemble

public java.io.Serializable disassemble(java.lang.Object o)
                                 throws org.hibernate.HibernateException
Specified by:
disassemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

assemble

public java.lang.Object assemble(java.io.Serializable cached,
                                 java.lang.Object owner)
                          throws org.hibernate.HibernateException
Specified by:
assemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

replace

public java.lang.Object replace(java.lang.Object orig,
                                java.lang.Object target,
                                java.lang.Object owner)
                         throws org.hibernate.HibernateException
Specified by:
replace in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException