Package org.openxava.types
Class EnumLetterType
- java.lang.Object
-
- org.openxava.types.EnumLetterType
-
- All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType
,org.hibernate.usertype.UserType
public class EnumLetterType extends java.lang.Object implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType
In java an Enum and in database a letter corresponding to the position in the string that it's in property 'letters'.- Author:
- Javier Paniza
-
-
Constructor Summary
Constructors Constructor Description EnumLetterType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
assemble(java.io.Serializable cached, java.lang.Object owner)
java.lang.Object
deepCopy(java.lang.Object obj)
java.io.Serializable
disassemble(java.lang.Object obj)
boolean
equals(java.lang.Object obj1, java.lang.Object obj2)
java.lang.String
getEnumType()
Full qualified class for the Enum.java.lang.String
getLetters()
Letters string that corresponds with the valid values for this enum.int
hashCode(java.lang.Object obj)
boolean
isMutable()
java.lang.Object
nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor, java.lang.Object owner)
void
nullSafeSet(java.sql.PreparedStatement ps, java.lang.Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor)
java.lang.Object
replace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)
java.lang.Class
returnedClass()
void
setEnumType(java.lang.String enumType)
Full qualified class for the Enum.void
setLetters(java.lang.String letters)
Letters string that corresponds with the valid values for this enum.void
setParameterValues(java.util.Properties parameters)
int[]
sqlTypes()
-
-
-
Method Detail
-
sqlTypes
public int[] sqlTypes()
- Specified by:
sqlTypes
in interfaceorg.hibernate.usertype.UserType
-
returnedClass
public java.lang.Class returnedClass()
- Specified by:
returnedClass
in interfaceorg.hibernate.usertype.UserType
-
equals
public boolean equals(java.lang.Object obj1, java.lang.Object obj2) throws org.hibernate.HibernateException
- Specified by:
equals
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
hashCode
public int hashCode(java.lang.Object obj) throws org.hibernate.HibernateException
- Specified by:
hashCode
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
nullSafeGet
public java.lang.Object nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor, java.lang.Object owner) throws org.hibernate.HibernateException, java.sql.SQLException
- Specified by:
nullSafeGet
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
java.sql.SQLException
-
nullSafeSet
public void nullSafeSet(java.sql.PreparedStatement ps, java.lang.Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor) throws org.hibernate.HibernateException, java.sql.SQLException
- Specified by:
nullSafeSet
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
java.sql.SQLException
-
setParameterValues
public void setParameterValues(java.util.Properties parameters)
- Specified by:
setParameterValues
in interfaceorg.hibernate.usertype.ParameterizedType
-
deepCopy
public java.lang.Object deepCopy(java.lang.Object obj) throws org.hibernate.HibernateException
- Specified by:
deepCopy
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
isMutable
public boolean isMutable()
- Specified by:
isMutable
in interfaceorg.hibernate.usertype.UserType
-
disassemble
public java.io.Serializable disassemble(java.lang.Object obj) throws org.hibernate.HibernateException
- Specified by:
disassemble
in interfaceorg.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 interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
replace
public java.lang.Object replace(java.lang.Object original, java.lang.Object target, java.lang.Object owner) throws org.hibernate.HibernateException
- Specified by:
replace
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
getEnumType
public java.lang.String getEnumType()
Full qualified class for the Enum.For example: "org.openxava.test.model.Delivery$Distance"
-
setEnumType
public void setEnumType(java.lang.String enumType)
Full qualified class for the Enum.For example: "org.openxava.test.model.Delivery$Distance"
-
getLetters
public java.lang.String getLetters()
Letters string that corresponds with the valid values for this enum.For example, "AEI", means:
- ordinal 0 in Java Enum for 'A' in DB
- ordinal 1 in Java Enum for 'E' in DB
- ordinal 2 in Java Enum for 'I' in DB
-
setLetters
public void setLetters(java.lang.String letters)
Letters string that corresponds with the valid values for this enum.For example, "AEI", means:
- ordinal 0 in Java Enum for 'A' in DB
- ordinal 1 in Java Enum for 'E' in DB
- ordinal 2 in Java Enum for 'I' in DB
-
-