This is another general Java question. Again, if you Java gurus know a
better forum for this stuff, please let me know.
I have found a solution to the problem of dynamic accessing of elements
of class arrays in classes whose name is known at runtime. Basically,
type[] a =
(type[])(Class.forName(classname).getField(arrayname).get(null))
(I haven't tried it that form, mind you.) Although it is not spelled
out in the documentation, Field.get(), where the field is an array,
returns an array reference, and Bob's your uncle.
Out of the solution comes another question. I have a static initializer
which can throw a ClassNotFoundException. How do I handle this? I
can't attach a "throws" clause to the "static" keyword. Do I just catch
it and throw a RuntimeException?
Peter
--
Peter B. West [EMAIL PROTECTED] http://powerup.com.au/~pbwest
"Lord, to whom shall we go?"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]