[jdom-interest] Common interface for "node" classes.
O'neil, Jerome
joneil at cobaltgroup.com
Tue Apr 30 08:05:37 PDT 2002
I've been working with JDOM for creating object models for semi-complicated
XML, and it's been great. One of the smaller nits I'm constantly picking is
the lack of a shared type for "node" classes like Element and Text. Common
tasks like getParent and detach should be specified by a common interface,
say JDOMNode or some such thing.
For example...
// Methods of particular interest to Jerome for the
// immediate future. :)
interface JDOMNode{
public JDOMNode detach();
public Element getParent();
}
class Element implements Serializable, Cloneable, JDOMNode{ .... }
class Text implements Serializable, Cloneable, JDOMNode{ .... }
This would mean not having to check for explicit types before casting while
iterating over child collections, which would be handy-dandy, IMO. I know
there was some brief discussion of this kind of thing in the list archives,
but I don't know if anything was ever decided. I know it starts to tinker
with existing interfaces, but I think it's a good thing.
Polymorphism. It's not just for breakfast anymore.
Thanks!
--
Jerome O'Neil
Sr. Software Engineer
The Cobalt Group
206.219.8008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020430/8aecb47a/attachment.htm
More information about the jdom-interest
mailing list