public static <T> Class<? extends T> loadClass(String className, Class<?> callingClass, Class<T> type) throws ClassNotFoundException { try { ClassLoader cl = getContextClassLoader(); if (cl != null) { return cl.loadClass(className).asSubclass(type); } } catch (ClassNotFoundException e) { //ignore } return loadClass2(className, callingClass).asSubclass(type); } private static Class<?> loadClass2(String className, Class<?> callingClass)
public static <T> Class<? extends T> loadClass(String className, Class<?> callingClass, Class<T> type) throws ClassNotFoundException { try { ClassLoader cl = getContextClassLoader(); if (cl != null) { return cl.loadClass(className).asSubclass(type); } } catch (ClassNotFoundException e) { //ignore } return loadClass2(className, callingClass).asSubclass(type); } private static Class<?> loadClass2(String className, Class<?> callingClass)
/** * Load a class with a given name. <p/> It will try to load the class in the * following order: * <ul> * <li>From Thread.currentThread().getContextClassLoader() * <li>Using the basic Class.forName() * <li>From ClassLoaderUtil.class.getClassLoader() * <li>From the callingClass.getClassLoader() * </ul> * * @param className The name of the class to load * @param callingClass The Class object of the calling object * @throws ClassNotFoundException If the class cannot be found anywhere. */ public static Class<?> loadClass(String className, Class<?> callingClass) throws ClassNotFoundException { try { ClassLoader cl = getContextClassLoader(); if (cl != null) { return cl.loadClass(className); } } catch (ClassNotFoundException e) { //ignore } return loadClass2(className, callingClass); } public static <T> Class<? extends T> loadClass(String className, Class<?> callingClass, Class<T> type)
/** * Load a class with a given name. <p/> It will try to load the class in the * following order: * <ul> * <li>From Thread.currentThread().getContextClassLoader() * <li>Using the basic Class.forName() * <li>From ClassLoaderUtil.class.getClassLoader() * <li>From the callingClass.getClassLoader() * </ul> * * @param className The name of the class to load * @param callingClass The Class object of the calling object * @throws ClassNotFoundException If the class cannot be found anywhere. */ public static Class<?> loadClass(String className, Class<?> callingClass) throws ClassNotFoundException { try { ClassLoader cl = getContextClassLoader(); if (cl != null) { return cl.loadClass(className); } } catch (ClassNotFoundException e) { //ignore } return loadClass2(className, callingClass); } public static <T> Class<? extends T> loadClass(String className, Class<?> callingClass, Class<T> type)
URL url = getContextClassLoader().getResource(resourceName); if (url == null && resourceName.startsWith("/")) { url = getContextClassLoader().getResource(resourceName.substring(1));
URL url = getContextClassLoader().getResource(resourceName); if (url == null && resourceName.startsWith("/")) { url = getContextClassLoader().getResource(resourceName.substring(1));
urls = getContextClassLoader().getResources(resourceName); } catch (IOException e) { urls = getContextClassLoader().getResources(resourceName.substring(1)); } catch (IOException e) {
urls = getContextClassLoader().getResources(resourceName); } catch (IOException e) { urls = getContextClassLoader().getResources(resourceName.substring(1)); } catch (IOException e) {