For Programmers: Free Programming Magazines  


Home > Archive > Java Help > May 2004 > How to determine inheritance hierarchy of a class???









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to determine inheritance hierarchy of a class???
D. Beckham

2004-05-23, 6:35 am

I am trying to write a method that take a Class object as param and then
determines all the classes in the Class object's inheritance hierarchy. Can
somebody give me a pointer to get started? Thanks


Andrew Thompson

2004-05-23, 6:35 am

On Sun, 23 May 2004 09:35:50 GMT, D. Beckham wrote:

> I am trying to write a method that take a Class object as param and then
> determines all the classes in the Class object's inheritance hierarchy. Can
> somebody give me a pointer to get started?


<http://www.physci.org/api.jsp?class=java.lang.Class>

Especially Class.getSuperclass()

HTH

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Roedy Green

2004-05-23, 12:32 pm

On Sun, 23 May 2004 09:35:50 GMT, "D. Beckham"
<lekhanh88@earthlink.net> wrote or quoted :

>I am trying to write a method that take a Class object as param and then
>determines all the classes in the Class object's inheritance hierarchy. Can
>somebody give me a pointer to get started? Thanks


see http://mindprod.com/jgloss/classforname.html

There are tools to get he parent of a class. You chase it on up till
you get to object.

Look at the methods of the Class object. This does not require
reflection.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com