Class DurationColumnMapperFactory

java.lang.Object
org.jdbi.v3.postgres.DurationColumnMapperFactory
All Implemented Interfaces:
ColumnMapperFactory

public class DurationColumnMapperFactory extends Object implements ColumnMapperFactory
A column mapper which maps Postgres's PGInterval type to Java's Duration.

Not all PGIntervals are representable as Durations. E.g., one with months, which is an estimated ChronoUnit, or one whose seconds is larger than a long. An IllegalArgumentException will be thrown in either case.

  • Constructor Details

    • DurationColumnMapperFactory

      public DurationColumnMapperFactory()
  • Method Details

    • build

      public Optional<ColumnMapper<?>> build(Type type, ConfigRegistry config)
      Description copied from interface: ColumnMapperFactory
      Supplies a column mapper which will map columns to type if the factory supports it; empty otherwise.
      Specified by:
      build in interface ColumnMapperFactory
      Parameters:
      type - the target type to map to
      config - the config registry, for composition
      Returns:
      a column mapper for the given type if this factory supports it, or Optional.empty() otherwise.
      See Also: