Package org.openrewrite.maven.graph
Class DependencyTreeWalker.Matches<S>
java.lang.Object
org.openrewrite.maven.graph.DependencyTreeWalker.Matches<S>
- Type Parameters:
S- the scope type (e.g., Maven Scope or Gradle configuration name String)
- Enclosing class:
DependencyTreeWalker
Collects dependency match information while walking the dependency tree.
This collector builds two maps that track:
- Which scopes/configurations contain direct dependencies that match or transitively depend on matches
- Which target dependencies are reachable from each direct dependency
This is the pattern used by dependency insight recipes to mark direct dependencies based on their transitive dependencies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the mapping from direct dependency to the transitive dependencies that matched.byScope()Returns the mapping from scope to direct dependencies that have matching transitives.voidcollect(S scope, ResolvedDependency root, org.openrewrite.semver.DependencyMatcher matcher, @Nullable DependencyTreeWalker.Callback callback) Walks the dependency tree for a given scope, collecting match mappings.booleanisEmpty()Returns true if no matches were found.
-
Constructor Details
-
Matches
public Matches()
-
-
Method Details
-
collect
public void collect(S scope, ResolvedDependency root, org.openrewrite.semver.DependencyMatcher matcher, @Nullable DependencyTreeWalker.Callback callback) Walks the dependency tree for a given scope, collecting match mappings.- Parameters:
scope- the scope or configuration nameroot- the direct dependency to walk frommatcher- the matcher to test dependencies againstcallback- optional callback for additional per-match processing (may be null)
-
byScope
Returns the mapping from scope to direct dependencies that have matching transitives. -
byDirectDependency
Returns the mapping from direct dependency to the transitive dependencies that matched. -
isEmpty
public boolean isEmpty()Returns true if no matches were found.
-