In Intellij in Java I can easily get the IDE to ge...
# announcements
p
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
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.
Using the IDE
p
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
Delegation doesn't work for open classes? --- yup interface only. I didn't realize
l
How about instead of delegation using composition and forwarding?