Suppose I have a class:
public final class Foo
and a reflected Class clz
reference that refers to that class.
How can I tell (using clz
) that Foo
is final
?
You use Class.getModifiers()
, ideally using the Modifier
class to interpret the return value in a readable way:
if (Modifier.isFinal(clz.getModifiers())
See more on this question at Stackoverflow