class Noir::TreeSitterJavaDtoIndex

Overview

Builds the DTO field index for a given source file by combining:

  1. in-file class/interface declarations,
  2. every .java in the same directory (same Java package), and
  3. files reachable through the import statements, resolved against a source root inferred from the current file's package ...; declaration.

Each file's extraction is memoised so the per-file loop in spring.cr doesn't re-read and re-parse DTOs over and over when many controllers share the same package.

Defined in:

miniparsers/java_parameter_extractor_ts.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.clear_cache! #

[View source]

Instance Method Detail

def build_for(path : String, content : String) : Index #

Build the DTO index visible to the Spring controller at path. Callers pass content (already read once) to avoid a redundant disk read for the current file. Cross-file traversal is delegated to Noir::ImportGraph so this stays a thin language-specific cache.


[View source]
def build_for_with_root(path : String, content : String, root : LibTreeSitter::TSNode) : Index #

#build_for_with_root(path, content, root) — same as #build_for but uses a pre-parsed root for the current file's extractions (extract_package_name, extract_imports, the current file's extract_class_fields). Sibling files still parse independently — but sibling parses go through the process-wide cache so concurrent analyzers don't double-up.


[View source]