[jdom-interest] Factories

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Feb 28 03:27:10 PST 2004


At 6:30 PM -0800 2/27/04, Jason Hunter wrote:
>FYI, I just made an interesting commit.  People not on the commits 
>list might want to take a look:
>
>http://lists.denveronline.net/lists/jdom-commits/2004-February/001745.html
>
>This change also made me think, should JDOMFactory really be an 
>interface, a class, or an abstract class?  The problem with an 
>interface is that if we add methods after 1.0 it breaks everyone 
>implementing the interface.  With a class or abstract class, we can 
>add w/o breakage so long as the new methods can have a standard 
>implementation.
>

The problem with this is that the unchecked factory can be used 
directly without a parser. The Builder should use it by default, but 
it should only be accessible to the Builder. i.e. it should be 
package protected, and should not require the user to set it. For 
more safety it should only be used if the parser is a known good 
parser, and not a custom XMLReader or XMLFilter.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list