[jdom-interest] FactoryJDOM

philip.nelson at omniresources.com philip.nelson at omniresources.com
Tue Jun 26 11:00:56 PDT 2001

>   Just got through with the writeup of JDOMFactory and 
> subclassing in JDOM
> for my book (2nd edition), and had a couple of thoughts. 
> While it's fairly
> obvious how this works, and made explaining it easy, it's 
> also a little
> repetitive. I have to:
> 1) Code my subclass.
> No big deal, perfectly normal, expected amount of work.
> 2) Code up a JDOMFactory implementation
> This was the slight surprise. I expected to do something like:
> factory.setElementClass("javaxml2.ORAElement");

I don't see a problem with this except that as you point out you can't pass
any arguments when you use reflection.  I would also code it to avoid use of
reflection for the default case since it would slow down normal builds.

Personally, I found that using an anonymous inner class that subclassed the
default implementation worked beautifully and added very few lines of code.

More information about the jdom-interest mailing list