更新时间:2022-06-11 21:29:22
我会使用 isAssignableFrom
方法来确定 IsWidget
是否为超级接口:
I would use the isAssignableFrom
method to determine if IsWidget
is a superinterface:
return IsWidget.class.isAssignableFrom(clzz);
从上面链接的Javadoc引用:
To quote from the linked Javadoc above:
确定由此Class对象
表示的类或接口是否与指定的
类或接口相同,或是其超类或超接口类参数。
Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.