Class EnumLetterType

java.lang.Object
org.openxava.types.EnumLetterType
All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public class EnumLetterType extends 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 Details

    • EnumLetterType

      public EnumLetterType()
  • Method Details

    • 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 obj1, Object obj2) throws org.hibernate.HibernateException
      Specified by:
      equals in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • hashCode

      public int hashCode(Object obj) 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, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor, 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 ps, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor) throws org.hibernate.HibernateException, SQLException
      Specified by:
      nullSafeSet in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
      SQLException
    • setParameterValues

      public void setParameterValues(Properties parameters)
      Specified by:
      setParameterValues in interface org.hibernate.usertype.ParameterizedType
    • deepCopy

      public Object deepCopy(Object obj) 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 obj) 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 original, Object target, Object owner) throws org.hibernate.HibernateException
      Specified by:
      replace in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • getEnumType

      public String getEnumType()
      Full qualified class for the Enum.

      For example: "org.openxava.test.model.Delivery$Distance"

    • setEnumType

      public void setEnumType(String enumType)
      Full qualified class for the Enum.

      For example: "org.openxava.test.model.Delivery$Distance"

    • getLetters

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