[jdom-interest] (no subject)
Bradley S. Huffman
hip at csa.cs.okstate.edu
Fri May 30 12:31:11 PDT 2003
Is it the interfaces that are the problem, or the fact that getParent, instead
of always returning a Element, now returns a Parent node which could be either
a Document or Element?
The interfaces just define the relationships among the various JDOM objects.
Do they now offer much, other than documentation, over b9 or the previous API?
No. Will they in the future? I'd say yes, especially when generics make their
way into java. Are there other methods that should/could go in them? Probably.
The real issue seems to be the change in behaviour of getParent, and the
name changes to getChildElement/getChildElements that break existing
code.
More specifically the issue seems to be down casting, and whether or not you
should have to down cast to move up the tree. I don't think it's that big of
deal. And if your worried about performance, I can argue it actually improves
things in a more common use case, adding content. With the old behaviour of
getDocument/getParent we had to make 2 calls to determine if a object was
attached, now it's just one, and this affects every document build.
Eliminating as much casting as possible is good to a point. But by many
people's standards the JDOM API is already to big as it is, so adding methods
to avoid a instanceof and a cast is not worth it in my book.
Brad
More information about the jdom-interest
mailing list