Class EnumLetterType

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

public class EnumLetterType extends Object implements org.hibernate.usertype.UserType<Enum>, 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'.

Since:
8.0
Author:
Javier Paniza
  • Constructor Details

    • EnumLetterType

      public EnumLetterType()
  • Method Details

    • getSqlType

      public int getSqlType()
      Specified by:
      getSqlType in interface org.hibernate.usertype.UserType<Enum>
    • returnedClass

      public Class<Enum> returnedClass()
      Specified by:
      returnedClass in interface org.hibernate.usertype.UserType<Enum>
    • equals

      public boolean equals(Enum x, Enum y)
      Specified by:
      equals in interface org.hibernate.usertype.UserType<Enum>
    • hashCode

      public int hashCode(Enum x)
      Specified by:
      hashCode in interface org.hibernate.usertype.UserType<Enum>
    • nullSafeGet

      public Enum nullSafeGet(ResultSet rs, int position, org.hibernate.type.descriptor.WrapperOptions options) throws SQLException
      Specified by:
      nullSafeGet in interface org.hibernate.usertype.UserType<Enum>
      Throws:
      SQLException
    • nullSafeSet

      public void nullSafeSet(PreparedStatement st, Enum value, int index, org.hibernate.type.descriptor.WrapperOptions options) throws SQLException
      Specified by:
      nullSafeSet in interface org.hibernate.usertype.UserType<Enum>
      Throws:
      SQLException
    • setParameterValues

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

      public Enum deepCopy(Enum value)
      Specified by:
      deepCopy in interface org.hibernate.usertype.UserType<Enum>
    • isMutable

      public boolean isMutable()
      Specified by:
      isMutable in interface org.hibernate.usertype.UserType<Enum>
    • disassemble

      public Serializable disassemble(Enum value)
      Specified by:
      disassemble in interface org.hibernate.usertype.UserType<Enum>
    • assemble

      public Enum assemble(Serializable cached, Object owner)
      Specified by:
      assemble in interface org.hibernate.usertype.UserType<Enum>
    • replace

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