org.jetbrains.kotlinx.dataframe.plugin.impl.ExpectedArgumentDelegates.kt Maven / Gradle / Ivy
The newest version!
package org.jetbrains.kotlinx.dataframe.plugin.impl
import org.jetbrains.kotlinx.dataframe.plugin.impl.api.RenameClauseApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.AbstractInterpreter.*
import org.jetbrains.kotlinx.dataframe.plugin.impl.api.TypeApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.ColumnAccessorApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.ColumnPathApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.ColumnWithPathApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.DataFrameCallableId
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.InsertClauseApproximation
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.KPropertyApproximation
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadOnlyProperty
typealias ExpectedArgumentProvider = PropertyDelegateProvider>
fun AbstractInterpreter.dataFrame(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Schema)
fun AbstractInterpreter.varargString(
name: ArgumentName? = null,
defaultValue: DefaultValue> = Absent
): ExpectedArgumentProvider> = arg(name, lens = Interpreter.Value, defaultValue = defaultValue)
fun AbstractInterpreter.renameClause(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
fun AbstractInterpreter.columnsSelector(
name: ArgumentName? = null
): ExpectedArgumentProvider> = arg(name, lens = Interpreter.Value)
fun AbstractInterpreter.type(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.ReturnType)
fun > AbstractInterpreter.enum(
name: ArgumentName? = null,
defaultValue: DefaultValue = Absent
): ExpectedArgumentProvider = argConvert(name = name, lens = Interpreter.Value, defaultValue = defaultValue) { it: DataFrameCallableId ->
val forName: Class<*> = Class.forName("${it.packageName}.${it.className}")
@Suppress("UNCHECKED_CAST")
java.lang.Enum.valueOf(forName as Class>, it.callableName) as E
}
fun AbstractInterpreter.columnAccessor(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
fun AbstractInterpreter.dataColumn(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
fun AbstractInterpreter.insertClause(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
internal fun AbstractInterpreter.columnPath(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
internal fun AbstractInterpreter.columnWithPath(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
fun AbstractInterpreter.kproperty(
name: ArgumentName? = null
): ExpectedArgumentProvider = arg(name, lens = Interpreter.Value)
internal fun AbstractInterpreter.string(
name: ArgumentName? = null
): ExpectedArgumentProvider =
arg(name, lens = Interpreter.Value)
internal fun AbstractInterpreter.dsl(
name: ArgumentName? = null
): ExpectedArgumentProvider<(Any, Map>) -> Unit> =
arg(name, lens = Interpreter.Dsl, defaultValue = Present(value = {_, _ -> }))