Package org.h2.util

Class JSR310Utils


  • public class JSR310Utils
    extends java.lang.Object
    This utility class provides access to JSR 310 classes.
    • Constructor Detail

      • JSR310Utils

        private JSR310Utils()
    • Method Detail

      • valueToLocalDate

        public static java.time.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 java.time.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 java.time.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 java.time.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 java.time.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 java.time.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 java.time.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 java.time.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 java.time.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​(java.time.LocalDate localDate)
        Converts a LocalDate to a Value.
        Parameters:
        localDate - the LocalDate to convert, not null
        Returns:
        the value
      • localTimeToValue

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

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

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

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

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

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

        private static java.time.LocalDateTime localDateTimeFromDateNanos​(long dateValue,
                                                                          long timeNanos)
      • periodToValue

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

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