1
1
package org.jetbrains.kotlinx.dataframe.impl.api
2
2
3
+ import kotlinx.datetime.Instant
3
4
import kotlinx.datetime.LocalDate
4
5
import kotlinx.datetime.LocalDateTime
5
6
import kotlinx.datetime.LocalTime
6
7
import kotlinx.datetime.TimeZone
7
8
import kotlinx.datetime.atStartOfDayIn
8
9
import kotlinx.datetime.atTime
9
- import kotlinx.datetime.toDeprecatedInstant
10
10
import kotlinx.datetime.toInstant
11
+ import kotlinx.datetime.toJavaInstant
11
12
import kotlinx.datetime.toJavaLocalDate
12
13
import kotlinx.datetime.toJavaLocalDateTime
13
14
import kotlinx.datetime.toJavaLocalTime
15
+ import kotlinx.datetime.toKotlinInstant
14
16
import kotlinx.datetime.toKotlinLocalDate
15
17
import kotlinx.datetime.toKotlinLocalDateTime
16
18
import kotlinx.datetime.toKotlinLocalTime
17
19
import kotlinx.datetime.toLocalDateTime
18
- import kotlinx.datetime.toStdlibInstant
19
20
import org.jetbrains.kotlinx.dataframe.AnyCol
20
21
import org.jetbrains.kotlinx.dataframe.DataColumn
21
22
import org.jetbrains.kotlinx.dataframe.DataFrame
@@ -56,17 +57,13 @@ import kotlin.reflect.full.withNullability
56
57
import kotlin.reflect.jvm.jvmErasure
57
58
import kotlin.reflect.typeOf
58
59
import kotlin.text.trim
59
- import kotlin.time.Instant
60
- import kotlin.time.toJavaInstant
61
- import kotlin.time.toKotlinInstant
62
60
import kotlin.toBigDecimal
63
61
import java.time.Instant as JavaInstant
64
62
import java.time.LocalDate as JavaLocalDate
65
63
import java.time.LocalDateTime as JavaLocalDateTime
66
64
import java.time.LocalTime as JavaLocalTime
67
65
import kotlin.toBigDecimal as toBigDecimalKotlin
68
66
import kotlin.toBigInteger as toBigIntegerKotlin
69
- import kotlinx.datetime.Instant as DeprecatedInstant
70
67
71
68
@PublishedApi
72
69
internal fun <T , C , R > Convert <T , C >.withRowCellImpl (
@@ -401,9 +398,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
401
398
402
399
Instant ::class -> convert<Int > { Instant .fromEpochMilliseconds(it.toLong()) }
403
400
404
- // #1350
405
- DeprecatedInstant ::class -> convert<Int > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
406
-
407
401
JavaLocalDateTime ::class -> convert<Int > {
408
402
it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
409
403
}
@@ -442,9 +436,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
442
436
443
437
Instant ::class -> convert<Byte > { Instant .fromEpochMilliseconds(it.toLong()) }
444
438
445
- // #1350
446
- DeprecatedInstant ::class -> convert<Byte > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
447
-
448
439
JavaLocalDateTime ::class -> convert<Byte > {
449
440
it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
450
441
}
@@ -483,9 +474,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
483
474
484
475
Instant ::class -> convert<Short > { Instant .fromEpochMilliseconds(it.toLong()) }
485
476
486
- // #1350
487
- DeprecatedInstant ::class -> convert<Short > { DeprecatedInstant .fromEpochMilliseconds(it.toLong()) }
488
-
489
477
JavaLocalDateTime ::class -> convert<Short > {
490
478
it.toLong().toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
491
479
}
@@ -536,9 +524,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
536
524
537
525
Instant ::class -> convert<Long > { Instant .fromEpochMilliseconds(it) }
538
526
539
- // #1350
540
- DeprecatedInstant ::class -> convert<Long > { DeprecatedInstant .fromEpochMilliseconds(it) }
541
-
542
527
JavaLocalDateTime ::class -> convert<Long > {
543
528
it.toLocalDateTime(defaultTimeZone).toJavaLocalDateTime()
544
529
}
@@ -571,40 +556,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
571
556
572
557
JavaLocalTime ::class -> convert<Instant > { it.toLocalTime(defaultTimeZone).toJavaLocalTime() }
573
558
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
-
608
559
else -> null
609
560
}
610
561
@@ -633,11 +584,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
633
584
it.toKotlinInstant().toLocalTime(defaultTimeZone).toJavaLocalTime()
634
585
}
635
586
636
- // #1350
637
- DeprecatedInstant ::class -> convert<JavaInstant > {
638
- it.toKotlinInstant().toDeprecatedInstant()
639
- }
640
-
641
587
else -> null
642
588
}
643
589
@@ -679,26 +625,13 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
679
625
680
626
LocalDateTime ::class -> when (toClass) {
681
627
LocalDate ::class -> convert<LocalDateTime > { it.date }
682
-
683
628
LocalTime ::class -> convert<LocalDateTime > { it.time }
684
-
685
629
Instant ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone) }
686
-
687
- // #1350
688
- DeprecatedInstant ::class -> convert<LocalDateTime > {
689
- it.toInstant(defaultTimeZone).toDeprecatedInstant()
690
- }
691
-
692
630
Long ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone).toEpochMilliseconds() }
693
-
694
631
JavaLocalDateTime ::class -> convert<LocalDateTime > { it.toJavaLocalDateTime() }
695
-
696
632
JavaLocalDate ::class -> convert<LocalDateTime > { it.date.toJavaLocalDate() }
697
-
698
633
JavaLocalTime ::class -> convert<LocalDateTime > { it.toJavaLocalDateTime().toLocalTime() }
699
-
700
634
JavaInstant ::class -> convert<LocalDateTime > { it.toInstant(defaultTimeZone).toJavaInstant() }
701
-
702
635
else -> null
703
636
}
704
637
@@ -713,11 +646,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
713
646
it.toKotlinLocalDateTime().toInstant(defaultTimeZone)
714
647
}
715
648
716
- // #1350
717
- DeprecatedInstant ::class -> convert<JavaLocalDateTime > {
718
- it.toKotlinLocalDateTime().toInstant(defaultTimeZone).toDeprecatedInstant()
719
- }
720
-
721
649
Long ::class -> convert<JavaLocalDateTime > {
722
650
it.toKotlinLocalDateTime().toInstant(defaultTimeZone).toEpochMilliseconds()
723
651
}
@@ -735,22 +663,11 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
735
663
736
664
LocalDate ::class -> when (toClass) {
737
665
LocalDateTime ::class -> convert<LocalDate > { it.atTime(0 , 0 ) }
738
-
739
666
Instant ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone) }
740
-
741
- // #1350
742
- DeprecatedInstant ::class -> convert<LocalDate > {
743
- it.atStartOfDayIn(defaultTimeZone).toDeprecatedInstant()
744
- }
745
-
746
667
Long ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone).toEpochMilliseconds() }
747
-
748
668
JavaLocalDate ::class -> convert<LocalDate > { it.toJavaLocalDate() }
749
-
750
669
JavaLocalDateTime ::class -> convert<LocalDate > { it.atTime(0 , 0 ).toJavaLocalDateTime() }
751
-
752
670
JavaInstant ::class -> convert<LocalDate > { it.atStartOfDayIn(defaultTimeZone).toJavaInstant() }
753
-
754
671
else -> null
755
672
}
756
673
@@ -763,11 +680,6 @@ internal fun createConverter(from: KType, to: KType, options: ParserOptions? = n
763
680
it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone)
764
681
}
765
682
766
- // #1350
767
- DeprecatedInstant ::class -> convert<JavaLocalDate > {
768
- it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone).toDeprecatedInstant()
769
- }
770
-
771
683
Long ::class -> convert<JavaLocalDate > {
772
684
it.toKotlinLocalDate().atStartOfDayIn(defaultTimeZone).toEpochMilliseconds()
773
685
}
0 commit comments