Accessing every child class of parent class in Java
Posted
by darkie15
on Stack Overflow
See other posts from Stack Overflow
or by darkie15
Published on 2010-04-23T00:00:15Z
Indexed on
2010/04/23
0:03 UTC
Read the original article
Hit count: 272
Hi All,
I have to implement a logic whereby given a child class, I need to access its parent class and all other child class of that parent class, if any. I did not find any API in Java Reflection which allows us to access all child classes of a parent class. Is there any way to do it?
Ex. class B extends class A class C extends class A
Now using class B, I can find the superclass by calling getSuperClass(). But is there any way to find all the child classes once I have the parent class i.e. class B and class C??
Regards, darkie
© Stack Overflow or respective owner