I'm trying to use reflection to determine whether a passed-in class implements an IsWdidget
interface:
public boolean isAWidget(Class<?> clzz) {
Class<?> runtimeClass = ClassLoader.getSystemClassLoader().loadClass(clzz.getName());
Class<?>[] impls = runtimeClass.getInterfaces();
for(Class<?> clz : impls)
if(clz.getName().equals(IsWidget.class.getName()))
return true;
return false;
}
Is this the best/most effecient way of determining this? I also see a IsWidget.class.isAssignableFrom(Class<?>)
method...