Class JdbcTimestamps
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.JdbcTimestamps
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 Summary
ConstructorsModifierConstructorDescriptionprivateNot instantiable: a holder of stateless conversions. -
Method Summary
Modifier and TypeMethodDescriptionstatic InstantreadInstant(ResultSet rs, String column) Reads atimestamp with time zonecolumn that may be null.static OffsetDateTimetoTimestamp(Instant instant) Converts an instant to the value bound to atimestamp with time zonecolumn.
-
Constructor Details
-
JdbcTimestamps
private JdbcTimestamps()Not instantiable: a holder of stateless conversions.
-
-
Method Details
-
toTimestamp
Converts an instant to the value bound to atimestamp with time zonecolumn.- Parameters:
instant- the instant, ornull.- Returns:
- the equivalent UTC date time, or
null.
-
readInstant
Reads atimestamp with time zonecolumn that may be null.- Parameters:
rs- result set positioned on a row.column- name of the column.- Returns:
- the instant, or
nullwhen the column is null. - Throws:
SQLException- if the column cannot be read.
-