Skip to content

Commit f1bf798

Browse files
committed
Deprecate trivial Split shortcuts
1 parent cf48803 commit f1bf798

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/split.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import org.jetbrains.kotlinx.dataframe.impl.api.withRowCellImpl
1818
import org.jetbrains.kotlinx.dataframe.impl.asList
1919
import org.jetbrains.kotlinx.dataframe.impl.columnName
2020
import org.jetbrains.kotlinx.dataframe.impl.getListType
21+
import org.jetbrains.kotlinx.dataframe.util.SPLIT_STR
2122
import kotlin.reflect.KProperty
2223
import kotlin.reflect.KType
2324
import kotlin.reflect.typeOf
@@ -65,6 +66,7 @@ public typealias ColumnNamesGenerator<C> = ColumnWithPath<C>.(extraColumnIndex:
6566
public inline fun <T, C : Iterable<R>, reified R> Split<T, C>.default(value: R?): SplitWithTransform<T, C, R> =
6667
by { it }.default(value)
6768

69+
@Deprecated(SPLIT_STR, ReplaceWith("""by(",").default(value)"""))
6870
public fun <T> Split<T, String>.default(value: String?): SplitWithTransform<T, String, String> =
6971
by { it.splitDefault() }.default(value)
7072

@@ -219,6 +221,7 @@ public inline fun <T, reified A, reified B> Split<T, Pair<A, B>>.into(
219221
secondCol: ColumnAccessor<B>,
220222
): DataFrame<T> = by { listOf(it.first, it.second) }.into(firstCol, secondCol)
221223

224+
@Deprecated(SPLIT_STR, ReplaceWith("""by(",").into(*names, extraNamesGenerator = extraNamesGenerator)"""))
222225
@JvmName("intoTC")
223226
public fun <T> Split<T, String>.into(
224227
vararg names: String,
@@ -280,6 +283,7 @@ public inline fun <T, reified A, reified B> Split<T, Pair<A, B>>.inward(
280283
secondCol: ColumnAccessor<B>,
281284
): DataFrame<T> = by { listOf(it.first, it.second) }.inward(firstCol, secondCol)
282285

286+
@Deprecated(SPLIT_STR, ReplaceWith("""by(",").inward(*names, extraNamesGenerator = extraNamesGenerator)"""))
283287
@JvmName("inwardTC")
284288
public fun <T> Split<T, String>.inward(
285289
vararg names: String,

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ internal const val TO_CSV = "toCsv() is deprecated in favor of toCsvStr() in dat
160160
internal const val TO_CSV_IMPORT = "org.jetbrains.kotlinx.dataframe.io.toCsvStr"
161161
internal const val TO_CSV_REPLACE = "this.toCsvStr()"
162162

163+
internal const val SPLIT_STR =
164+
"Please explicitly specify how the String should be split. This shortcut will be removed in version 1.1.0"
165+
163166
// endregion
164167

165168
// region keep across releases

0 commit comments

Comments
 (0)