Class ConfigReferenceDependencyScanner

java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.ConfigReferenceDependencyScanner

public class ConfigReferenceDependencyScanner extends Object
Scans config nodes for references and builds a dependency graph.

This scanner walks the tree of a config node and finds all ${...} reference patterns, then adds them as edges in the dependency graph.

  • Constructor Details

    • ConfigReferenceDependencyScanner

      public ConfigReferenceDependencyScanner(@NotNull @NotNull ConfigReferenceParser parser)
      Creates a new scanner.
      Parameters:
      parser - the reference parser
  • Method Details

    • create

      @NotNull public static @NotNull ConfigReferenceDependencyScanner create()
      Creates a scanner with the default parser.
      Returns:
      a new scanner
    • scanDependencies

      @NotNull public @NotNull Set<ReferenceKey> scanDependencies(@NotNull @NotNull ConfigNode node)
      Scans a config node for references and returns the set of dependencies.
      Parameters:
      node - the node to scan
      Returns:
      set of reference keys that this node depends on
    • scanAndAddToGraph

      public void scanAndAddToGraph(@NotNull @NotNull ReferenceKey sourceKey, @NotNull @NotNull ConfigNode node, @NotNull @NotNull DependencyGraph<ReferenceKey> graph)
      Scans a config node and adds edges to the graph.
      Parameters:
      sourceKey - the key of the config being scanned
      node - the node to scan
      graph - the graph to add edges to