Class Datetime.Date.AsLocalDate

java.lang.Object
org.postgresql.pljava.adt.Datetime.Date.AsLocalDate
All Implemented Interfaces:
Adapter.Contract<LocalDate>, Adapter.Contract.Scalar<LocalDate>, Datetime.Date<LocalDate>
Enclosing interface:
Datetime.Date<T>

public static class Datetime.Date.AsLocalDate extends Object implements Datetime.Date<LocalDate>
A reference implementation that maps to LocalDate.

The PostgreSQL "-infinity" and "+infinity" values are mapped to LocalDate instances matching (by equals) the special instances NOBEGIN and NOEND here, respectively.

  • Field Details

    • INSTANCE

      public static final Datetime.Date.AsLocalDate INSTANCE
    • NOBEGIN

      public static final LocalDate NOBEGIN
      LocalDate representing PostgreSQL's "infinitely early" date.
    • NOEND

      public static final LocalDate NOEND
      LocalDate representing PostgreSQL's "infinitely late" date.
  • Method Details

    • construct

      public LocalDate construct(int daysSincePostgresEpoch)
      Description copied from interface: Datetime.Date
      Constructs a representation T from the components of the PostgreSQL data type.

      The argument represents days since POSTGRES_EPOCH, unless it is one of the special values DATEVAL_NOBEGIN or DATEVAL_NOEND.

      When constructing a representation that lacks notions of positive or negative "infinity", one option is to simply map the above special values no differently than ordinary ones, and remember the two resulting representations as the "infinite" ones. If that is done without wraparound, the resulting "-infinity" value will precede all other PostgreSQL-representable dates and the resulting "+infinity" will follow them.

      The older java.util.Date cannot represent those values without wraparound; the two resulting values can still be saved as representing -infinity and +infinity, but will not have the expected ordering with respect to other values. They will both be quite far from the present.

      Specified by:
      construct in interface Datetime.Date<LocalDate>
    • store

      public <T> T store(LocalDate d, Datetime.Date<T> f) throws SQLException
      Throws:
      SQLException