#Java Reflection Problem

7 messages · Page 1 of 1 (latest)

stoic forge
#

For context, I'm coming from knowing c#, and I need to know if there is a way to get all classes that implement an abstract class.
I know how to do this in c#, but is there a built-in way to do this for Java?

Sorry if this is a somewhat nooby question, trying to expand my programming to different languages lately.

eternal flareBOT
#

This post has been reserved for your question.

Hey @stoic forge! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

slender ore
#

Hey Mytho, just for some clarification on your question are you saying that in a hypothetical statement lets say we have the classes Dog, Cat, and Bird that all inherit the abstract class Animal. You're wondering if there is a way to get a list of all classes that inherit Animal so in this case it would be [Dog, Cat, Bird]?

#

I don't know of any way to exactly perform that action in native java though but maybe someone has a better solution

stoic forge
#

Yes, your hypothetical is correct.
I would need to get a list of all classes that inherit from ClassName.
I'll look into the library, thanks for the link.