[jdom-interest] Convoluted Document Construction on b10

Bradley S. Huffman hip at cs.okstate.edu
Wed Mar 31 17:23:31 PST 2004


Jason Hunter writes:

> 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.

Or have addContent return void and put a stop to this insanity once and
for all.

Brad

> Stefano Santoro wrote:
> 
> > Hi,
> > 
> > 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);
> > 
> > 	webel.addContent
> > 	  (new Element("message-id", _wenfns)
> > 	   .addContent( Long.toString(req.getLegacyId())))
> > 	  .addContent
> 	  (new Element( "sender", _wenfns)
> > 	    .setAttribute( "address", req.getSender())
> > 	    .addContent( "A Sender Dude"))
> > 	  .addContent
> > 	  (new Element( "recipient", _wenfns)
> > 	   .setAttribute( "address", req.getRecipient())
> > 	   .addContent( "A Recipient Dude"))
> > 	  .addContent
> > 	  (new Element( "subject", _wenfns)
> > 	   .addContent(req.getSubject()));
> > 
> > Is this a planned disruption? Or is this being addressed?
> > 
> > Ciao
> > Stefano
> > 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost
> .com



More information about the jdom-interest mailing list