Skip to content

Commit cce682b

Browse files
authored
Merge pull request #1118 from Kotlin/convert-shortcuts
Support convert shortcuts
2 parents f7c9238 + 1d73a6d commit cce682b

File tree

10 files changed

+352
-30
lines changed

10 files changed

+352
-30
lines changed

core/api/core.api

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ public abstract interface annotation class org/jetbrains/kotlinx/dataframe/annot
214214
public abstract fun name ()Ljava/lang/String;
215215
}
216216

217+
public abstract interface annotation class org/jetbrains/kotlinx/dataframe/annotations/Converter : java/lang/annotation/Annotation {
218+
public abstract fun klass ()Ljava/lang/Class;
219+
public abstract fun nullable ()Z
220+
}
221+
217222
public abstract interface annotation class org/jetbrains/kotlinx/dataframe/annotations/CsvOptions : java/lang/annotation/Annotation {
218223
public abstract fun delimiter ()C
219224
}
@@ -1524,41 +1529,67 @@ public final class org/jetbrains/kotlinx/dataframe/api/ConvertKt {
15241529
public static final fun toDoubleTAny (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15251530
public static final fun toFloat (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15261531
public static final fun toFloatTAny (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1527-
public static final fun toIFrame (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1528-
public static synthetic fun toIFrame$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1529-
public static final fun toImg (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1530-
public static synthetic fun toImg$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1531-
public static final fun toInstant (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1532+
public static final fun toIframeFromUrl (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1533+
public static synthetic fun toIframeFromUrl$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1534+
public static final fun toIframeFromUrlNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1535+
public static synthetic fun toIframeFromUrlNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;ZLjava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1536+
public static final fun toImgFromUrl (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1537+
public static synthetic fun toImgFromUrl$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1538+
public static final fun toImgFromUrlNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1539+
public static synthetic fun toImgFromUrlNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1540+
public static final fun toInstantFromString (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1541+
public static final fun toInstantFromStringNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15321542
public static final fun toInt (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15331543
public static final fun toIntTAny (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15341544
public static final fun toLocalDate (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1535-
public static final fun toLocalDate (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1536-
public static synthetic fun toLocalDate$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1545+
public static final fun toLocalDateFromString (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1546+
public static synthetic fun toLocalDateFromString$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1547+
public static final fun toLocalDateFromStringNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1548+
public static synthetic fun toLocalDateFromStringNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15371549
public static final fun toLocalDateFromTInt (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15381550
public static synthetic fun toLocalDateFromTInt$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1551+
public static final fun toLocalDateFromTIntNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1552+
public static synthetic fun toLocalDateFromTIntNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15391553
public static final fun toLocalDateFromTLong (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15401554
public static synthetic fun toLocalDateFromTLong$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1555+
public static final fun toLocalDateFromTLongNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1556+
public static synthetic fun toLocalDateFromTLongNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15411557
public static final fun toLocalDateTime (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1542-
public static final fun toLocalDateTime (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1543-
public static synthetic fun toLocalDateTime$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1558+
public static final fun toLocalDateTimeFromString (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1559+
public static synthetic fun toLocalDateTimeFromString$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1560+
public static final fun toLocalDateTimeFromStringNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1561+
public static synthetic fun toLocalDateTimeFromStringNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15441562
public static final fun toLocalDateTimeFromTInstant (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15451563
public static synthetic fun toLocalDateTimeFromTInstant$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1564+
public static final fun toLocalDateTimeFromTInstantNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1565+
public static synthetic fun toLocalDateTimeFromTInstantNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15461566
public static final fun toLocalDateTimeFromTInt (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15471567
public static synthetic fun toLocalDateTimeFromTInt$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1568+
public static final fun toLocalDateTimeFromTIntNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1569+
public static synthetic fun toLocalDateTimeFromTIntNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15481570
public static final fun toLocalDateTimeFromTLong (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15491571
public static synthetic fun toLocalDateTimeFromTLong$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1572+
public static final fun toLocalDateTimeFromTLongNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1573+
public static synthetic fun toLocalDateTimeFromTLongNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15501574
public static final fun toLocalTime (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1551-
public static final fun toLocalTime (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1552-
public static synthetic fun toLocalTime$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1575+
public static final fun toLocalTimeFromString (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1576+
public static synthetic fun toLocalTimeFromString$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1577+
public static final fun toLocalTimeFromStringNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1578+
public static synthetic fun toLocalTimeFromStringNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Ljava/lang/String;Ljava/util/Locale;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15531579
public static final fun toLocalTimeFromTInt (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15541580
public static synthetic fun toLocalTimeFromTInt$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1581+
public static final fun toLocalTimeFromTIntNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1582+
public static synthetic fun toLocalTimeFromTIntNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15551583
public static final fun toLocalTimeFromTLong (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15561584
public static synthetic fun toLocalTimeFromTLong$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1585+
public static final fun toLocalTimeFromTLongNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1586+
public static synthetic fun toLocalTimeFromTLongNullable$default (Lorg/jetbrains/kotlinx/dataframe/api/Convert;Lkotlinx/datetime/TimeZone;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15571587
public static final fun toLong (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15581588
public static final fun toLongTAny (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15591589
public static final fun toStr (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15601590
public static final fun toStrTAny (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1561-
public static final fun toURL (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1591+
public static final fun toUrlFromString (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
1592+
public static final fun toUrlFromStringNullable (Lorg/jetbrains/kotlinx/dataframe/api/Convert;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
15621593
}
15631594

15641595
public abstract interface class org/jetbrains/kotlinx/dataframe/api/ConvertSchemaDsl {

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/Plugin.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jetbrains.kotlinx.dataframe.annotations
22

3+
import kotlin.reflect.KClass
4+
35
@Target(AnnotationTarget.CLASS)
46
public annotation class HasSchema(val schemaArg: Int)
57

@@ -46,3 +48,9 @@ internal annotation class Check
4648
*/
4749
@Target(AnnotationTarget.FUNCTION)
4850
internal annotation class AccessApiOverload
51+
52+
/**
53+
* Provides argument to `ToSpecificType` interpreter - to what type compiler plugin should convert selected columns
54+
*/
55+
@Target(AnnotationTarget.FUNCTION)
56+
public annotation class Converter(val klass: KClass<*>, val nullable: Boolean = false)

0 commit comments

Comments
 (0)