[jdom-interest] Fast Factory

Alex Rosen arosen at novell.com
Tue May 27 07:43:07 PDT 2003


> How many sub-classers are there out there?

Personally, we've mostly subclassed in order to work around bugs or
limitations that have subsequently been fixed. I'm worried about making
many things private, though, since we've consistently recommended
subclassing over the years for adding your own small tweak. For example,
tweaking the output formatting.

For example we subclassed XMLOutputter to fix the problem that there
was no newline after the emitted DOCTYPE declaration. (This enhancement
is now in the main JDOM tree.) We wanted to use XMLOutputter's
lineSeparator value, but since lineSeparator was private and there was
no getter, we had to subclass setLineSeparator() to remember the value
in a private value of our own. This is ugly, and now that we have a
separate Format class (again without getters) it wouldn't work. Someone
else who wanted to tweak the output would have to duplicate
XMLOutputter, as well as Format, since they use package-private members
to communicate.

Alex




More information about the jdom-interest mailing list