[jdom-interest] Re: Factories for Element creation

bob mcwhirter bob at werken.com
Tue Oct 31 20:22:00 PST 2000


> > Has anyone thought about this approach? I think its a nice compromise
> > between imposing a Factory style on JDOM (plus its a bit late now,
> > anyway), and forcing users to "deal with it" by writing custom code
> > for this case.
> 
> You can do this today, right?.  Write your own builder that creates your
> own type of elements.  What you're wanting is SAXBuilder to provide
> extra help with a setElementFactory() method.  I'd rather see SAXBuilder
> have protected create methods that could be overridden, if such
> functionality is needed at all.

I'd like one or the other, actually.

Problem with creating your own builder, (ie, MySAXBuilder), is that
it'd only work for SAX, and you'd have to Do It Again for MyDOMBuilder,
or MyJDBCBuilder.  A Factory of some flavor would do wonders.  Have
a BuilderBase with hooks for a factory, and derive FooBuilder from
it.  Instantly, everything would work. ;)

	-bob




More information about the jdom-interest mailing list