Add overridable method "setup" for defining properties
This commit is contained in:
@@ -33,6 +33,8 @@ open class ScriptingProperties(body: ScriptingProperties.() -> Unit = {}) {
|
||||
body()
|
||||
}
|
||||
|
||||
open fun setup() {}
|
||||
|
||||
internal fun makePropertyBag(): ChainedPropertyBag =
|
||||
ChainedPropertyBag.createOptimized(parentPropertiesBag ?: parentPropertiesBuilder?.makePropertyBag(), data)
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ fun createScriptDefinitionFromAnnotatedBaseClass(
|
||||
}
|
||||
|
||||
fun scriptingPropsInstance(kclass: KClass<out ScriptingProperties>): ScriptingProperties = try {
|
||||
kclass.objectInstance ?: kclass.createInstance()
|
||||
kclass.objectInstance ?: kclass.createInstance().also { it.setup() }
|
||||
} catch (e: Throwable) {
|
||||
throw IllegalArgumentException(ILLEGAL_CONFIG_ANN_ARG, e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user