Class JavaDocs

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

public class JavaDocs extends Object
Provides tools for retrieving Javadoc and source information for classes and methods.
Author:
Anahata
  • Constructor Details

    • JavaDocs

      public JavaDocs()
  • Method Details

    • getJavadocUrlForClass

      public static String getJavadocUrlForClass(String fqn) throws Exception
      Gets the Javadoc URL for a given fully qualified class name by searching all open projects and their dependencies.
      Parameters:
      fqn - The fully qualified class name (e.g., 'java.lang.String')
      Returns:
      A string containing the found Javadoc roots or a message if none were found.
      Throws:
      Exception - if an error occurs during the search.
    • getJavadocForType

      public static TextChunk getJavadocForType(String fqn, Integer startIndex, Integer pageSize, String grepPattern, Integer maxLineLength) throws Exception
      Gets the Javadoc comment for a specific type (class, interface, enum, inner class) from its source file.
      Parameters:
      fqn - The fully qualified name of the type.
      startIndex - The starting line number (0-based) for pagination.
      pageSize - The number of lines to return.
      grepPattern - A regex pattern to filter lines.
      maxLineLength - The maximum length of each line.
      Returns:
      a TextChunk containing the processed Javadoc.
      Throws:
      Exception - if an error occurs.
    • getJavadocForMethod

      public static TextChunk getJavadocForMethod(String fqn, String methodName, Integer startIndex, Integer pageSize, String grepPattern, Integer maxLineLength) throws Exception
      Gets the Javadoc comment for a specific method from its source file.
      Parameters:
      fqn - The fully qualified class name.
      methodName - The name of the method.
      startIndex - The starting line number (0-based) for pagination.
      pageSize - The number of lines to return.
      grepPattern - A regex pattern to filter lines.
      maxLineLength - The maximum length of each line.
      Returns:
      a TextChunk containing the processed Javadoc.
      Throws:
      Exception - if an error occurs.