I noticed that most if not all of the methods defined in the Group object are declared final. Why on earth is that?
I’m working on translating some animation code I wrote in Java3D to Xith3D, and in the Java3D version I relied on overriding the addChild() method of Group. I created an AnimatedGroup object that was a child of Group, and then also had Animation objects that are children of Node. When an Animation object is added to an AnimatedGroup object, I want to call some additional methods on that Animation object along with adding it to the group.
My AnimatedGroup.addChild() method looked like this:
public void addChild(Node node) {
if (node instanceof Animation) {
... do stuff to animation object ...
}
super.addChild(node);
}
Obviously this doesn not work when addChild() is declared as final in the Group object. I suppose I could write a addAnimation() wrapper method in AnimatedGroup, but it looks sloppy to me. Is there a good reason that Group has all these methods declared as final?
Paul