Class SourceParserKit

java.lang.Object
com.iohao.net.common.kit.source.SourceParserKit

public class SourceParserKit extends Object
Utility for parsing Java source files using the JDK Compiler Tree API. Extracts Javadoc comments, line numbers, annotations, and enum constant arguments.
Author:
渔民小镇
date:
2025-02-27
  • Constructor Details

    • SourceParserKit

      public SourceParserKit()
  • Method Details

    • parseSourceTree

      public Map<String, SourceClass> parseSourceTree(File... roots)
      Parse all .java files under the given roots and return a map of fully qualified class name to SourceClass.
      Parameters:
      roots - source directories or single .java files
      Returns:
      map keyed by fully qualified class name
    • parseClass

      public SourceClass parseClass(String fqcn, File... roots)
      Parse source files and return a single class by fully qualified name.
      Parameters:
      fqcn - fully qualified class name
      roots - source directories or single .java files
      Returns:
      the parsed class, or an empty SourceClass if not found