Class JavaIntrospection

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

public class JavaIntrospection extends Object
Provides robust, API-driven tools for Java type introspection, similar to the NetBeans Navigator. This tool uses the proper NetBeans Java Source APIs to avoid brittle text parsing.
Author:
Anahata
  • Constructor Details

    • JavaIntrospection

      public JavaIntrospection()
  • Method Details

    • getTypeInfo

      public static TypeInfo getTypeInfo(String fqn)
      Gets detailed information about a single, specific Java type.
      Parameters:
      fqn - The fully qualified name of the type to inspect.
      Returns:
      a TypeInfo object containing the type's details.
    • getMembers

      public static MemberSearchResultPage getMembers(String fqn, Integer startIndex, Integer pageSize) throws Exception
      Gets a paginated list of all members (fields, constructors, methods, inner classes) for a given type.
      Parameters:
      fqn - The fully qualified name of the type to inspect.
      startIndex - The starting index (0-based) for pagination.
      pageSize - The maximum number of results to return per page.
      Returns:
      a MemberSearchResultPage containing the members.
      Throws:
      Exception - if an error occurs.
    • findSubpackages

      public static PackageSearchResultPage findSubpackages(String parentPackage, boolean recursive, Integer startIndex, Integer pageSize)
      Finds all subpackages within a given parent package.
      Parameters:
      parentPackage - The fully qualified name of the parent package.
      recursive - If true, the search will be recursive.
      startIndex - The starting index (0-based) for pagination.
      pageSize - The maximum number of results to return per page.
      Returns:
      a PackageSearchResultPage containing the subpackages.
    • findTypesInPackage

      public static TypeSearchResultPage findTypesInPackage(String packageName, TypeKind typeKind, boolean recursive, Integer startIndex, Integer pageSize)
      Finds all types within a given package, with an option for recursive search.
      Parameters:
      packageName - The fully qualified name of the package to search.
      typeKind - The kind of type to search for.
      recursive - If true, the search will include all subpackages.
      startIndex - The starting index (0-based) for pagination.
      pageSize - The maximum number of results to return per page.
      Returns:
      a TypeSearchResultPage containing the found types.
    • searchTypesByName

      public static TypeSearchResultPage searchTypesByName(String simpleNameQuery, TypeKind typeKind, boolean caseSensitive, boolean preferOpenProjects, Integer startIndex, Integer pageSize)
      Searches for types across all classpaths by simple name.
      Parameters:
      simpleNameQuery - The simple name query.
      typeKind - The kind of type to search for.
      caseSensitive - If true, the search will be case-sensitive.
      preferOpenProjects - If true, results from open projects will be listed first.
      startIndex - The starting index (0-based) for pagination.
      pageSize - The maximum number of results to return per page.
      Returns:
      a TypeSearchResultPage containing the found types.