Class JavaSources

java.lang.Object
uno.anahata.ai.nb.tools.JavaSources

public class JavaSources extends Object
Provides tools for retrieving Java source code.
Author:
Anahata
  • Constructor Details

    • JavaSources

      public JavaSources()
  • Method Details

    • getSource

      public static SourceFileInfo getSource(String fqn, Integer startLine, Integer lineCount, Integer maxLineLength) throws Exception
      Gets rich, contextual information about a Java source file, including its origin (project, JAR, or JDK) and its content, with support for safe pagination. This is the primary tool for reading source code.
      Parameters:
      fqn - The fully qualified name of the class.
      startLine - The starting line number (1-based).
      lineCount - The number of lines to return.
      maxLineLength - The maximum length of each line.
      Returns:
      a SourceFileInfo object containing the source code and metadata.
      Throws:
      Exception - if the source cannot be found or read.