How can I determine whether a Java class is abstract by reflection

Viewed 58376

I am interating through classes in a Jar file and wish to find those which are not abstract. I can solve this by instantiating the classes and trapping InstantiationException but that has a performance hit as some classes have heavy startup. I can't find anything obviously like isAbstract() in the Class.java docs.

3 Answers
Class myClass = myJar.load("classname");
bool test = Modifier.isAbstract(myClass.getModifiers());
Related