@@ -17,6 +17,7 @@ import org.jetbrains.kotlinx.dataframe.DataRow
17
17
import org.jetbrains.kotlinx.dataframe.RowColumnExpression
18
18
import org.jetbrains.kotlinx.dataframe.RowValueExpression
19
19
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
20
+ import org.jetbrains.kotlinx.dataframe.annotations.Converter
20
21
import org.jetbrains.kotlinx.dataframe.annotations.HasSchema
21
22
import org.jetbrains.kotlinx.dataframe.annotations.Interpretable
22
23
import org.jetbrains.kotlinx.dataframe.annotations.Refine
@@ -295,13 +296,38 @@ public fun <T : Any> DataColumn<T?>.convertToBoolean(): DataColumn<Boolean?> = c
295
296
296
297
// region convert URL
297
298
298
- public fun <T , R : URL ?> Convert <T , R >.toIFrame (
299
+ @JvmName(" toIframeFromUrlNullable" )
300
+ @Refine
301
+ @Converter(IFRAME ::class , nullable = true )
302
+ @Interpretable(" ToSpecificType" )
303
+ public fun <T > Convert <T , URL ?>.toIFrame (
304
+ border : Boolean = false,
305
+ width : Int? = null,
306
+ height : Int? = null,
307
+ ): DataFrame <T > = to { it.map { url -> url?.let { IFRAME (url.toString(), border, width, height) } } }
308
+
309
+ @JvmName(" toIframeFromUrl" )
310
+ @Refine
311
+ @Converter(IFRAME ::class , nullable = false )
312
+ @Interpretable(" ToSpecificType" )
313
+ public fun <T > Convert <T , URL >.toIFrame (
299
314
border : Boolean = false,
300
315
width : Int? = null,
301
316
height : Int? = null,
302
317
): DataFrame <T > = to { it.map { IFRAME (it.toString(), border, width, height) } }
303
318
304
- public fun <T , R : URL ?> Convert <T , R >.toImg (width : Int? = null, height : Int? = null): DataFrame <T > =
319
+ @JvmName(" toImgFromUrlNullable" )
320
+ @Refine
321
+ @Converter(IMG ::class , nullable = true )
322
+ @Interpretable(" ToSpecificType" )
323
+ public fun <T , R : URL ?> Convert <T , URL ?>.toImg (width : Int? = null, height : Int? = null): DataFrame <T > =
324
+ to { it.map { url -> url?.let { IMG (url.toString(), width, height) } } }
325
+
326
+ @JvmName(" toImgFromUrl" )
327
+ @Refine
328
+ @Converter(IMG ::class , nullable = false )
329
+ @Interpretable(" ToSpecificType" )
330
+ public fun <T , R : URL ?> Convert <T , URL >.toImg (width : Int? = null, height : Int? = null): DataFrame <T > =
305
331
to { it.map { IMG (it.toString(), width, height) } }
306
332
307
333
// endregion
@@ -313,7 +339,17 @@ public fun DataColumn<String>.convertToURL(): DataColumn<URL> = map { URL(it) }
313
339
@JvmName(" convertToURLFromStringNullable" )
314
340
public fun DataColumn<String?>.convertToURL (): DataColumn <URL ?> = map { it?.let { URL (it) } }
315
341
316
- public fun <T , R : String ?> Convert <T , R >.toURL (): DataFrame <T > = to { it.convertToURL() }
342
+ @JvmName(" toUrlFromStringNullable" )
343
+ @Refine
344
+ @Converter(URL ::class , nullable = true )
345
+ @Interpretable(" ToSpecificType" )
346
+ public fun <T > Convert <T , String ?>.toURL (): DataFrame <T > = to { it.convertToURL() }
347
+
348
+ @JvmName(" toUrlFromString" )
349
+ @Refine
350
+ @Converter(URL ::class , nullable = false )
351
+ @Interpretable(" ToSpecificType" )
352
+ public fun <T > Convert <T , String >.toURL (): DataFrame <T > = to { it.convertToURL() }
317
353
318
354
// endregion
319
355
@@ -324,7 +360,17 @@ public fun DataColumn<String>.convertToInstant(): DataColumn<Instant> = map { In
324
360
@JvmName(" convertToInstantFromStringNullable" )
325
361
public fun DataColumn<String?>.convertToInstant (): DataColumn <Instant ?> = map { it?.let { Instant .parse(it) } }
326
362
327
- public fun <T , R : String ?> Convert <T , R >.toInstant (): DataFrame <T > = to { it.convertToInstant() }
363
+ @JvmName(" toInstantFromStringNullable" )
364
+ @Refine
365
+ @Converter(Instant ::class , nullable = true )
366
+ @Interpretable(" ToSpecificType" )
367
+ public fun <T > Convert <T , String ?>.toInstant (): DataFrame <T > = to { it.convertToInstant() }
368
+
369
+ @JvmName(" toInstantFromString" )
370
+ @Refine
371
+ @Converter(Instant ::class , nullable = false )
372
+ @Interpretable(" ToSpecificType" )
373
+ public fun <T > Convert <T , String >.toInstant (): DataFrame <T > = to { it.convertToInstant() }
328
374
329
375
// endregion
330
376
@@ -363,17 +409,51 @@ public fun DataColumn<String?>.convertToLocalDate(
363
409
return map { it?.let { converter(it.trim()) ? : error(" Can't convert `$it ` to LocalDate" ) } }
364
410
}
365
411
412
+ @JvmName(" toLocalDateFromTLongNullable" )
413
+ @Refine
414
+ @Converter(LocalDate ::class , nullable = true )
415
+ @Interpretable(" ToSpecificTypeZone" )
416
+ public fun <T > Convert <T , Long ?>.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
417
+ to { it.convertToLocalDate(zone) }
418
+
366
419
@JvmName(" toLocalDateFromTLong" )
367
- public fun <T , R : Long ?> Convert <T , R >.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
420
+ @Refine
421
+ @Converter(LocalDate ::class , nullable = false )
422
+ @Interpretable(" ToSpecificTypeZone" )
423
+ public fun <T > Convert <T , Long >.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
368
424
to { it.convertToLocalDate(zone) }
369
425
370
426
@JvmName(" toLocalDateFromTInt" )
371
- public fun <T , R : Int ?> Convert <T , R >.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
427
+ @Refine
428
+ @Converter(LocalDate ::class , nullable = true )
429
+ @Interpretable(" ToSpecificTypeZone" )
430
+ public fun <T > Convert <T , Int ?>.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
372
431
to { it.convertToLocalDate(zone) }
373
432
374
- public fun <T , R : String ?> Convert <T , R >.toLocalDate (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
433
+ @JvmName(" toLocalDateFromTIntNullable" )
434
+ @Refine
435
+ @Converter(LocalDate ::class , nullable = false )
436
+ @Interpretable(" ToSpecificTypeZone" )
437
+ public fun <T > Convert <T , Int >.toLocalDate (zone : TimeZone = defaultTimeZone): DataFrame <T > =
438
+ to { it.convertToLocalDate(zone) }
439
+
440
+ @JvmName(" toLocalDateFromStringNullable" )
441
+ @Refine
442
+ @Converter(LocalDate ::class , nullable = true )
443
+ @Interpretable(" ToSpecificTypePattern" )
444
+ public fun <T > Convert <T , String ?>.toLocalDate (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
445
+ to { it.convertToLocalDate(pattern, locale) }
446
+
447
+ @JvmName(" toLocalDateFromString" )
448
+ @Refine
449
+ @Converter(LocalDate ::class , nullable = false )
450
+ @Interpretable(" ToSpecificTypePattern" )
451
+ public fun <T > Convert <T , String >.toLocalDate (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
375
452
to { it.convertToLocalDate(pattern, locale) }
376
453
454
+ @Refine
455
+ @Converter(LocalDate ::class , nullable = false )
456
+ @Interpretable(" ToSpecificType" )
377
457
public fun <T > Convert <T , * >.toLocalDate (): DataFrame <T > = to { it.convertTo<LocalDate >() }
378
458
379
459
// endregion
@@ -413,17 +493,51 @@ public fun DataColumn<String?>.convertToLocalTime(
413
493
return map { it?.let { converter(it.trim()) ? : error(" Can't convert `$it ` to LocalTime" ) } }
414
494
}
415
495
496
+ @JvmName(" toLocalTimeFromTLongNullable" )
497
+ @Refine
498
+ @Converter(LocalTime ::class , nullable = true )
499
+ @Interpretable(" ToSpecificTypeZone" )
500
+ public fun <T > Convert <T , Long ?>.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
501
+ to { it.convertToLocalTime(zone) }
502
+
416
503
@JvmName(" toLocalTimeFromTLong" )
417
- public fun <T , R : Long ?> Convert <T , R >.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
504
+ @Refine
505
+ @Converter(LocalTime ::class , nullable = false )
506
+ @Interpretable(" ToSpecificTypeZone" )
507
+ public fun <T > Convert <T , Long >.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
508
+ to { it.convertToLocalTime(zone) }
509
+
510
+ @JvmName(" toLocalTimeFromTIntNullable" )
511
+ @Refine
512
+ @Converter(LocalTime ::class , nullable = true )
513
+ @Interpretable(" ToSpecificTypeZone" )
514
+ public fun <T > Convert <T , Int ?>.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
418
515
to { it.convertToLocalTime(zone) }
419
516
420
517
@JvmName(" toLocalTimeFromTInt" )
421
- public fun <T , R : Int ?> Convert <T , R >.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
518
+ @Refine
519
+ @Converter(LocalTime ::class , nullable = false )
520
+ @Interpretable(" ToSpecificTypeZone" )
521
+ public fun <T > Convert <T , Int >.toLocalTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
422
522
to { it.convertToLocalTime(zone) }
423
523
424
- public fun <T , R : String ?> Convert <T , R >.toLocalTime (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
524
+ @JvmName(" toLocalTimeFromStringNullable" )
525
+ @Refine
526
+ @Converter(LocalTime ::class , nullable = true )
527
+ @Interpretable(" ToSpecificTypePattern" )
528
+ public fun <T > Convert <T , String ?>.toLocalTime (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
425
529
to { it.convertToLocalTime(pattern, locale) }
426
530
531
+ @JvmName(" toLocalTimeFromString" )
532
+ @Refine
533
+ @Converter(LocalTime ::class , nullable = false )
534
+ @Interpretable(" ToSpecificTypePattern" )
535
+ public fun <T > Convert <T , String >.toLocalTime (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
536
+ to { it.convertToLocalTime(pattern, locale) }
537
+
538
+ @Refine
539
+ @Converter(LocalTime ::class , nullable = false )
540
+ @Interpretable(" ToSpecificType" )
427
541
public fun <T > Convert <T , * >.toLocalTime (): DataFrame <T > = to { it.convertTo<LocalTime >() }
428
542
429
543
// endregion
@@ -471,65 +585,155 @@ public fun DataColumn<String?>.convertToLocalDateTime(
471
585
return map { it?.let { converter(it.trim()) ? : error(" Can't convert `$it ` to LocalDateTime" ) } }
472
586
}
473
587
588
+ @JvmName(" toLocalDateTimeFromTLongNullable" )
589
+ @Refine
590
+ @Converter(LocalDateTime ::class , nullable = true )
591
+ @Interpretable(" ToSpecificTypeZone" )
592
+ public fun <T > Convert <T , Long ?>.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
593
+ to { it.convertToLocalDateTime(zone) }
594
+
474
595
@JvmName(" toLocalDateTimeFromTLong" )
475
- public fun <T , R : Long ?> Convert <T , R >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
596
+ @Refine
597
+ @Converter(LocalDateTime ::class , nullable = false )
598
+ @Interpretable(" ToSpecificTypeZone" )
599
+ public fun <T > Convert <T , Long >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
600
+ to { it.convertToLocalDateTime(zone) }
601
+
602
+ @JvmName(" toLocalDateTimeFromTInstantNullable" )
603
+ @Refine
604
+ @Converter(LocalDateTime ::class , nullable = true )
605
+ @Interpretable(" ToSpecificTypeZone" )
606
+ public fun <T > Convert <T , Instant ?>.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
476
607
to { it.convertToLocalDateTime(zone) }
477
608
478
609
@JvmName(" toLocalDateTimeFromTInstant" )
479
- public fun <T , R : Instant ?> Convert <T , R >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
610
+ @Refine
611
+ @Converter(LocalDateTime ::class , nullable = false )
612
+ @Interpretable(" ToSpecificTypeZone" )
613
+ public fun <T > Convert <T , Instant >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
614
+ to { it.convertToLocalDateTime(zone) }
615
+
616
+ @JvmName(" toLocalDateTimeFromTIntNullable" )
617
+ @Refine
618
+ @Converter(LocalDateTime ::class , nullable = true )
619
+ @Interpretable(" ToSpecificTypeZone" )
620
+ public fun <T > Convert <T , Int ?>.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
480
621
to { it.convertToLocalDateTime(zone) }
481
622
482
623
@JvmName(" toLocalDateTimeFromTInt" )
483
- public fun <T , R : Int ?> Convert <T , R >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
624
+ @Refine
625
+ @Converter(LocalDateTime ::class , nullable = false )
626
+ @Interpretable(" ToSpecificTypeZone" )
627
+ public fun <T > Convert <T , Int >.toLocalDateTime (zone : TimeZone = defaultTimeZone): DataFrame <T > =
484
628
to { it.convertToLocalDateTime(zone) }
485
629
486
- public fun <T , R : String ?> Convert <T , R >.toLocalDateTime (
487
- pattern : String? = null,
488
- locale : Locale ? = null,
489
- ): DataFrame <T > = to { it.convertToLocalDateTime(pattern, locale) }
630
+ @JvmName(" toLocalDateTimeFromStringNullable" )
631
+ @Refine
632
+ @Converter(LocalDateTime ::class , nullable = true )
633
+ @Interpretable(" ToSpecificTypePattern" )
634
+ public fun <T > Convert <T , String ?>.toLocalDateTime (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
635
+ to { it.convertToLocalDateTime(pattern, locale) }
490
636
637
+ @JvmName(" toLocalDateTimeFromString" )
638
+ @Refine
639
+ @Converter(LocalDateTime ::class , nullable = false )
640
+ @Interpretable(" ToSpecificTypePattern" )
641
+ public fun <T > Convert <T , String >.toLocalDateTime (pattern : String? = null, locale : Locale ? = null): DataFrame <T > =
642
+ to { it.convertToLocalDateTime(pattern, locale) }
643
+
644
+ @Refine
645
+ @Converter(LocalDateTime ::class , nullable = false )
646
+ @Interpretable(" ToSpecificType" )
491
647
public fun <T > Convert <T , * >.toLocalDateTime (): DataFrame <T > = to { it.convertTo<LocalDateTime >() }
492
648
493
649
// endregion
494
650
495
651
@JvmName(" toIntTAny" )
652
+ @Refine
653
+ @Converter(Int ::class , nullable = false )
654
+ @Interpretable(" ToSpecificType" )
496
655
public fun <T > Convert <T , Any >.toInt (): DataFrame <T > = to<Int >()
497
656
657
+ @Refine
658
+ @Converter(Int ::class , nullable = true )
659
+ @Interpretable(" ToSpecificType" )
498
660
public fun <T > Convert <T , Any ?>.toInt (): DataFrame <T > = to<Int ?>()
499
661
500
662
@JvmName(" toLongTAny" )
663
+ @Refine
664
+ @Converter(Long ::class , nullable = false )
665
+ @Interpretable(" ToSpecificType" )
501
666
public fun <T > Convert <T , Any >.toLong (): DataFrame <T > = to<Long >()
502
667
668
+ @Refine
669
+ @Converter(Long ::class , nullable = true )
670
+ @Interpretable(" ToSpecificType" )
503
671
public fun <T > Convert <T , Any ?>.toLong (): DataFrame <T > = to<Long ?>()
504
672
505
673
@JvmName(" toStrTAny" )
674
+ @Refine
675
+ @Converter(String ::class , nullable = false )
676
+ @Interpretable(" ToSpecificType" )
506
677
public fun <T > Convert <T , Any >.toStr (): DataFrame <T > = to<String >()
507
678
679
+ @Refine
680
+ @Converter(String ::class , nullable = true )
681
+ @Interpretable(" ToSpecificType" )
508
682
public fun <T > Convert <T , Any ?>.toStr (): DataFrame <T > = to<String ?>()
509
683
510
684
@JvmName(" toDoubleTAny" )
685
+ @Refine
686
+ @Converter(Double ::class , nullable = false )
687
+ @Interpretable(" ToSpecificType" )
511
688
public fun <T > Convert <T , Any >.toDouble (): DataFrame <T > = to<Double >()
512
689
690
+ @Refine
691
+ @Converter(Double ::class , nullable = true )
692
+ @Interpretable(" ToSpecificType" )
513
693
public fun <T > Convert <T , Any ?>.toDouble (): DataFrame <T > = to<Double ?>()
514
694
515
695
@JvmName(" toFloatTAny" )
696
+ @Refine
697
+ @Converter(Float ::class , nullable = false )
698
+ @Interpretable(" ToSpecificType" )
516
699
public fun <T > Convert <T , Any >.toFloat (): DataFrame <T > = to<Float >()
517
700
701
+ @Refine
702
+ @Converter(Float ::class , nullable = true )
703
+ @Interpretable(" ToSpecificType" )
518
704
public fun <T > Convert <T , Any ?>.toFloat (): DataFrame <T > = to<Float ?>()
519
705
520
706
@JvmName(" toBigDecimalTAny" )
707
+ @Refine
708
+ @Converter(BigDecimal ::class , nullable = false )
709
+ @Interpretable(" ToSpecificType" )
521
710
public fun <T > Convert <T , Any >.toBigDecimal (): DataFrame <T > = to<BigDecimal >()
522
711
712
+ @Refine
713
+ @Converter(BigDecimal ::class , nullable = true )
714
+ @Interpretable(" ToSpecificType" )
523
715
public fun <T > Convert <T , Any ?>.toBigDecimal (): DataFrame <T > = to<BigDecimal ?>()
524
716
525
717
@JvmName(" toBigIntegerTAny" )
718
+ @Refine
719
+ @Converter(BigInteger ::class , nullable = false )
720
+ @Interpretable(" ToSpecificType" )
526
721
public fun <T > Convert <T , Any >.toBigInteger (): DataFrame <T > = to<BigInteger >()
527
722
723
+ @Refine
724
+ @Converter(BigInteger ::class , nullable = true )
725
+ @Interpretable(" ToSpecificType" )
528
726
public fun <T > Convert <T , Any ?>.toBigInteger (): DataFrame <T > = to<BigInteger ?>()
529
727
530
728
@JvmName(" toBooleanTAny" )
729
+ @Refine
730
+ @Converter(Boolean ::class , nullable = false )
731
+ @Interpretable(" ToSpecificType" )
531
732
public fun <T > Convert <T , Any >.toBoolean (): DataFrame <T > = to<Boolean >()
532
733
734
+ @Refine
735
+ @Converter(Boolean ::class , nullable = true )
736
+ @Interpretable(" ToSpecificType" )
533
737
public fun <T > Convert <T , Any ?>.toBoolean (): DataFrame <T > = to<Boolean ?>()
534
738
535
739
public fun <T , C > Convert <T , List <List <C >>>.toDataFrames (containsColumns : Boolean = false): DataFrame <T > =
0 commit comments