| | List |
| Subject: | Re: Reflection: Instantiate All Classes in a Package? |
| Poster: | dagon@dagon.net(MarkRafn) |
| Date: | Fri, 23 Mar 2007 16:12:57 -0700 |
| Related Postings: | 1 2 3 4 5 |
>>> Is it possible, by using Java reflection, to instantiate all classes
>>> existing in a package without knowing the names of those classes.
>[...]
>> Using Java reflection, the answer is NO. For more information, check the
>> message thread "Getting a list of classes in a package"; there is a nice
>> long discussion on class/package/reflection.
Oliver Wong wrote:
> Actually, the answer turned out to be "yes" (though I can't find the
>thread where we concluded this)
Um, no. The answer turned out to be "No, but if you define your problem more
clearly, we can suggest alternatatives that are possible, like enumerating
classes in certain known locations and instantiating those that implement a
given interface."
> OP, instead of instantiating all classes in a package, how about
>instantiating all classes located within a specific directory on the local
>harddrive?
Indeed!
--
Mark Rafn dagon@dagon.net <http://www.dagon.net/>
|
|