[jdom-interest] How to ease traversal of JDOM tree
Laurent Bihanic
laurent.bihanic at atosorigin.com
Mon Nov 19 09:38:20 PST 2001
Salut, Sébastien,
Sébastien Pierre wrote:
> But I don't understand why this would change the JDOM API? I think we
> shouldn't modify method return types or behaviour, ...
Well, this a constraint from the Java language: If you implement a method
defined in an interface, you can't change its return type.
Introducing the proposed interface would change the JDOM API by chaning the
return type of some methods.
For example, the addContent() method of Element currently returns the Element
itself to allow chaining method calls:
elt.addContent(a).addContent(b).addContent(c).getNamespace();
With the proposed interface, addContent would return a Node and the above line
would have to be broken into the following 2 lines:
elt.addContent(a).addContent(b).addContent(c);
elt.getNamespace();
Laurent
More information about the jdom-interest
mailing list