Class ClasspathScanner

java.lang.Object
cz.cvut.kbss.jsonld.deserialization.util.ClasspathScanner

public class ClasspathScanner extends Object
Processes classpath accessible to the application and passes all discovered classes to the registered listener.
  • Constructor Details

    • ClasspathScanner

      public ClasspathScanner(Consumer<Class<?>> listener)
  • Method Details

    • processClasses

      public void processClasses(String scanPath)
      Scans classpath accessible from the current thread's class loader.

      All available classes are passed to the registered consumer.

      The scanPath parameter means that only the specified package (and it subpackages) should be searched. This parameter is optional, but it is highly recommended to specify it, as it can speed up the process dramatically.

      Inspired by https://github.com/ddopson/java-class-enumerator

      Parameters:
      scanPath - Package narrowing down the scan space. Optional
    • processJarFile

      protected void processJarFile(URL jarResource, String packageName)