Class TypedEnumArgumentFactory

java.lang.Object
org.jdbi.v3.core.argument.AbstractArgumentFactory<Enum>
org.jdbi.v3.postgres.TypedEnumArgumentFactory
All Implemented Interfaces:
ArgumentFactory, ArgumentFactory.Preparable

public class TypedEnumArgumentFactory extends AbstractArgumentFactory<Enum>
Default jdbi behavior is to bind Enum subclasses as a string, which Postgres won't implicitly convert to an enum type. If instead you bind it as java.sql.Types.OTHER, Postgres will autodetect the enum correctly.
  • Constructor Details

    • TypedEnumArgumentFactory

      public TypedEnumArgumentFactory()
  • Method Details

    • build

      protected Argument build(Enum value, ConfigRegistry config)
      Description copied from class: AbstractArgumentFactory
      Produce an argument object for the given value. When the implementation class has accepted a given type, it must then produce an argument instance or throw an exception.
      Specified by:
      build in class AbstractArgumentFactory<Enum>
      Parameters:
      value - the value to convert to an argument
      config - the config registry
      Returns:
      An Argument for the given value. Must not be null!