mardi 10 mars 2020

How to check a specific class type exists in the inheritance chain

I got a class which is implemented in the decorator pattern, I need to check whether a specific class appear in the inheritance chain. Normally, I would just use instance of.

However, I don't have the class definition during dev time. In other words, I get the the class name (String) in run time. In this situation, how could I check this given class name appear in the inheritance chain?

Thanks.





Aucun commentaire:

Enregistrer un commentaire