permaculture playing cards
The moose likes Java in General and the fly likes getting names of child classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting names of child classes" Watch "getting names of child classes" New topic

getting names of child classes

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
Hi All,

Given just the parent class name, is there a way to get the list of child classes?

Paul Clapham

Joined: Oct 14, 2005
Posts: 19896

Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Not in the general case, no. In some limited contexts you could, but unless you're writing an IDE or profiler or something, it's not likely you actually need to do so.

If you can explain what you're trying to accomplish, why you want the child classes, somebody may be able to suggest a better approach to solving your problem.
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
In Eclipse Package Explorer, select the Java file and press F4 or right-click and select Open Type Hierarchy.

If you have the source open in the editor you can also highlight the class name and press F4.
I agree. Here's the link:
subject: getting names of child classes
It's not a secret anymore!