Class EnumType<T extends Enum<T>>

    • Method Detail

      • getValueConverter

        public BasicValueConverter<T,​Object> getValueConverter()
        Description copied from interface: UserType
        Returns the converter that this user type uses for transforming from the domain type, to the relational type, or null if there is no conversion. Note that it is vital to provide a converter if a column should be mapped to multiple domain types, as Hibernate will only select a column once and materialize values as JdbcMapping.getJdbcJavaType(). Support for multiple domain type representations works by converting objects of that type to the domain type.
        Specified by:
        getValueConverter in interface UserType<T extends Enum<T>>
      • getSqlType

        public int getSqlType()
        Description copied from interface: UserType
        Return the SQL type code for the column mapped by this type. The codes are generally defined on org.hibernate.type.SqlTypes, but could be database-specific codes
        Specified by:
        getSqlType in interface UserType<T extends Enum<T>>
        See Also:
        SqlTypes
      • returnedClass

        public Class<T> returnedClass()
        Description copied from interface: UserType
        The class returned by nullSafeGet().
        Specified by:
        returnedClass in interface UserType<T extends Enum<T>>
        Returns:
        Class
      • deepCopy

        public T deepCopy​(T value)
                   throws HibernateException
        Description copied from interface: UserType
        Return a deep copy of the persistent state, stopping at entities and at collections. It is not necessary to copy immutable objects, or null values, in which case it is safe to simply return the argument.
        Specified by:
        deepCopy in interface UserType<T extends Enum<T>>
        Parameters:
        value - the object to be cloned, which may be null
        Returns:
        Object a copy
        Throws:
        HibernateException
      • isMutable

        public boolean isMutable()
        Description copied from interface: UserType
        Are objects of this type mutable?
        Specified by:
        isMutable in interface UserType<T extends Enum<T>>
        Returns:
        boolean
      • disassemble

        public Serializable disassemble​(T value)
                                 throws HibernateException
        Description copied from interface: UserType
        Transform the object into its cacheable representation. At the very least this method should perform a deep copy if the type is mutable. That may not be enough for some implementations, however; for example, associations must be cached as identifier values. (optional operation)
        Specified by:
        disassemble in interface UserType<T extends Enum<T>>
        Parameters:
        value - the object to be cached
        Returns:
        a cacheable representation of the object
        Throws:
        HibernateException
      • assemble

        public T assemble​(Serializable cached,
                          Object owner)
                   throws HibernateException
        Description copied from interface: UserType
        Reconstruct an object from the cacheable representation. At the very least this method should perform a deep copy if the type is mutable. (optional operation)
        Specified by:
        assemble in interface UserType<T extends Enum<T>>
        Parameters:
        cached - the object to be cached
        owner - the owner of the cached object
        Returns:
        a reconstructed object from the cacheable representation
        Throws:
        HibernateException
      • replace

        public T replace​(T original,
                         T target,
                         Object owner)
                  throws HibernateException
        Description copied from interface: UserType
        During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.
        Specified by:
        replace in interface UserType<T extends Enum<T>>
        Parameters:
        original - the value from the detached entity being merged
        target - the value in the managed entity
        Returns:
        the value to be merged
        Throws:
        HibernateException
      • toString

        public String toString​(T value)
        Description copied from interface: EnhancedUserType
        Render the value to the string representation.
        Specified by:
        toString in interface EnhancedUserType<T extends Enum<T>>
        Parameters:
        value - The value to render to string.
        Returns:
        The string representation
      • fromStringValue

        public T fromStringValue​(CharSequence sequence)
        Description copied from interface: EnhancedUserType
        Consume the given string representation back into this types java form.
        Specified by:
        fromStringValue in interface EnhancedUserType<T extends Enum<T>>
        Parameters:
        sequence - The string representation to be consumed.
        Returns:
        The java type representation
      • toLoggableString

        public String toLoggableString​(Object value,
                                       SessionFactoryImplementor factory)
        Description copied from interface: LoggableUserType
        Generate a loggable string representation of the collection (value).
        Specified by:
        toLoggableString in interface LoggableUserType
        Parameters:
        value - The collection to be logged; guaranteed to be non-null and initialized.
        factory - The factory.
        Returns:
        The loggable string representation.
      • isOrdinal

        public boolean isOrdinal()