All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlinx.ggdsl.dsl.source.kt Maven / Gradle / Ivy

There is a newer version: 0.4.0-dev-15
Show newest version
package org.jetbrains.kotlinx.ggdsl.dsl

import org.jetbrains.kotlinx.ggdsl.ir.data.DataSource
import org.jetbrains.kotlinx.ggdsl.ir.data.NamedData
import kotlin.reflect.KProperty
import kotlin.reflect.KType
import kotlin.reflect.typeOf

/**
 * Returns a new [DataSource].
 *
 * @param T the type of source
 * @param id the name of source in [NamedData]
 */
inline fun  source(id: String): DataSource =
    DataSource(id, typeOf())

data class UnnamedDataSource(val type: KType) {
    operator fun getValue(t: T?, property: KProperty<*>): DataSource {
        return DataSource(property.name, type)
    }
}

// todo
inline operator fun  String.invoke(): DataSource =
    DataSource(this, typeOf())

// todo
inline fun  source(): UnnamedDataSource =
    UnnamedDataSource(typeOf())




© 2015 - 2025 Weber Informatics LLC | Privacy Policy