Package org.h2.util
Class JSR310Utils
- java.lang.Object
-
- org.h2.util.JSR310Utils
-
public class JSR310Utils extends java.lang.Object
This utility class provides access to JSR 310 classes.
-
-
Field Summary
Fields Modifier and Type Field Description private static long
MAX_DATE_VALUE
private static long
MAX_INSTANT_SECOND
private static long
MIN_DATE_VALUE
private static long
MIN_INSTANT_SECOND
-
Constructor Summary
Constructors Modifier Constructor Description private
JSR310Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ValueInterval
durationToValue(java.time.Duration duration)
Converts a Duration to a Value.static ValueTimestampTimeZone
instantToValue(java.time.Instant instant)
Converts a Instant to a Value.private static java.time.LocalDateTime
localDateTimeFromDateNanos(long dateValue, long timeNanos)
static ValueTimestamp
localDateTimeToValue(java.time.LocalDateTime localDateTime)
Converts a LocalDateTime to a Value.static ValueDate
localDateToValue(java.time.LocalDate localDate)
Converts a LocalDate to a Value.static ValueTime
localTimeToValue(java.time.LocalTime localTime)
Converts a LocalTime to a Value.static ValueTimestampTimeZone
offsetDateTimeToValue(java.time.OffsetDateTime offsetDateTime)
Converts a OffsetDateTime to a Value.static ValueTimeTimeZone
offsetTimeToValue(java.time.OffsetTime offsetTime)
Converts a OffsetTime to a Value.static ValueInterval
periodToValue(java.time.Period period)
Converts a Period to a Value.static java.time.Duration
valueToDuration(Value value)
Converts a value to a Duration.static java.time.Instant
valueToInstant(Value value, CastDataProvider provider)
Converts a value to a Instant.static java.time.LocalDate
valueToLocalDate(Value value, CastDataProvider provider)
Converts a value to a LocalDate.static java.time.LocalDateTime
valueToLocalDateTime(Value value, CastDataProvider provider)
Converts a value to a LocalDateTime.static java.time.LocalTime
valueToLocalTime(Value value, CastDataProvider provider)
Converts a value to a LocalTime.static java.time.OffsetDateTime
valueToOffsetDateTime(Value value, CastDataProvider provider)
Converts a value to a OffsetDateTime.static java.time.OffsetTime
valueToOffsetTime(Value value, CastDataProvider provider)
Converts a value to a OffsetTime.static java.time.Period
valueToPeriod(Value value)
Converts a value to a Period.static java.time.ZonedDateTime
valueToZonedDateTime(Value value, CastDataProvider provider)
Converts a value to a ZonedDateTime.static ValueTimestampTimeZone
zonedDateTimeToValue(java.time.ZonedDateTime zonedDateTime)
Converts a ZonedDateTime to a Value.
-
-
-
Field Detail
-
MIN_DATE_VALUE
private static final long MIN_DATE_VALUE
- See Also:
- Constant Field Values
-
MAX_DATE_VALUE
private static final long MAX_DATE_VALUE
- See Also:
- Constant Field Values
-
MIN_INSTANT_SECOND
private static final long MIN_INSTANT_SECOND
- See Also:
- Constant Field Values
-
MAX_INSTANT_SECOND
private static final long MAX_INSTANT_SECOND
- See Also:
- Constant Field Values
-
-
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 convertprovider
- 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 convertprovider
- 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 convertprovider
- 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 convertprovider
- 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 convertprovider
- 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 convertprovider
- 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 convertprovider
- 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, notnull
- Returns:
- the value
-
localTimeToValue
public static ValueTime localTimeToValue(java.time.LocalTime localTime)
Converts a LocalTime to a Value.- Parameters:
localTime
- the LocalTime to convert, notnull
- Returns:
- the value
-
localDateTimeToValue
public static ValueTimestamp localDateTimeToValue(java.time.LocalDateTime localDateTime)
Converts a LocalDateTime to a Value.- Parameters:
localDateTime
- the LocalDateTime to convert, notnull
- Returns:
- the value
-
instantToValue
public static ValueTimestampTimeZone instantToValue(java.time.Instant instant)
Converts a Instant to a Value.- Parameters:
instant
- the Instant to convert, notnull
- Returns:
- the value
-
offsetDateTimeToValue
public static ValueTimestampTimeZone offsetDateTimeToValue(java.time.OffsetDateTime offsetDateTime)
Converts a OffsetDateTime to a Value.- Parameters:
offsetDateTime
- the OffsetDateTime to convert, notnull
- Returns:
- the value
-
zonedDateTimeToValue
public static ValueTimestampTimeZone zonedDateTimeToValue(java.time.ZonedDateTime zonedDateTime)
Converts a ZonedDateTime to a Value.- Parameters:
zonedDateTime
- the ZonedDateTime to convert, notnull
- Returns:
- the value
-
offsetTimeToValue
public static ValueTimeTimeZone offsetTimeToValue(java.time.OffsetTime offsetTime)
Converts a OffsetTime to a Value.- Parameters:
offsetTime
- the OffsetTime to convert, notnull
- 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, notnull
- Returns:
- the value
-
durationToValue
public static ValueInterval durationToValue(java.time.Duration duration)
Converts a Duration to a Value.- Parameters:
duration
- the Duration to convert, notnull
- Returns:
- the value
-
-