In Intellij in Java I can easily get the IDE to generate a load of methods on a class that delegate down to an injected instance of a class. Kotlin supports delegation as part of the language but only for interfaces. What's the best way to generate delegates for classes that don't implement an interface?
d
Dico
01/05/2019, 8:38 AM
If you can't find the same function to generate delegating methods in Kotlin, you can do it in Java and convert the code to Kotlin.
Dico
01/05/2019, 8:39 AM
Using the IDE
p
Paul N
01/06/2019, 3:16 PM
Thanks. I can easily do it as per the IDE, just wondered if there was a workaround in the language for class level delegation.
a
aarjav
01/06/2019, 3:57 PM
Delegation doesn't work for open classes? --- yup interface only. I didn't realize
l
little
01/06/2019, 8:02 PM
How about instead of delegation using composition and forwarding?