Class ClassScanner

java.lang.Object
com.iohao.net.common.kit.ClassScanner

public class ClassScanner extends Object
Classpath scanner that discovers classes matching a predicate filter.

Supports scanning from both file system directories and JAR archives.

Author:
渔民小镇
date:
2021-12-12
  • Constructor Details

    • ClassScanner

      public ClassScanner(String packagePath, Predicate<Class<?>> predicateFilter)
      Create a scanner for the given package with a class filter.
      Parameters:
      packagePath - the base package to scan (dot-separated, e.g. "com.iohao.net")
      predicateFilter - predicate that returns true for classes to include
  • Method Details

    • listScan

      public List<Class<?>> listScan()
      Scan the classpath and return all classes that match the predicate filter.
      Returns:
      list of matching classes
    • listResource

      public List<URL> listResource() throws IOException
      Return the resource URLs for the configured package path, deduplicated by URI.
      Returns:
      list of unique resource URLs
      Throws:
      IOException - if an I/O error occurs while reading resources