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:
Serializable, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

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

Hibernate Usertype that enum values by their ID

Since:
1.1
Author:
Siegfried Puchbauer
See Also:
Serialized Form

Field Summary
static String ENUM_ID_ACCESSOR
           
static String PARAM_ENUM_CLASS
           
 
Constructor Summary
IdentityEnumType()
           
 
Method Summary
 Object assemble(Serializable cached, Object owner)
           
 Object deepCopy(Object o)
           
 Serializable disassemble(Object o)
           
 boolean equals(Object o1, Object o2)
           
static org.codehaus.groovy.grails.orm.hibernate.cfg.IdentityEnumType.BidiEnumMap getBidiEnumMap(Class<? extends Enum> cls)
           
 int hashCode(Object o)
           
static boolean isEnabled()
           
 boolean isMutable()
           
 Object nullSafeGet(ResultSet resultSet, String[] names, Object owner)
           
 void nullSafeSet(PreparedStatement pstmt, Object value, int idx)
           
 Object replace(Object orig, Object target, Object owner)
           
 Class returnedClass()
           
 void setParameterValues(Properties properties)
           
 int[] sqlTypes()
           
static boolean supports(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 String ENUM_ID_ACCESSOR
See Also:
Constant Field Values

PARAM_ENUM_CLASS

public static final 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(Class<? extends Enum> cls)
                                                                                                throws IllegalAccessException,
                                                                                                       NoSuchMethodException,
                                                                                                       InvocationTargetException
Throws:
IllegalAccessException
NoSuchMethodException
InvocationTargetException

isEnabled

public static boolean isEnabled()

supports

public static boolean supports(Class enumClass)

setParameterValues

public void setParameterValues(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 Class returnedClass()
Specified by:
returnedClass in interface org.hibernate.usertype.UserType

equals

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

hashCode

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

nullSafeGet

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

nullSafeSet

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

deepCopy

public Object deepCopy(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 Serializable disassemble(Object o)
                         throws org.hibernate.HibernateException
Specified by:
disassemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

assemble

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

replace

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


Copyright (c) 2005-2009 The Grails project