[jdom-interest] Convoluted Document Construction on b10
jhunter at xquery.com
Wed Mar 31 16:21:58 PST 2004
It's well understood. The reason is that Java doesn't have covariant
return types so the new Parent interface's addContent() methods returns
Parent and the Element implementation can't return the more specific
type of Element. You can do it in J2SE 1.5.
Options are: rip out the Parent interface, write an addContent(Parent)
method as a nasty hack, keep it this way and have a J2SE 1.5 version.
Stefano Santoro wrote:
> I have been an avid fan of jdom-b9. I have recommended
> many of the vendors we work with to support jdom directly,
> and pushing all of my teams members that participate on
> various JSRs (XQuery, and JAXB) to champion further
> integration with JDOM.
> So I was a bit taken back when I found out that JDOM b10
> no longer support elegant document constructions like this one
> Element webel = new Element("web-email", _wenfns);
> (new Element("message-id", _wenfns)
> .addContent( Long.toString(req.getLegacyId())))
> (new Element( "sender", _wenfns)
> .setAttribute( "address", req.getSender())
> .addContent( "A Sender Dude"))
> (new Element( "recipient", _wenfns)
> .setAttribute( "address", req.getRecipient())
> .addContent( "A Recipient Dude"))
> (new Element( "subject", _wenfns)
> Is this a planned disruption? Or is this being addressed?
More information about the jdom-interest