Interface Range<A>

Type Parameters:
A - the element type of the range
All Known Implementing Classes:
Range.Bounded, Range.Empty

public sealed interface Range<A> permits Range.Empty<A>, Range.Bounded<A>
PostgreSQL range type. Represents a range of values of type A in the canonical [lower, upper) form (inclusive lower, exclusive upper).

A range can be:

  • Empty — no values are in the range
  • Bounded — with an optional lower and/or upper bound. A null lower bound means negative infinity; a null upper bound means positive infinity.

The standard PostgreSQL range types are:

  • int4rangeRange<Integer>
  • int8rangeRange<Long>
  • numrangeRange<java.math.BigDecimal>
  • tsrangeRange<java.time.LocalDateTime>
  • tstzrangeRange<java.time.Instant>
  • daterangeRange<java.time.LocalDate>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A bounded range.
    static final record 
    An empty range containing no values.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static <A> Range<A>
    bounded(A lower, A upper)
    Creates a bounded range with the given lower and upper bounds.
    static <A> Range<A>
    Creates an empty range.
    static <A> Range<A>
    Creates an unbounded range (from negative infinity to positive infinity).
  • Method Details

    • empty

      static <A> Range<A> empty()
      Creates an empty range.
    • bounded

      static <A> Range<A> bounded(A lower, A upper)
      Creates a bounded range with the given lower and upper bounds.
    • unbounded

      static <A> Range<A> unbounded()
      Creates an unbounded range (from negative infinity to positive infinity).