Is there a way programmitcally to tell if a Java class is abstract? (Other than trying to instantiate and catching the error) T开发者_如何学运维hanks!
You can use reflection:
if (Modifier.isAbstract(FooBar.class.getModifiers())) {
// ...
}
Is there a way programmitcally to tell if a Java class is abstract? (Other than trying to instantiate and catching the error) T开发者_如何学运维hanks!
You can use reflection:
if (Modifier.isAbstract(FooBar.class.getModifiers())) {
// ...
}
精彩评论