Scans a collection of resources.

@param classes the resource to scan
@return itself
322116
ResourceScanner scan(final Collection<Class<?>> classes) {
        for (Class<?> aClass : classes) {
            collectHttpMethodsWithRel(aClass);
        }
        buildJsonHomeResources();
        buildHalLink();
        return this;
    }
301030
public ScanningModuleBuilder excludeClasses(Set<Class<?>> classes) {
        final Set<Class<?>> toTest = new HashSet<>(classes);
        return excludeClassesWhen(cls -> toTest.contains(cls));
    }
744413
public Resources interpret(final Set<ClassResult> classResults) {
        resources = new Resources();
        resources.setBasePath(PathNormalizer.getApplicationPath(classResults));

        javaTypeAnalyzer = new JavaTypeAnalyzer(resources.getTypeRepresentations());
        dynamicTypeAnalyzer = new DynamicTypeAnalyzer(resources.getTypeRepresentations());
        stringParameterResolver = new StringParameterResolver(resources.getTypeRepresentations(), javaTypeAnalyzer);

        classResults.stream().filter(c -> c.getResourcePath() != null).forEach(this::interpretClassResult);
        resources.consolidateMultiplePaths();

        return resources;
    }
220313
public void addClasses(Set<Class<?>> classes) {
        for (Class<?> classToAdd: classes) {
            localClassCache.put(classToAdd.getName(), classToAdd);
        }
    }
407518
public void scanJars() throws IOException {

        ClassLoader webappLoader = Thread.currentThread().getContextClassLoader();

        ClassLoader parentLoader = webappLoader.getParent();

        ResourceDelegatingBundleClassLoader classLoader = null;
        if (webappLoader instanceof ResourceDelegatingBundleClassLoader) {
            classLoader = (ResourceDelegatingBundleClassLoader) webappLoader;
        } else if (parentLoader instanceof ResourceDelegatingBundleClassLoader) {
            classLoader = (ResourceDelegatingBundleClassLoader) parentLoader;
        } else if (isTomcatWebLoader()) {
            ClassLoader parent = ((org.apache.catalina.loader.WebappClassLoader) webappLoader).getParent();
            if (parent instanceof ResourceDelegatingBundleClassLoader) {
                classLoader = (ResourceDelegatingBundleClassLoader) parent;
            }
        }

        List<Bundle> bundles = classLoader == null ? Collections.<Bundle>emptyList() : classLoader.getBundles();
        for (Bundle bundle : bundles) {
            Collection<Enumeration<URL>> enumerations;
            BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
            if (bundleWiring == null) {
                Enumeration<URL> urls = bundle.findEntries("META-INF", "*.tld", true);
                enumerations = Collections.singleton(urls);
            } else {
                Collection<String> resources = bundleWiring.listResources("META-INF", "*.tld",
                        BundleWiring.LISTRESOURCES_RECURSE);
                enumerations = new ArrayList<>(resources.size());
                for (String resource : resources) {
                    Enumeration<URL> urls = bundle.getResources(resource);
                    enumerations.add(urls);
                }
            }
            for (Enumeration<URL> urls : enumerations) {
                if (urls != null) {
                    while (urls.hasMoreElements()) {
                        URL url = urls.nextElement();
                        LOG.info("found TLD {}", url);
                        TldResourcePath tldResourcePath = new TldResourcePath(url, null, null);
                        try {
                            parseTld(tldResourcePath);
                        } catch (SAXException e) {
                            throw new IOException(e);
                        }
                    }
                }
            }
        }
    }
270189
public void scan(List<? extends JCTree> trees) {
        if (trees != null)
        for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
            scan(l.head);
    }


/* ***************************************************************************
 * Visitor methods
 ****************************************************************************/

    public void visitTopLevel(JCCompilationUnit tree) {
        scan(tree.packageAnnotations);
        scan(tree.pid);
        scan(tree.defs);
    }

    public void visitImport(JCImport tree) {
        scan(tree.qualid);
    }

    public void visitClassDef(JCClassDecl tree) {
        scan(tree.mods);
        scan(tree.typarams);
        scan(tree.extending);
        scan(tree.implementing);
        scan(tree.defs);
    }

    public void visitMethodDef(JCMethodDecl tree) {
        scan(tree.mods);
        scan(tree.restype);
        scan(tree.typarams);
        scan(tree.recvparam);
        scan(tree.params);
        scan(tree.thrown);
        scan(tree.defaultValue);
        scan(tree.body);
    }

    public void visitVarDef(JCVariableDecl tree) {
        scan(tree.mods);
        scan(tree.vartype);
        scan(tree.nameexpr);
        scan(tree.init);
    }

    public void visitSkip(JCSkip tree) {
    }
1031460
public ClassInfoList getAllClasses() {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        if (!scanSpec.enableClassInfo) {
            throw new IllegalArgumentException("Please call ClassGraph#enableClassInfo() before #scan()");
        }
        return ClassInfo.getAllClasses(classNameToClassInfo.values(), scanSpec);
    }
