You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
378 B
Kotlin
14 lines
378 B
Kotlin
package moe.odango.index.utils
|
|
|
|
inline fun<reified T> helper(crossinline constructor: () -> T, crossinline init: T.() -> Unit = {}): EntityHelper<T> {
|
|
return object : EntityHelper<T> {
|
|
override fun invoke(block: T.() -> Unit): T {
|
|
val entity = constructor()
|
|
init(entity)
|
|
block(entity)
|
|
return entity
|
|
}
|
|
|
|
}
|
|
}
|