Thank you everyone who answered this question. It looks like it boils down
to making use of the reflection package. I'm afraid I'm not very well versed
in the way JVMs are usually implemented, so I can't help having a certain
performance worry.
Does
Class fooClz = Class.forName("some.class.name");
MyClass myFoo = (MyClass) fooClz.newInstance();
involve creation of a new proxy instance only, or is "some.class.name" also
instantiated? If it does, is it then shared between multiple threads in a
JVM? I guess "some.class.name" is not instantiated, but I'd like to be
absolutely sure - otherwise performance penalty of doing the above in
multiple threads could be too high.
Lo
-----Original Message-----
From: David Morris [mailto:David.Morris@plumcreek.com]
Sent: Tuesday, December 11, 2001 2:53 AM
To: java400-l@midrange.com; Lo.Raikov@MISYS.COM
Subject: RE: Dynamic program calls/run-time class names
Lo,
Since this list recently took an open source turn, why don't you have
a look at the beanutils, which are part of the Apache Jakarta project.
I have used those classes quite a bit and they do make the reflection
classes pretty easy to digest. The Commons web site is at:
http://jakarta.apache.org/commons
David Morris
>>> Lo.Raikov@MISYS.COM 12/10/01 12:28AM >>>
Thanks, I'll think about it. Although, to be quite frank, at first
glance,
it does not look particularly transparent. :-)
Lo
-----Original Message-----
From: Gary L Peskin [mailto:garyp@firstech.com]
Sent: Monday, December 10, 2001 5:49 PM
To: java400-l@midrange.com
Subject: RE: Dynamic program calls/run-time class names
Have a look at the java reflection classes in java.lang.reflect,
particularly Method and Class.
Gary