PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed Need Money Easy and Quick?

Re: Reflection: Instantiate All Classes in a Package?

 List
Subject: Re: Reflection: Instantiate All Classes in a Package?
Poster: Oliver Wong
Date: Fri, 23 Mar 2007 18:26:11 -0400
Related Postings: 1 2 3 4 5
"Joshua Cranmer" wrote in message news:lzXMh.493$Ht2.302@trnddc06...
> Jason Cavett wrote:
>> I was wondering...
>>
>> 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.

Actually, the answer turned out to be "yes" (though I can't find the thread where we concluded this), but you would probably never want to instantiate all the classes existing in a package anyway, because there are an infinite number of such classes.

OP, instead of instantiating all classes in a package, how about instantiating all classes located within a specific directory on the local harddrive?

- Oliver

 

Page2Go2.com is not responsible for content of this message.