Last active
February 13, 2016 00:37
-
-
Save joubin/40e361a174af84219262 to your computer and use it in GitHub Desktop.
Get all supers to an object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static List<String> GetClasses(Class cls) throws ClassNotFoundException { | |
| List<String> clsList = new ArrayList<>(); | |
| String name; | |
| while (!(name = cls.getGenericSuperclass().getTypeName()).equals("java.lang.Object")){ | |
| clsList.add(name); | |
| cls = Class.forName(name); | |
| } | |
| return clsList; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment