Package org.h2.util

Class JSR310Utils

java.lang.Object
org.h2.util.JSR310Utils

public class JSR310Utils extends Object
This utility class provides access to JSR 310 classes.
  • Field Details

  • Constructor Details

    • JSR310Utils

      private JSR310Utils()
  • Method Details

    • valueToLocalDate

      public static LocalDate valueToLocalDate(Value value, CastDataProvider provider)
      Converts a value to a LocalDate. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the LocalDate
    • valueToLocalTime

      public static LocalTime valueToLocalTime(Value value, CastDataProvider provider)
      Converts a value to a LocalTime. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the LocalTime
    • valueToLocalDateTime

      public static LocalDateTime valueToLocalDateTime(Value value, CastDataProvider provider)
      Converts a value to a LocalDateTime. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the LocalDateTime
    • valueToInstant

      public static Instant valueToInstant(Value value, CastDataProvider provider)
      Converts a value to a Instant. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the Instant
    • valueToOffsetDateTime

      public static OffsetDateTime valueToOffsetDateTime(Value value, CastDataProvider provider)
      Converts a value to a OffsetDateTime. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the OffsetDateTime
    • valueToZonedDateTime

      public static ZonedDateTime valueToZonedDateTime(Value value, CastDataProvider provider)
      Converts a value to a ZonedDateTime. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the ZonedDateTime
    • valueToOffsetTime

      public static OffsetTime valueToOffsetTime(Value value, CastDataProvider provider)
      Converts a value to a OffsetTime. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      provider - the cast information provider
      Returns:
      the OffsetTime
    • valueToPeriod

      public static Period valueToPeriod(Value value)
      Converts a value to a Period. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      Returns:
      the Period
    • valueToDuration

      public static Duration valueToDuration(Value value)
      Converts a value to a Duration. This method should only be called from Java 8 or later version.
      Parameters:
      value - the value to convert
      Returns:
      the Duration
    • localDateToValue

      public static ValueDate localDateToValue(LocalDate localDate)
      Converts a LocalDate to a Value.
      Parameters:
      localDate - the LocalDate to convert, not null
      Returns:
      the value
    • localTimeToValue

      public static ValueTime localTimeToValue(LocalTime localTime)
      Converts a LocalTime to a Value.
      Parameters:
      localTime - the LocalTime to convert, not null
      Returns:
      the value
    • localDateTimeToValue

      public static ValueTimestamp localDateTimeToValue(LocalDateTime localDateTime)
      Converts a LocalDateTime to a Value.
      Parameters:
      localDateTime - the LocalDateTime to convert, not null
      Returns:
      the value
    • instantToValue

      public static ValueTimestampTimeZone instantToValue(Instant instant)
      Converts a Instant to a Value.
      Parameters:
      instant - the Instant to convert, not null
      Returns:
      the value
    • offsetDateTimeToValue

      public static ValueTimestampTimeZone offsetDateTimeToValue(OffsetDateTime offsetDateTime)
      Converts a OffsetDateTime to a Value.
      Parameters:
      offsetDateTime - the OffsetDateTime to convert, not null
      Returns:
      the value
    • zonedDateTimeToValue

      public static ValueTimestampTimeZone zonedDateTimeToValue(ZonedDateTime zonedDateTime)
      Converts a ZonedDateTime to a Value.
      Parameters:
      zonedDateTime - the ZonedDateTime to convert, not null
      Returns:
      the value
    • offsetTimeToValue

      public static ValueTimeTimeZone offsetTimeToValue(OffsetTime offsetTime)
      Converts a OffsetTime to a Value.
      Parameters:
      offsetTime - the OffsetTime to convert, not null
      Returns:
      the value
    • localDateTimeFromDateNanos

      private static LocalDateTime localDateTimeFromDateNanos(long dateValue, long timeNanos)
    • periodToValue

      public static ValueInterval periodToValue(Period period)
      Converts a Period to a Value.
      Parameters:
      period - the Period to convert, not null
      Returns:
      the value
    • durationToValue

      public static ValueInterval durationToValue(Duration duration)
      Converts a Duration to a Value.
      Parameters:
      duration - the Duration to convert, not null
      Returns:
      the value