How do I get this to work without implementing the...
# announcements
l
How do I get this to work without implementing the 100 functions it requires that I won't use?
c
If you don’t own that interface, you do have to implement those methods, there’s no way around that. But you could create an abstract class that contains default implementations of all of them, and extending that abstract class instead of the interface directly
l
Thank you. Yes I don't own that interface, I was hoping there was some way to avoid the boiler plate but can't think of anything
l
m
Maybe you could use delegation? Requires you to have another StompServerHandler object to delegate to though:
Copy code
class Handler(delegate: StompServerHandler) : StompServerHandler by delegate {

  // Only override the functions you need.
  override fun handle(serverFrame: ServerFrame) {

  }

}
1
p
Your IDE might be able to provide default implementations for some of those functions…