worm/src/main/kotlin/net/cijber/worm/dsl/ColumnDefinition.kt
2019-12-06 17:48:07 +01:00

19 lines
No EOL
473 B
Kotlin

package net.cijber.worm.dsl
import net.cijber.worm.dto.ColumnProperty
import kotlin.reflect.KProperty
class ColumnDefinition<T> {
var makeDefault: (() -> T)? = null
operator fun provideDelegate(target: Any, property: KProperty<*>): ColumnProperty<T> {
return ColumnProperty()
}
fun default(default: T) = default({ default })
fun default(builder: () -> T): ColumnDefinition<T> {
this.makeDefault = builder
return this
}
}