Class BindingGraphTrait

java.lang.Object
build.codemodel.dependency.injection.BindingGraphTrait
All Implemented Interfaces:
build.codemodel.foundation.descriptor.Trait

public final class BindingGraphTrait extends Object implements build.codemodel.foundation.descriptor.Trait
A Trait on JDKCodeModel that holds the binding graph for an InjectionContext. Attached to the framework's JDKCodeModel by Context.snapshot(Path) and readable by WiringReportCompiler.

Instances are produced by BindingGraphContributor.buildTrait() and are immutable once constructed — the graph is a snapshot of the bindings registered at the time Context.snapshot(Path) was called.

Since:
Apr-2026
Author:
reed.vonredwitz
See Also:
  • Method Details

    • bindings

      public Stream<BindingNode> bindings()
      Returns all registered BindingNodes in this graph.
      Returns:
      a stream of all binding nodes
    • dependenciesOf

      public Stream<BindingNode> dependenciesOf(BindingNode node)
      Returns the BindingNodes that the given node directly depends on (its successors in the directed graph — the dependencies it requires).
      Parameters:
      node - the node to query
      Returns:
      a stream of direct dependencies
    • dependentsOf

      public Stream<BindingNode> dependentsOf(BindingNode node)
      Returns the BindingNodes that directly depend on the given node (its predecessors in the directed graph — the bindings that require it).
      Parameters:
      node - the node to query
      Returns:
      a stream of direct dependents
    • findCycle

      public Optional<List<BindingNode>> findCycle()
      Returns the full cycle path if a dependency cycle exists among the registered bindings, otherwise returns empty.
      Returns:
      an Optional containing the cycle path, or empty if no cycle exists
    • unsatisfiedDependencies

      public Stream<BindingGraphTrait.UnsatisfiedDependency> unsatisfiedDependencies()
      Returns dependency edges where the satisfying binding was not registered as an explicit binding in the context (auto-resolved or untracked types). These are recorded by the contributor but excluded from the graph because no BindingNode exists for the target.
      Returns:
      a stream of unsatisfied dependency records
    • graph

      public build.base.graph.WeightedGraph<BindingNode, DependencyEdge> graph()
      Returns the underlying WeightedGraph for consumers that need direct algorithm access.
      Returns:
      the binding graph