[jdom-interest] Test - Expanding <script> element.

Bradley S. Huffman hip at a.cs.okstate.edu
Mon Mar 21 19:00:24 PST 2005

Jason Hunter writes:

> If we were to place this functionality in a method, wouldn't it make 
> sense to use just a single method?  It just doesn't seem right to have 
> each of the static factory methods also include an optional template 
> parameter.  I'm not sure what the one method would be named.  Something 
> like format.setSubsetFrom(old) but that's a terrible name.  The idea 
> though would be to set the pertinent fields from one onto another.  But 
> before worrying about it's name, maybe you could explain more why 
> subclassers would be better served by a method?

How would that work? getRawFormat() knows what fields it sets and what fields
it doesn't, but nothing else should. Same with getCompactFormat() and

> My vision was to change preserveFormat from a static to an instance 
> variable and to let its behavior related to the above 3 properties vary 
> according to the currentFormat rules.  No API change, just a bug fix.

I start to put code in XMLOutputter.setFormat to copy all fields from
userFormat to preserveFormat except the ones related to formating (setIndent
and setTexMode). But then if a field was ever added to Format or the text modes
change, then we'd have to remember to also change XMLOutputter. It just seemed
better to keep things in one place.


More information about the jdom-interest mailing list