[jdom-interest] Introduction. JDOM for Java5?

J. McConnell jdotmc at gmail.com
Fri Jan 27 08:16:47 PST 2006

On 1/26/06, Matthias Basler <Matthias.Basler at uni-jena.de> wrote:
> Phil wrote:
> > The one point I would make (again) is that all the "node" types should
> > implement a (placeholder) Node interface to allow the entire API to be
> > slightly more type safe (removing any Object references).
> The same critical comment was raised in the book "Processing XML with Java".
> However: There is a org.jdomContent class, which imho takes exactly this role.
> When calling f.e. Element:getContent(), you don't get a list of arbitrary
> Objects, but rather a list of <Content>, if I understand it right.
> .. And I don't see a reason why an _interface_ instead of this class would make
> things easier or more type save. (Maybe I misunderstand your problem, since I am
> new to this API as well.)

This has been my experience.  Taking advantage of the compile-time
type safety Generics allows is easy.  I have been doing things like
this without any problems:

List<Content> nodes = node.getContent();

At that point, I am typesafe and Eclipse doesn't complain with
warnings.  That said, I would like to see Generics used in a future
version of JDOM, if possible.

- J.

More information about the jdom-interest mailing list