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

It’ll have abstract as one of its modifiers when you call getModifiers() on the class object.

This link should help.

 Modifier.isAbstract( someClass.getModifiers() );

Also:

http://java.sun.com/javase/6/docs/api/java/lang/reflect/Modifier.html

http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getModifiers()

Leave a Comment