11package org.jetbrains.kotlinx.dataframe.impl.api
22
3+ import kotlinx.datetime.Instant
34import kotlinx.datetime.LocalDate
45import kotlinx.datetime.LocalDateTime
56import kotlinx.datetime.LocalTime
67import kotlinx.datetime.TimeZone
78import kotlinx.datetime.atStartOfDayIn
89import kotlinx.datetime.atTime
9- import kotlinx.datetime.toDeprecatedInstant
1010import kotlinx.datetime.toInstant
11+ import kotlinx.datetime.toJavaInstant
1112import kotlinx.datetime.toJavaLocalDate
1213import kotlinx.datetime.toJavaLocalDateTime
1314import kotlinx.datetime.toJavaLocalTime
15+ import kotlinx.datetime.toKotlinInstant
1416import kotlinx.datetime.toKotlinLocalDate
1517import kotlinx.datetime.toKotlinLocalDateTime
1618import kotlinx.datetime.toKotlinLocalTime
1719import kotlinx.datetime.toLocalDateTime
18- import kotlinx.datetime.toStdlibInstant
1920import org.jetbrains.kotlinx.dataframe.AnyCol
2021import org.jetbrains.kotlinx.dataframe.DataColumn
2122import org.jetbrains.kotlinx.dataframe.DataFrame
@@ -56,17 +57,13 @@ import kotlin.reflect.full.withNullability
5657import kotlin.reflect.jvm.jvmErasure
5758import kotlin.reflect.typeOf
5859import kotlin.text.trim
59- import kotlin.time.Instant
60- import kotlin.time.toJavaInstant
61- import kotlin.time.toKotlinInstant
6260import kotlin.toBigDecimal
6361import java.time.Instant as JavaInstant
6462import java.time.LocalDate as JavaLocalDate
6563import java.time.LocalDateTime as JavaLocalDateTime
6664import java.time.LocalTime as JavaLocalTime
6765import kotlin.toBigDecimal as toBigDecimalKotlin
6866import kotlin.toBigInteger as toBigIntegerKotlin
69- import kotlinx.datetime.Instant as DeprecatedInstant
7067
7168@PublishedApi
7269internal fun <T , C , R > Convert <T , C >.withRowCellImpl (
@@ -401,9 +398,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
401398
402399 Instant ::class -> convert<Int > { Instant .fromEpochMilliseconds(it.toLong()) }
403400
404- // #1350
405- DeprecatedInstant ::class -> convert<Int > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
406-
407401 JavaLocalDateTime ::class -> convert<Int > {
408402 it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
409403 }
@@ -442,9 +436,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
442436
443437 Instant ::class -> convert<Byte > { Instant .fromEpochMilliseconds(it.toLong()) }
444438
445- // #1350
446- DeprecatedInstant ::class -> convert<Byte > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
447-
448439 JavaLocalDateTime ::class -> convert<Byte > {
449440 it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
450441 }
@@ -483,9 +474,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
483474
484475 Instant ::class -> convert<Short > { Instant .fromEpochMilliseconds(it.toLong()) }
485476
486- // #1350
487- DeprecatedInstant ::class -> convert<Short > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
488-
489477 JavaLocalDateTime ::class -> convert<Short > {
490478 it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
491479 }
@@ -536,9 +524,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
536524
537525 Instant ::class -> convert<Long > { Instant .fromEpochMilliseconds(it) }
538526
539- // #1350
540- DeprecatedInstant ::class -> convert<Long > { DeprecatedInstant .fromEpochMilliseconds(it) }
541-
542527 JavaLocalDateTime ::class -> convert<Long > {
543528 it.toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
544529 }
@@ -571,40 +556,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
571556
572557 JavaLocalTime ::class -> convert<Instant > { it.toLocalTime(defaultTimeZone).toJavaLocalTime() }
573558
574- // #1350
575- DeprecatedInstant ::class -> convert<Instant > { it.toDeprecatedInstant() }
576-
577- else -> null
578- }
579-
580- // #1350
581- DeprecatedInstant ::class -> when (toClass) {
582- Long ::class -> convert<DeprecatedInstant > { it.toStdlibInstant().toEpochMilliseconds() }
583-
584- LocalDateTime ::class -> convert<DeprecatedInstant > {
585- it.toStdlibInstant().toLocalDateTime(defaultTimeZone)
586- }
587-
588- LocalDate ::class -> convert<DeprecatedInstant > { it.toStdlibInstant().toLocalDate(defaultTimeZone) }
589-
590- LocalTime ::class -> convert<DeprecatedInstant > { it.toStdlibInstant().toLocalTime(defaultTimeZone) }
591-
592- JavaLocalDateTime ::class -> convert<DeprecatedInstant > {
593- it.toStdlibInstant().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
594- }
595-
596- JavaLocalDate ::class -> convert<DeprecatedInstant > {
597- it.toStdlibInstant().toLocalDate(defaultTimeZone).toJavaLocalDate()
598- }
599-
600- JavaInstant ::class -> convert<DeprecatedInstant > { it.toStdlibInstant().toJavaInstant() }
601-
602- JavaLocalTime ::class -> convert<DeprecatedInstant > {
603- it.toStdlibInstant().toLocalTime(defaultTimeZone).toJavaLocalTime()
604- }
605-
606- Instant ::class -> convert<DeprecatedInstant > { it.toStdlibInstant() }
607-
608559 else -> null
609560 }
610561
@@ -633,11 +584,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
633584 it.toKotlinInstant().toLocalTime(defaultTimeZone).toJavaLocalTime()
634585 }
635586
636- // #1350
637- DeprecatedInstant ::class -> convert<JavaInstant > {
638- it.toKotlinInstant().toDeprecatedInstant()
639- }
640-
641587 else -> null
642588 }
643589
@@ -679,26 +625,13 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
679625
680626 LocalDateTime ::class -> when (toClass) {
681627 LocalDate ::class -> convert<LocalDateTime > { it.date }
682-
683628 LocalTime ::class -> convert<LocalDateTime > { it.time }
684-
685629 Instant ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone) }
686-
687- // #1350
688- DeprecatedInstant ::class -> convert<LocalDateTime > {
689- it.toInstant(defaultTimeZone).toDeprecatedInstant()
690- }
691-
692630 Long ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone).toEpochMilliseconds() }
693-
694631 JavaLocalDateTime ::class -> convert<LocalDateTime > { it.toJavaLocalDateTime() }
695-
696632 JavaLocalDate ::class -> convert<LocalDateTime > { it.date.toJavaLocalDate() }
697-
698633 JavaLocalTime ::class -> convert<LocalDateTime > { it.toJavaLocalDateTime().toLocalTime() }
699-
700634 JavaInstant ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone).toJavaInstant() }
701-
702635 else -> null
703636 }
704637
@@ -713,11 +646,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
713646 it.toKotlinLocalDateTime().toInstant(defaultTimeZone)
714647 }
715648
716- // #1350
717- DeprecatedInstant ::class -> convert<JavaLocalDateTime > {
718- it.toKotlinLocalDateTime().toInstant(defaultTimeZone).toDeprecatedInstant()
719- }
720-
721649 Long ::class -> convert<JavaLocalDateTime > {
722650 it.toKotlinLocalDateTime().toInstant(defaultTimeZone).toEpochMilliseconds()
723651 }
@@ -735,22 +663,11 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
735663
736664 LocalDate ::class -> when (toClass) {
737665 LocalDateTime ::class -> convert<LocalDate > { it.atTime(0 , 0 ) }
738-
739666 Instant ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone) }
740-
741- // #1350
742- DeprecatedInstant ::class -> convert<LocalDate > {
743- it.atStartOfDayIn(defaultTimeZone).toDeprecatedInstant()
744- }
745-
746667 Long ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone).toEpochMilliseconds() }
747-
748668 JavaLocalDate ::class -> convert<LocalDate > { it.toJavaLocalDate() }
749-
750669 JavaLocalDateTime ::class -> convert<LocalDate > { it.atTime(0 , 0 ).toJavaLocalDateTime() }
751-
752670 JavaInstant ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone).toJavaInstant() }
753-
754671 else -> null
755672 }
756673
@@ -763,11 +680,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
763680 it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone)
764681 }
765682
766- // #1350
767- DeprecatedInstant ::class -> convert<JavaLocalDate > {
768- it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone).toDeprecatedInstant()
769- }
770-
771683 Long ::class -> convert<JavaLocalDate > {
772684 it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone).toEpochMilliseconds()
773685 }
0 commit comments