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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDescribes a dependency from a registered binding to a type that is not registered as an explicit binding in the context. -
Method Summary
Modifier and TypeMethodDescriptionbindings()Returns all registeredBindingNodes in this graph.dependenciesOf(BindingNode node) Returns theBindingNodes that the given node directly depends on (its successors in the directed graph — the dependencies it requires).dependentsOf(BindingNode node) Returns theBindingNodes that directly depend on the given node (its predecessors in the directed graph — the bindings that require it).Returns the full cycle path if a dependency cycle exists among the registered bindings, otherwise returns empty.build.base.graph.WeightedGraph<BindingNode, DependencyEdge> graph()Returns the underlyingWeightedGraphfor consumers that need direct algorithm access.Returns dependency edges where the satisfying binding was not registered as an explicit binding in the context (auto-resolved or untracked types).
-
Method Details
-
bindings
Returns all registeredBindingNodes in this graph.- Returns:
- a stream of all binding nodes
-
dependenciesOf
Returns theBindingNodes 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
Returns theBindingNodes 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
Returns the full cycle path if a dependency cycle exists among the registered bindings, otherwise returns empty.- Returns:
- an
Optionalcontaining the cycle path, or empty if no cycle exists
-
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 noBindingNodeexists for the target.- Returns:
- a stream of unsatisfied dependency records
-
graph
Returns the underlyingWeightedGraphfor consumers that need direct algorithm access.- Returns:
- the binding graph
-