clazz.isAssignableFrom(Foo.class)
will be true whenever the class represented by the clazz
object is a superclass or superinterface of Foo
.
clazz.isInstance(obj)
will be true whenever the object obj
is an instance of the class clazz
.
That is:
clazz.isAssignableFrom(obj.getClass()) == clazz.isInstance(obj)
is always true so long as clazz
and obj
are nonnull.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…