[jdom-interest] Subclassing support in JDOM

Jason Hunter jhunter at collab.net
Thu Feb 15 09:20:44 PST 2001


D Gross wrote:
> 
> I would like some way to add additional information to a JDOM Document
> tree.  It would be nice if we could either subclass, say, an Element
> or point to user defined properties.  Since existing code hard codes
> a "new Element", there is no way to subclass.

Write your own builder that builds the kind of document you want.  Then
to add new docs you can either say "new YourElement" or you could have
the custom Document use a factory pattern to create new elements.  We
think that's not a common enough case to make *everyone* suffer the
factory pattern though.

-jh-



More information about the jdom-interest mailing list