这个不应该用泛型 public boolean isInterface(Class<?> c, String szInterface) throws Exception { if (c == null) throw new NullPointerException("Class<?> 'c' is null."); if (szInterface == null) throw new NullPointerException("String 'szInterface' is null."); Class<?> interfaceType = Class.forName(szInterface); if (!interfaceType.isInterface()) throw new IllegalArgumentException("Type '" + szInterface + "' is not an interface type."); return interfaceType.isAssignableFrom(c); } 方法名有点怪
public boolean isInterface(Class<?> c, String szInterface) throws Exception { if (c == null)
throw new NullPointerException("Class<?> 'c' is null."); if (szInterface == null)
throw new NullPointerException("String 'szInterface' is null."); Class<?> interfaceType = Class.forName(szInterface);
if (!interfaceType.isInterface())
throw new IllegalArgumentException("Type '" + szInterface + "' is not an interface type."); return interfaceType.isAssignableFrom(c);
}
方法名有点怪