[jdom-interest] FactoryJDOM
Steven D. Keens
skeens at planetfred.com
Tue Jun 26 12:09:27 PDT 2001
Isn't reflection rather slow? I haven't used reflection yet, but it seems
to me that dynamically determining the class of object is slower than hard
coding it. So, the question here is, will the majority of users need the
simplicity of using reflection in the factory? I believe that most people
will need the default factory. If a user really needs to change the class of
object created, it is not all that much work to subclass JDOMFactory. And
finally, if a user really wants to do dynamic (reflection based) object
creation in the factory, they can always build themselves a subclass to do
just that.
--
Steven Keens mailto:skeens at planetfred.com
Planetfred Inc. http://www.planetfred.com
44 Byward Market, Suite 240, Ottawa, ON, K1N 7A2, Canada
The most exciting phrase in science, the one which heralds
new discoveries, is not "Eureka!", but "That's funny!"
-- Issac Asimov
>Hey-
>
> 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");
>
>rather than coding a complete subclass/implementation of
>DefaultJDOMFactory/JDOMFactory. I understand with the multiple
>constructors,
>you'd probably have to use reflection (since Class.forName().newInstance())
>won't work in every case, but it would be awfully convenient if it was an
>option.
>
>Any thoughts from Ken and the other factory implementors?
>
>-Brett
More information about the jdom-interest
mailing list