Class JsonCommand

java.lang.Object
org.egothor.methodatlas.command.JsonCommand
All Implemented Interfaces:
Command

public final class JsonCommand extends Object implements Command
CLI command handler for the -json output mode.

Scans one or more source roots, buffers all discovered test-method records, and serializes the result as a flat JSON array once the scan completes.

The JSON representation differs from CSV in the following ways:

  • tags and ai_tags are JSON arrays, not semicolon-separated strings
  • Numeric fields are JSON numbers; ai_security_relevant is a JSON boolean
  • Optional columns are omitted entirely when the corresponding flag is not enabled (rather than being left blank)
See Also:
  • Constructor Details

    • JsonCommand

      public JsonCommand(CliConfig cliConfig, org.egothor.methodatlas.api.TestDiscoveryConfig discoveryConfig, org.egothor.methodatlas.ai.AiSuggestionEngine aiEngine, org.egothor.methodatlas.emit.ClassificationOverride override, AiResultCache aiCache, PluginLoader pluginLoader, ScanOrchestrator scanOrchestrator)
      Creates a new JSON command.
      Parameters:
      cliConfig - full parsed CLI configuration
      discoveryConfig - discovery configuration forwarded to providers
      aiEngine - AI engine providing suggestions; null when AI is disabled
      override - human classification overrides
      aiCache - AI result cache
      pluginLoader - loader used to resolve and close TestDiscovery providers
      scanOrchestrator - scan-and-emit orchestrator used to process each root with the per-record sink
  • Method Details

    • execute

      public int execute(PrintWriter out) throws IOException
      Scans all roots and emits the buffered result as a JSON array.
      Specified by:
      execute in interface Command
      Parameters:
      out - writer that receives the JSON output
      Returns:
      0 if all files were processed successfully, 1 if any file produced a parse or processing error
      Throws:
      IOException - if traversing a file tree fails