I want to have for example:
class Foo {
fun doSomething(arg1: String, arg2: String, arg3: Boolean)
}
class FooDelegate {
//different fun name
fun execute by Foo::doSomething
}
Either with reflection or other way.
What I currently have is:
class FooDelegated<R>(
private val func: KFunction<R>
) {
fun execute(vararg params: Any) = func.call(*params)
}
So that I can call
FooDelegated(Foo::doSomething).execute("1", "2", true)
However I require to send parameters which are not really know. I would like my compiler to know which parameters can be sent. Else, I can write the following and it won't fail until run time:
FooDelegated(Foo::doSomething).execute("1", "2", "new argument", false)
NOTE that I want it to have different names, not by using interfaces.