List of utility methods to do Class Load
Class> | loadClass(ClassLoader classLoader, Class> clazz, String postfix) load Class String className = clazz.getName(); try { return Class.forName(className.concat(postfix), false, classLoader); } catch (ClassNotFoundException cnfe) { return null; |
Class | loadClass(ClassLoader classLoader, String className) load Class try { return classLoader.loadClass(className); } catch (NoClassDefFoundError e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); |
Class> | loadClass(ClassLoader classLoader, String className) Load class with given className over given classLoader and suppress ClassNotFoundException .
try { return load(classLoader, className); } catch (ClassNotFoundException e) { return null; |
Class> | loadClass(ClassLoader classLoader, String fullyQualifiedClassName) Load a class. try { return classLoader.loadClass(fullyQualifiedClassName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); |
Class> | loadClass(ClassLoader loader, String className) load Class try { return loader.loadClass(className); } catch (ClassNotFoundException e) { return loadClass(className); |
Class> | loadClass(ClassLoader loader, String className, String errorMessage) load Class Class clazz; try { clazz = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new ClassNotFoundException(errorMessage, e); return clazz; |
Class> | loadClass(final ClassLoader cl, final String cname) load Class try { return cl.loadClass(cname); } catch (Exception x) { return null; |
Class> | loadClass(final ClassLoader classLoader, final String classname) Loads a class with a given name. Class<?> classToLoad = null; if (classLoader == null) { classToLoad = Class.forName(classname); } else { classToLoad = classLoader.loadClass(classname); return classToLoad; |
Class> | loadClass(final String className) Load class, if found on the classpath. try { return getThreadClassLoader().loadClass(className); } catch (final Exception ignored) { } catch (final NoClassDefFoundError ignored) { return null; |
Class | loadClass(final String className) Attempts to create a class from a String. try { return (Class<T>) Class.forName(className); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(className + " class not found."); |