Loads the given class, respecting the given classloader.
@param clazz class to load
@return Loaded class
@throws ClassNotFoundException
19573
protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
		if (this.classLoader == null){
			return Class.forName(clazz);
		}

		return Class.forName(clazz, true, this.classLoader);

	}
622565
@Override
	public Class<?> loadClass(String className, boolean resolveIt) {
		try {
			return cl.loadClass(className);
		} catch(ClassNotFoundException e) {
			return null;
		}
	}
918763
@SuppressWarnings("unchecked")
    private Class<? extends T> loadClass(ClassLoader classLoader, String generatedName)
            throws ClassNotFoundException {
        return (Class<? extends T>) classLoader.loadClass(generatedName);
    }
410008
public static <T> Class<T> loadClass(String className, ClassLoader classloader) {
        if(className == null) {
            throw new IllegalArgumentException("className cannot be null");
        }

        if(classloader == null) {
            throw new IllegalArgumentException("classloader cannot be null");
        }

        try {
            return (Class<T>) Class.forName(className, false, classloader);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
444904
public static ClassLoader getDefaultClassLoader(Class<?> clazz) {
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		if (classLoader == null) {
			classLoader = clazz.getClassLoader();
		}
		return classLoader;
	}
1039777
public static Class<?> loadClass(String name, boolean init, ClassLoader loader)
    throws ClassNotFoundException
  {
    if (loader == null)
      loader = Thread.currentThread().getContextClassLoader();

    if (loader == null || loader.equals(CauchoUtil.class.getClassLoader()))
      return Class.forName(name);
    else
      return Class.forName(name, init, loader);
  }
661166
public Class<?> getClassByName(String name) throws ClassNotFoundException {
        Map<String, Class<?>> map = CACHE_CLASSES.get(classLoader);
        if (map == null) {
            Map<String, Class<?>> newMap = new ConcurrentHashMap<>();
            map = CACHE_CLASSES.putIfAbsent(classLoader, newMap);
            if (map == null) {
                map = newMap;
            }
        }

        Class clazz = map.get(name);
        if (clazz == null) {
            clazz = Class.forName(name, true, classLoader);
            if (clazz != null) {
                map.put(name, clazz);
            }
        }

        return clazz;
    }
1072175
@SuppressWarnings("rawtypes")
	public static Class loadClass(Class loadClass, String name)
			throws ClassNotFoundException {
		return loadClass(loadClass, name, false);
	}
566315
public Class<?> loadClass(String name) throws ClassNotFoundException {
        while (true) {
            try {
                if (mClassLoader == null) {
                    return Class.forName(name);
                } else {
                    return mClassLoader.loadClass(name);
                }
            } catch (ClassNotFoundException e) {
                int index = name.lastIndexOf('.');
                if (index < 0) {
                    throw e;
                }

                // Search for inner class.
                name = name.substring(0, index) + '$' +
                        name.substring(index + 1);
            }
        }
    }
987215
public static @Nonnull Class<?> _findClass(ClassLoader cl, String name) throws ClassNotFoundException {
        synchronized (getClassLoadingLock(cl, name)) {
            return (Class) invoke(FIND_CLASS, ClassNotFoundException.class, cl, name);
        }
    }
1142840
public static Class loadClass(String className) throws ClassException {
	Set<Throwable> exceptions = new HashSet<Throwable>();
	// OSGI env
	Class clazz = _loadClass(new OSGiBasedClassLoading(), className, null, exceptions);
	if (clazz != null) {
	    return clazz;
	}

	// core classloader
	clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getCoreClassLoader()), className, null, exceptions);
	if (clazz != null) {
	    return clazz;
	}

	// loader classloader
	clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getLoaderClassLoader()), className, null, exceptions);
	if (clazz != null) {
	    return clazz;
	}

	String msg = "cannot load class through its string name, because no definition for the class with the specified name [" + className + "] could be found";
	if (exceptions.size() > 0) {
	    StringBuilder detail = new StringBuilder();
	    Iterator<Throwable> it = exceptions.iterator();
	    Throwable t;
	    while (it.hasNext()) {
		t = it.next();
		detail.append(t.getClass().getName()).append(':').append(t.getMessage()).append(';');
	    }
	    throw new ClassException(msg + " caused by (" + detail.toString() + ")");
	}
	throw new ClassException(msg);
    }
891637
public static synchronized void setLoadFromJar(Class<?> clazz)
    {
        loader = Optional.ofNullable(clazz);
        if (loader.isPresent())
        {
            setSeparator(Constant.SLASH);
        }
        else
        {
            setSeparator(File.separator);
        }
    }
9837
public static <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		return impl.FindClazz( clazz );
	}
485828
@Override
    public void afterClassLoad(Class<?> clazz) {
        super.afterClassLoad(clazz);
        //force <clinit> to be run, while the correct ThreadLocal is set
        //if we do not run this then <clinit> may be run later, perhaps even in
        //another thread
        try {
            Class.forName(clazz.getName(), true, clazz.getClassLoader());
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
1324677
@SuppressWarnings( "unchecked" )
    private <T> Class<T> loadClassIfVisible( String className, ClassLoader classLoader )
    {
        try
        {
            Class<T> klass = (Class<T>) classLoader.loadClass( className );
            return klass;
        }
        catch ( ClassNotFoundException e )
        {
            return null;
        }
    }
28599
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = cls.getClassLoader();
        if (cl == null) {
            cl = getClassLoader();
        }
        return cl;
    }
479627
public static Class<?> loadGenClass(Class<?> cls) throws ClassNotFoundException
    {
        Class<?> parserClass = map.get(cls);
        if (parserClass == null)
        {
            GenClassname genClassname = cls.getAnnotation(GenClassname.class);
            if (genClassname == null)
            {
                throw new IllegalArgumentException("@GenClassname not set in "+cls);
            }
            parserClass = Class.forName(genClassname.value());
            map.put(cls, parserClass);
        }
        return parserClass;
    }