Class ReflectionsClassFinder

java.lang.Object
com.vaadin.flow.server.scanner.ReflectionsClassFinder
All Implemented Interfaces:
com.vaadin.flow.server.frontend.scanner.ClassFinder, Serializable

public class ReflectionsClassFinder extends Object implements com.vaadin.flow.server.frontend.scanner.ClassFinder
A class finder using io.github.classgraph.

This implementation uses the ClassGraph library for fast classpath scanning. ClassGraph parses bytecode directly without loading classes, making it significantly faster than reflection-based approaches.

Note: Despite the class name, this implementation uses ClassGraph library, not the org.reflections library. The class name is maintained for backward compatibility.

Since:
2.0
See Also:
  • Field Details

    • DISABLE_DEFAULT_PACKAGE_FILTER

      public static final String DISABLE_DEFAULT_PACKAGE_FILTER
      System property name to be used to disable default package filtering during class scan. See applyScannerPackageFilters(ClassGraph) and DEFAULT_REJECTED_PACKAGES
      See Also:
  • Constructor Details

    • ReflectionsClassFinder

      public ReflectionsClassFinder(URL... urls)
      Constructor.
      Parameters:
      urls - the list of urls for finding classes.
    • ReflectionsClassFinder

      public ReflectionsClassFinder(ClassLoader classLoader, URL... urls)
      Constructor with explicit class loader.
      Parameters:
      classLoader - the class loader to use for loading classes
      urls - the list of urls for finding classes
  • Method Details

    • getAnnotatedClasses

      public Set<Class<?>> getAnnotatedClasses(Class<? extends Annotation> clazz)
      Specified by:
      getAnnotatedClasses in interface com.vaadin.flow.server.frontend.scanner.ClassFinder
    • getResource

      public URL getResource(String name)
      Specified by:
      getResource in interface com.vaadin.flow.server.frontend.scanner.ClassFinder
    • shouldInspectClass

      public boolean shouldInspectClass(String className)
      Specified by:
      shouldInspectClass in interface com.vaadin.flow.server.frontend.scanner.ClassFinder
    • loadClass

      public <T> Class<T> loadClass(String name) throws ClassNotFoundException
      Specified by:
      loadClass in interface com.vaadin.flow.server.frontend.scanner.ClassFinder
      Throws:
      ClassNotFoundException
    • getSubTypesOf

      public <T> Set<Class<? extends T>> getSubTypesOf(Class<T> type)
      Specified by:
      getSubTypesOf in interface com.vaadin.flow.server.frontend.scanner.ClassFinder
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface com.vaadin.flow.server.frontend.scanner.ClassFinder