package io.github.lukehutch.fastclasspathscanner.scanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;

/**
 * A ClassLoader handler.
 * 
 * Custom ClassLoaderHandlers can be registered by listing their fully-qualified class name in the file:
 * META-INF/services/io.github.lukehutch.fastclasspathscanner.scanner.classloaderhandler.ClassLoaderHandler
 * 
 * However, if you do create a custom ClassLoaderHandler, please consider submitting a patch upstream for
 * incorporation into FastClasspathScanner.
 */
public interface ClassLoaderHandler {
    /**
     * Determine if a given ClassLoader can be handled (meaning that its classpath elements can be extracted from
     * it), and if it can, extract the classpath elements from the ClassLoader and register them with the
     * ClasspathFinder using classpathFinder.addClasspathElement(pathElement) or
     * classpathFinder.addClasspathElements(path).
     * 
     * @param classloader
     *            The ClassLoader class to attempt to handle. You should iterate through its superclass line to
     *            determine if any superclasses can be handled by this ClassLoaderHandler.
     * @param classpathFinder
     *            The ClasspathFinder to register any discovered classpath elements with.
     * @return true if the passed ClassLoader was handled by this ClassLoaderHandler, else false.
     */
    public abstract boolean handle(final ClassLoader classloader, final ClasspathFinder classpathFinder)
            throws Exception;
}

@@ -1048,9 +1048,226 @@
 le. 
-Y
+If you can't directly use instanceof (because you are%0A     *            using introspection so that your ClassLoaderHandler implementation can be added to the upstream%0A     *            FastClasspathScanner project), y
 ou s
@@ -1288,18 +1288,32 @@
 through 
-i
 t
+he ClassLoader'
 s superc
@@ -1321,16 +1321,19 @@
 ass line
+age
  to%0A    
@@ -1350,79 +1350,74 @@
     
-determine if any superclasses can be handled by this ClassLoaderHandler
+ensure subclasses of the target ClassLoader are correctly detected
 .%0A  

Improve comment