@Test public void testLoadClass() { assertNull(ClassUtils.loadClass("A")); assertEquals(A.class, ClassUtils.loadClass(A.class.getName())); }
public static Class<?> loadClass(String className) { if (className == null) { return null; } Class<?> klass = null; ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); if (ctxLoader != null) { try { klass = ctxLoader.loadClass(className); } catch (ClassNotFoundException ex) { LOG.error("Exception while load class: " + className, ex); } } return klass; }
ClassUtils { public static Class<?> loadClass(String className) { if (className == null) { return null; } Class<?> klass = null; ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); if (ctxLoader != null) { try { klass = ctxLoader.loadClass(className); } catch (ClassNotFoundException ex) { LOG.error("Exception while load class: " + className, ex); } } return klass; } }
ClassUtils { public static Class<?> loadClass(String className) { if (className == null) { return null; } Class<?> klass = null; ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); if (ctxLoader != null) { try { klass = ctxLoader.loadClass(className); } catch (ClassNotFoundException ex) { LOG.error("Exception while load class: " + className, ex); } } return klass; } private  ClassUtils(); }
ClassUtils { public static Class<?> loadClass(String className) { if (className == null) { return null; } Class<?> klass = null; ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); if (ctxLoader != null) { try { klass = ctxLoader.loadClass(className); } catch (ClassNotFoundException ex) { LOG.error("Exception while load class: " + className, ex); } } return klass; } private  ClassUtils(); static Class<?> loadClass(String className); static Object instantiate(String className, Object ... args); static Object instantiate(Class klass, Object ... args); static String jarForClass(String className); static String jarForClass(Class klass); static String[] getEnumStrings(Class klass); }
ClassUtils { public static Class<?> loadClass(String className) { if (className == null) { return null; } Class<?> klass = null; ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); if (ctxLoader != null) { try { klass = ctxLoader.loadClass(className); } catch (ClassNotFoundException ex) { LOG.error("Exception while load class: " + className, ex); } } return klass; } private  ClassUtils(); static Class<?> loadClass(String className); static Object instantiate(String className, Object ... args); static Object instantiate(Class klass, Object ... args); static String jarForClass(String className); static String jarForClass(Class klass); static String[] getEnumStrings(Class klass);  }