288937
public ObjectGraph excludeClasses(Class<?>... classes) {
    for (Class<?> c : classes) {
      if (c == null) {
        throw new NullPointerException("Null class not allowed");
      }
      excludedClasses.add(c);
    }
    return this;
  }
258990
private void initScriptClasses(Set<Class<?>> classes)throws Exception
	{
		Set<Class<? extends S>> scriptClass=findScriptClass(classes);
		Set<Class<? extends S>> instanceAbleScript = findInstanceAbleScript(scriptClass);
		Map<String, Class<? extends S>> nameMap_ = new HashMap<String, Class<? extends S>>();
		Map<Integer, Class<? extends S>> idMap_ = new HashMap<Integer, Class<? extends S>>();
		for(Class<? extends S> clazz:instanceAbleScript)
		{
			registScript(clazz, nameMap_, idMap_);
		}
		this.idMap.clear();
		this.nameMap.clear();
		this.idMap.putAll(idMap_);
		this.nameMap.putAll(nameMap_);
		_log.info("loadScriptClass complete,id mapping size:"+idMap.size()+",name mapping size:"+nameMap.size());
	}
147912
public <T> Collection<T> collectAll(InputStream inputStream, Class<T> tClass, JsonPath... paths) {
        CollectAllListener<T> listener = new CollectAllListener<T>(jsonProvider, tClass);
        SurfingConfiguration.Builder builder = configBuilder();
        for (JsonPath jsonPath : paths) {
            builder.bind(jsonPath, listener);
        }
        surf(inputStream, builder.build());
        return listener.getCollection();
    }
1353363
public static final void indexAllClasses(final Indexer indexer, final List<File> classFiles) {
        classFiles.forEach(file -> {
            try {
                final InputStream in = new FileInputStream(file);
                try {
                    indexer.index(in);
                } finally {
                    in.close();
                }
            } catch (final IOException ex) {
                throw new RuntimeException(ex);
            }
        });
    }
202804
private static <T> Collection<String> loadClasses(final ClassLoader classLoader, final Class<? extends T> service) {
		String name = SERVICE_PREFIX + service.getName();
		Enumeration<URL> urls;
		try {
			urls = classLoader.getResources(name);
		} catch (IOException ex) {
			InternalLogger.log(Level.ERROR, "Failed loading services from '" + name + "'");
			return Collections.emptyList();
		}

		Collection<String> classes = new ArrayList<String>();

		while (urls.hasMoreElements()) {
			URL url = urls.nextElement();
			BufferedReader reader = null;

			try {
				reader = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
				for (String line = reader.readLine(); line != null; line = reader.readLine()) {
					line = line.trim();
					if (line.length() > 0 && line.charAt(0) != '#' && !classes.contains(line)) {
						classes.add(line);
					}
				}
			} catch (IOException ex) {
				InternalLogger.log(Level.ERROR, "Failed reading service resource '" + url + "'");
			} finally {
				if (reader != null) {
					try {
						reader.close();
					} catch (IOException ex) {
						// Ignore
					}
				}
			}
		}

		return classes;
	}
840467
public static void read(Swagger swagger, Set<Class<?>> classes) {
        final SwaggerAnnotationsReader reader = new SwaggerAnnotationsReader(swagger);
        for (Class<?> cls : classes) {
            final ReaderContext context = new ReaderContext(swagger, cls, "", null, false, new ArrayList<>(),
                    new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
            reader.read(context);
        }
    }
1307845
public static List<Class<?>> makeArrayClasses(List<Class<?>> classes, int dims)
    {
        Iterator<Class<?>> i = classes.iterator();
        LinkedList<Class<?>> arrayClasses = new LinkedList<Class<?>>();
        while(i.hasNext())
            arrayClasses.add(makeArrayClass(i.next(), dims));
        return arrayClasses;
    }
55120
public void scan(JavaBackend javaBackend, List<URI> gluePaths) {
        for (URI gluePath : gluePaths) {
            for (Class<?> glueCodeClass : classFinder.getDescendants(Object.class, gluePath)) {
                while (glueCodeClass != null && glueCodeClass != Object.class && !Utils.isInstantiable(glueCodeClass)) {
                    // those can't be instantiated without container class present.
                    glueCodeClass = glueCodeClass.getSuperclass();
                }
                //prevent unnecessary checking of Object methods
                if (glueCodeClass != null && glueCodeClass != Object.class) {
                    for (Method method : glueCodeClass.getMethods()) {
                        if (method.getDeclaringClass() != Object.class) {
                            scan(javaBackend, method, glueCodeClass);
                        }
                    }
                }
            }
        }
    }
1062258
@Override
    public void scan(ClassSource_Aggregate classSource, Set<String> specificClassNames) throws AnnotationTargets_Exception {
        try {
            createScanner(classSource).scan(specificClassNames);
            // 'createScanner' throws class source exception

        } finally {
            haveScannedDirectClasses = true;
            haveScannedReferencedClasses = true;
        }
    }
1009623
public @Nonnull Micronaut classes(@Nullable Class... classes) {
        if (classes != null) {
            for (Class aClass : classes) {
                packages(aClass.getPackage().getName());
            }
        }
        return this;
    }