java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.JdbcTimestamps

public final class JdbcTimestamps extends Object
Converts between the domain's Instant and the OffsetDateTime the PostgreSQL driver binds to and reads from a timestamp with time zone column. Shared by every JDBC adapter of this module, so they all store UTC values the same way.
  • Constructor Details

    • JdbcTimestamps

      private JdbcTimestamps()
      Not instantiable: a holder of stateless conversions.
  • Method Details

    • toTimestamp

      public static OffsetDateTime toTimestamp(Instant instant)
      Converts an instant to the value bound to a timestamp with time zone column.
      Parameters:
      instant - the instant, or null.
      Returns:
      the equivalent UTC date time, or null.
    • readInstant

      public static Instant readInstant(ResultSet rs, String column) throws SQLException
      Reads a timestamp with time zone column that may be null.
      Parameters:
      rs - result set positioned on a row.
      column - name of the column.
      Returns:
      the instant, or null when the column is null.
      Throws:
      SQLException - if the column cannot be read.