@Test public void forName3() throws Exception { Class clazz = ClassUtils.forName("java.lang.String", Thread.currentThread().getContextClassLoader()); Assert.assertEquals(clazz, String.class); boolean error = false; try { ClassUtils.forName("asdasdasdsad", Thread.currentThread().getContextClassLoader()); } catch (Exception e) { error = true; } Assert.assertTrue(error); }
public static Class forName(String className) { return forName(className, true); }
ClassUtils { public static Class forName(String className) { return forName(className, true); } }
ClassUtils { public static Class forName(String className) { return forName(className, true); }  }
ClassUtils { public static Class forName(String className) { return forName(className, true); }  static Class forName(String className); static Class forName(String className, boolean initialize); static Class forName(String className, ClassLoader cl); static List<Method> getAllMethods(Class clazz); static List<Field> getAllFields(Class clazz); static T newInstance(Class<T> clazz); static T newInstanceWithArgs(Class<T> clazz, Class<?>[] argTypes, Object[] args); static Object getDefaultPrimitiveValue(Class clazz); static T getDefaultWrapperValue(Class<T> clazz); static String getMethodKey(String interfaceName, String methodName); static boolean isAssignableFrom(Class<?> interfaceClass, Class<?> implementClass); }
ClassUtils { public static Class forName(String className) { return forName(className, true); }  static Class forName(String className); static Class forName(String className, boolean initialize); static Class forName(String className, ClassLoader cl); static List<Method> getAllMethods(Class clazz); static List<Field> getAllFields(Class clazz); static T newInstance(Class<T> clazz); static T newInstanceWithArgs(Class<T> clazz, Class<?>[] argTypes, Object[] args); static Object getDefaultPrimitiveValue(Class clazz); static T getDefaultWrapperValue(Class<T> clazz); static String getMethodKey(String interfaceName, String methodName); static boolean isAssignableFrom(Class<?> interfaceClass, Class<?> implementClass);  }