I have an abstract Java class that needs to have one method onMessage to be implemented. I know that a closure can easily implement a Java interface using the as keyword, but how can it extend an abstract Java class?
If it can’t extend it, then whats the best work around possible in such cases in Groovy?
Here is my usage in Java, I am looking for something similar that can be done in Groovy.
MessageCallback callback = new MessageCallback() {
@Override
public void onMessage(Message message) {
dosomething();
}
};
Where message callback is my abstract class which I would like to use in a similar fashion in Groovy.
I believe you should be able to do:
Does that not work?
Edit
To make a call from the Map method back to the Abstract class, the only way I can find to do it is: