Package org.h2.util
Class JSR310Utils
- java.lang.Object
-
- org.h2.util.JSR310Utils
-
public class JSR310Utils extends java.lang.ObjectThis utility class provides access to JSR 310 classes.
-
-
Field Summary
Fields Modifier and Type Field Description private static longMAX_DATE_VALUEprivate static longMAX_INSTANT_SECONDprivate static longMIN_DATE_VALUEprivate static longMIN_INSTANT_SECOND
-
Constructor Summary
Constructors Modifier Constructor Description privateJSR310Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ValueIntervaldurationToValue(java.time.Duration duration)Converts a Duration to a Value.static ValueTimestampTimeZoneinstantToValue(java.time.Instant instant)Converts a Instant to a Value.private static java.time.LocalDateTimelocalDateTimeFromDateNanos(long dateValue, long timeNanos)static ValueTimestamplocalDateTimeToValue(java.time.LocalDateTime localDateTime)Converts a LocalDateTime to a Value.static ValueDatelocalDateToValue(java.time.LocalDate localDate)Converts a LocalDate to a Value.static ValueTimelocalTimeToValue(java.time.LocalTime localTime)Converts a LocalTime to a Value.static ValueTimestampTimeZoneoffsetDateTimeToValue(java.time.OffsetDateTime offsetDateTime)Converts a OffsetDateTime to a Value.static ValueTimeTimeZoneoffsetTimeToValue(java.time.OffsetTime offsetTime)Converts a OffsetTime to a Value.static ValueIntervalperiodToValue(java.time.Period period)Converts a Period to a Value.static java.time.DurationvalueToDuration(Value value)Converts a value to a Duration.static java.time.InstantvalueToInstant(Value value, CastDataProvider provider)Converts a value to a Instant.static java.time.LocalDatevalueToLocalDate(Value value, CastDataProvider provider)Converts a value to a LocalDate.static java.time.LocalDateTimevalueToLocalDateTime(Value value, CastDataProvider provider)Converts a value to a LocalDateTime.static java.time.LocalTimevalueToLocalTime(Value value, CastDataProvider provider)Converts a value to a LocalTime.static java.time.OffsetDateTimevalueToOffsetDateTime(Value value, CastDataProvider provider)Converts a value to a OffsetDateTime.static java.time.OffsetTimevalueToOffsetTime(Value value, CastDataProvider provider)Converts a value to a OffsetTime.static java.time.PeriodvalueToPeriod(Value value)Converts a value to a Period.static java.time.ZonedDateTimevalueToZonedDateTime(Value value, CastDataProvider provider)Converts a value to a ZonedDateTime.static ValueTimestampTimeZonezonedDateTimeToValue(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
-
-