Looks up a class by name. In contrast to Class.forName, primitive
classes are found and not found is indicated by null.
@param  name  the name of the Class to be found
@return       the Class found, null if nothing was found
765414
public static Class<?> classFind(String name) {
        try {
            return Class.forName(name);
        } catch (ClassNotFoundException e) {
            return findType(name).type;
        }
    }
968577
public static Class<?> findClass(String className) {
        try {
            return forName(className, getDefaultClassLoader());
        } catch (ClassNotFoundException e) {
            return null;
        }
    }
363447
private static @CheckForNull <T extends Descriptor> T findByClassName(Collection<? extends T> list, String className) {
        for (T d : list) {
            if(d.getClass().getName().equals(className))
                return d;
        }
        return null;
    }
665047
public static Method findMethod (Class<?> clazz, String name)
    {
        Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            if  (method.getName().equals(name)) {
                return method;
            }
        }
        return null;
    }
1268403
public Class getClassByName(String name)
	{

		if (name.indexOf(".") != -1)
		{
			try
			{
				return Class.forName(name,true,gt.getClassLoader());
			}
			catch (ClassNotFoundException e)
			{
				return null;
			}

		}
		else
		{
			Class cls = map.get(name);
			if (cls == null)
			{
				for (String pkg : pkgList)
				{
					try
					{
						String clsName = pkg.concat(name);
						cls = Class.forName(clsName,true,gt.getClassLoader());
						map.put(name, cls);
						return cls;

					}
					catch (Exception ex)
					{
						// continue;
					}
				}
				return null;
			}
			else
			{
				return cls;
			}

		}

	}
752363
public Class findClass(String name) throws ClassNotFoundException {

        if (log.isDebugEnabled())
            log.debug("    findClass(" + name + ")");

        // Cannot load anything from local repositories if class loader is stopped
        if (!started) {
            throw new ClassNotFoundException(name);
        }

        // (1) Permission to define this class when using a SecurityManager
        if (securityManager != null) {
            int i = name.lastIndexOf('.');
            if (i >= 0) {
                try {
                    if (log.isTraceEnabled())
                        log.trace("      securityManager.checkPackageDefinition");
                    securityManager.checkPackageDefinition(name.substring(0,i));
                } catch (Exception se) {
                    if (log.isTraceEnabled())
                        log.trace("      -->Exception-->ClassNotFoundException", se);
                    throw new ClassNotFoundException(name, se);
                }
            }
        }

        // Ask our superclass to locate this class, if possible
        // (throws ClassNotFoundException if it is not found)
        Class clazz = null;
        try {
            if (log.isTraceEnabled())
                log.trace("      findClassInternal(" + name + ")");
            try {
                clazz = findClassInternal(name);
            } catch(ClassNotFoundException cnfe) {
                if (!hasExternalRepositories) {
                    throw cnfe;
                }
            } catch(AccessControlException ace) {
                throw new ClassNotFoundException(name, ace);
            } catch (RuntimeException e) {
                if (log.isTraceEnabled())
                    log.trace("      -->RuntimeException Rethrown", e);
                throw e;
            }
            if ((clazz == null) && hasExternalRepositories) {
                try {
                    clazz = super.findClass(name);
                } catch(AccessControlException ace) {
                    throw new ClassNotFoundException(name, ace);
                } catch (RuntimeException e) {
                    if (log.isTraceEnabled())
                        log.trace("      -->RuntimeException Rethrown", e);
                    throw e;
                }
            }
            if (clazz == null) {
                if (log.isDebugEnabled())
                    log.debug("    --> Returning ClassNotFoundException");
                throw new ClassNotFoundException(name);
            }
        } catch (ClassNotFoundException e) {
            if (log.isTraceEnabled())
                log.trace("    --> Passing on ClassNotFoundException");
            throw e;
        }

        // Return the class we have located
        if (log.isTraceEnabled())
            log.debug("      Returning class " + clazz);
        if (log.isTraceEnabled())
            log.debug("      Loaded by " + clazz.getClassLoader());
        return (clazz);

    }
1009933
public ClassFile find(String className) {
        for (PathEntry pe : list) {
            ClassFile cf = pe.find(className);
            if (cf != null) {
                return cf;
            }
        }
        return null;
    }
237991
public Class<?> lookupType(String name) throws ClassNotFoundException {
        if (name == null) {
            throw new IllegalArgumentException("name must not be null");
        }
        Class<?> type = typeRenames.get(name);
        if (type == null) {
            type = StringConvert.loadType(name);
        }
        return type;
    }
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);
        }
    }
