Dirk Hoffmann
07/28/2023, 6:17 PMabstract fun callBy(args: Map<KParameter, Any?>): R
(as I want to have constructor args that have default values, to take their default values on instantiation)
context(SomeCtxClass)
class ContextualClass(val some: String, val withDefault: String = "Default")
val primaryConstructor: KFunction<ContextualClass> = ContextualClass::class.primaryConstructor!!
gives me a parameter list of size 2 (the direct class constructor parameters)
but as the class has context(SomeCtxClass)
I have to pass three!! args to the paramMap
of primaryConstructor.callBy(paramMap)
now I have an instance of the ctx object ... but how to "put" this into the paramMap which is a Map<KParameter, Any?>)
(but I don't have a KParameter for that context object, as the ..::class.primaryConstructor
doesn't have a KParam for the context objectefemoney
07/29/2023, 8:21 AM