forked from cijber/worm
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.
10 lines
291 B
Kotlin
10 lines
291 B
Kotlin
4 years ago
|
package net.cijber.worm.dsl
|
||
|
|
||
|
open class Helper<T : Entity<T>> {
|
||
|
@Suppress("UNCHECKED_CAST")
|
||
|
operator fun invoke(block: T.() -> Unit): T {
|
||
|
val child = this::class.java.declaringClass.getDeclaredConstructor().newInstance() as T
|
||
|
block(child)
|
||
|
return child
|
||
|
}
|
||
|
}
|