lundi 9 juillet 2018

How to get all subclass from base class in JAVA [duplicate]

This question already has an answer here:

I have a base class such as :

public abstract class BaseClass {

}

and I also have sub classes :

public class SubClassA extends BaseClass{}
public class SubClassB extends BaseClass{}
public class SubClassC extends BaseClass{}

I want to get all sub classes by Base class like below:

List<Class> getSubClassesByBaseClass(BaseClass.class);

How can I do that ?





Aucun commentaire:

Enregistrer un commentaire