Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

finding derived classes from base class

Thread view: 
sakcee@gmail.com - 25 Jul 2007 06:25 GMT
I am trying to find a way to find all the derived classes , given a
parent class, off a source folder or package.
I dont want to load the classes , one way is to have one pass through
code and build a tree with object at root etc

any ideas are appreciated
Roedy Green - 25 Jul 2007 07:06 GMT
On Tue, 24 Jul 2007 22:25:59 -0700, "sakcee@gmail.com"
<sakcee@gmail.com> wrote, quoted or indirectly quoted someone who said

>I am trying to find a way to find all the derived classes , given a
>parent class, off a source folder or package.
>I dont want to load the classes , one way is to have one pass through
>code and build a tree with object at root etc

You can read up on the class file format and load the bytes with nio
and have a look.  See http://mindprod.com/jgloss/javaclassformat.html

There are also various libraries for manipulating class file byte
codes.
See http://mindprod.com/jgloss/jasm.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrew Thompson - 25 Jul 2007 07:14 GMT
>I am trying to find a way to find all the derived classes , given a
>parent class, off a source folder or package.

Why?

>I dont want to load the classes , one way is to have one pass through
>code and build a tree with object at root etc
>
>any ideas are appreciated

Ask a specific question.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

sakcee@gmail.com - 25 Jul 2007 08:34 GMT
we have many classes that define static values, we want to load them
by class names and with hierarchies.

I am just looking for a way, any way, of finding all derived classes
given a parent

> sak...@gmail.com wrote:
> >I am trying to find a way to find all the derived classes , given a
[quoted text clipped - 13 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1
voorth - 25 Jul 2007 09:01 GMT
On Jul 25, 9:34 am, "sak...@gmail.com" <sak...@gmail.com> wrote:
> we have many classes that define static values, we want to load them
> by class names and with hierarchies.
>
> I am just looking for a way, any way, of finding all derived classes
> given a parent

In the Eclipse IDE, there is a "Type Hierarchy" view. It gives you a
way to navigate the entire inheritance tree.

Henk
Lew - 25 Jul 2007 15:16 GMT
"sakcee@gmail.com" wrote:
>> I am just looking for a way, any way, of finding all derived classes
>> given a parent

This is a stronger requirement than you first stated:
> I am trying to find a way to find all the derived classes , given a
> parent class, off a source folder or package.

There is no way in general to find /all/ derived classes - it's an unbounded
set over time.  It should be possible to find all the derived classes in a
specific source folder (or other resource) at a given moment in time, though.

Eclipse (as voorth stated) and Netbeans both have code to do show class
hierarchies, and they are open source.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.