Module org.jooq
Package org.jooq.impl

Class EnumConverter<T,​U extends Enum<U>>

java.lang.Object
org.jooq.impl.AbstractConverter<T,​U>
org.jooq.impl.EnumConverter<T,​U>
All Implemented Interfaces:
Serializable, Converter<T,​U>

public class EnumConverter<T,​U extends Enum<U>> extends AbstractConverter<T,​U>
A base class for enum conversion.
Author:
Lukas Eder
See Also:
Serialized Form
  • Constructor Details

    • EnumConverter

      public EnumConverter(Class<T> fromType, Class<U> toType)
    • EnumConverter

      public EnumConverter(Class<T> fromType, Class<U> toType, Function<? super U,​? extends T> to)
  • Method Details

    • from

      public final U from(T databaseObject)
      Description copied from interface: Converter
      Read and convert a database object to a user object.
      Parameters:
      databaseObject - The database object.
      Returns:
      The user object.
    • to

      public T to(U userObject)
      Subclasses may override this method to provide a custom reverse mapping implementation

      Convert and write a user object to a database object.

      Parameters:
      userObject - The user object.
      Returns:
      The database object.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractConverter<T,​U extends Enum<U>>