1332552
@Override
	protected Class<?> findClass(final String name) throws ClassNotFoundException {
		log.trace("findClass:" + name);
		Class<?> clazz = findLoadedClass(name);
		if (clazz != null) {
			return clazz;
		}
		return super.findClass(name);
	}
325515
protected Class<?> loadClass(String name, boolean resolve)
        throws ClassNotFoundException
    {
            // First, check if the class has already been loaded
            Class<?> c = findLoadedClass(name);
            if (c == null) {
                try {
                    if (parent != null) {
                        c = parent.loadClass(name, false);
                    } else {
                        c = findBootstrapClassOrNull(name);
                    }
                } catch (ClassNotFoundException e) {
                    // ClassNotFoundException thrown if class not found
                    // from the non-null parent class loader
                }

                if (c == null) {
                    // If still not found, then invoke findClass in order
                    // to find the class.
                    c = findClass(name);
                }
            }
            return c;
    }
776648
public static @CheckForNull <T extends Descriptor> T findByDescribableClassName(Collection<? extends T> list, String className) {
        for (T d : list) {
            if(d.clazz.getName().equals(className))
                return d;
        }
        return null;
    }
3948
public static Class<?> classForNameOrNull(final String className) {
        try {
            return Class.forName(className);
        } catch (final ReflectiveOperationException | LinkageError e) {
            return null;
        }
    }
1169876
protected Class findClass( String name )
        throws ClassNotFoundException
    {
        // Deal with this cast somehow... maybe have this class use
        // ClassManagerImpl type directly.
        // Don't add the method to BshClassManager... it's really an impl thing
        ClassManagerImpl bcm = (ClassManagerImpl)getClassManager();

        // Should we try to load the class ourselves or delegate?
        // look for overlay loader

        ClassLoader cl = bcm.getLoaderForClass( name );

        // If there is a designated loader and it's not us delegate to it
        if ( cl != null && cl != this ) try {
            return cl.loadClass( name );
        } catch ( ClassNotFoundException e ) {
            throw new ClassNotFoundException(
                "Designated loader could not find class: "+e );
        }

        // Let URLClassLoader try any paths it may have
        if ( getURLs().length > 0 ) try {
            return super.findClass(name);
        } catch ( ClassNotFoundException e ) {
            //System.out.println(
            //  "base loader here caught class not found: "+name );
        }


        // If there is a baseLoader and it's not us delegate to it
        cl = bcm.getBaseLoader();

        if ( cl != null && cl != this ) try {
            return cl.loadClass( name );
        } catch ( ClassNotFoundException e ) { }

        // Try system loader
        return bcm.plainClassForName( name );
    }
1310651
public static Class<?> loadClass(String classname) {
        Class<?> c = null;

        // First try a simple Class.forName()
        try { c = Class.forName(classname); } catch (ClassNotFoundException e) { }
        // Didn't work?  Try using this class's classloader.
        if (c == null) {
            try { c = ReflectionUtils.class.getClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { }
        }
        // Still didn't work?  Try the thread's context classloader.
        if (c == null) {
            try { c = Thread.currentThread().getContextClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { }
        }

        return c;
    }
602085
protected Class<?> classForName(String name) throws ClassNotFoundException {
      try {
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        if (contextClassLoader != null) {
          return Class.forName(name, false, contextClassLoader);
        }
      } catch (Throwable e) {
        // ignore
      }
      return Class.forName(name, false, getClass().getClassLoader());
    }
289125
protected Class<?> resolveClass(String name) throws ClassNotFoundException {
        // ClassLoader.loadClass is not guaranteed to support array classes:
        // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4976356
        // ...so we must handle them ourselves.
        if (name.length() > 0 && name.charAt(0) == '[') {
            int numComponents = 0;
            do {
                numComponents++;
                if (numComponents == name.length()) {
                    throw new ClassNotFoundException(name);
                }
            } while (name.charAt(numComponents) == '[');

            if (name.charAt(numComponents) != 'L') {
                // Primitive array class expected.
                return resolveClassWithCL(name);
            }

            if (name.charAt(name.length() - 1) != ';') {
                // Unexpected erroneous class name.
                throw new ClassNotFoundException(name);
            }

            if (name.regionMatches(numComponents + 1, "java.", 0, 5)) {
                // Path for "java." classes.
                return resolveClassWithCL(name);
            }

            // Load the actual class, and then use that class' loader to load
            // the desired array class.
            String className = name.substring(numComponents + 1, name.length() - 1);
            Class<?> klass = loadClass(className);
            return Class.forName(name, false, getClassLoader(klass));
        }

        if (name.startsWith("java.")) {
            // Path for "java." classes.
            return resolveClassWithCL(name);
        }

        return loadClass(name);
    }