Article View: borland.public.jbuilder.java.language
Article #8016Re: Gettging all classes in a package ?
From: Joi Ellis [TeamB]
Date: Thu, 26 Apr 2001 14:24
Date: Thu, 26 Apr 2001 14:24
32 lines
2332 bytes
2332 bytes
Mikael Fransson <mikael.fransson@aspiro.com> wrote: > I think you missed my point... > I'm going to write a class tester for JUnit where the only thing I have is a > package name > and I know that there are a lot of classes with only setters and getters and > ofcorse a constructor. > I have finished the test code for all the setters and getters but now I need > some thing to collect the classes for me. > its not necessary that I get them as Class, if I get the names I can create > the Class object my self. Didn't someone already just announce this support for JUnit? I know there is one that works based on a specified source tree of tests. Keep in mind that when you're querying the JVM, you're seeing only the classes which the JVM itself has loaded. You aren't seeing everything that possibly exists out in the CLASSPATH but which hasn't been used. Anyway, what you need to do is loop through the CLASSPATH looking for directories and jars which contain that package name. You have to look at the disk for directories, and open the jar files yourself. Once you find the package in something, read in its contents. You have to do this for every item in the CLASSPATH because a package can exist in multiple jars and/or directories. -- Joi Ellis (TeamB) No direct email, please. For best results, post on news server newsgroups.borland.com! Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<3ae82f86_1@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews!not-for-mailReferences:
<3ae69dfa$1_2@dnews> <3ae7c298$1_2@dnews> <3ae8066d$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,e2562564d66f3419
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-26 07:48:07 PST
Message-ID: <3ae82f86_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: Gettging all classes in a package ?
Newsgroups: borland.public.jbuilder.java.language
References: <3ae69dfa$1_2@dnews> <3ae7c298$1_2@dnews> <3ae8066d$1_2@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 26 Apr 2001 07:24:06 -0700
X-Trace: dnews 988295046 209.46.41.66 (26 Apr 2001 07:24:06 -0700)
Lines: 32
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews!not-for-mail