Class PathRecordingDependencyVisitor
- java.lang.Object
-
- org.eclipse.aether.util.graph.visitor.PathRecordingDependencyVisitor
-
- All Implemented Interfaces:
DependencyVisitor
public final class PathRecordingDependencyVisitor extends java.lang.Object implements DependencyVisitor
A dependency visitor that records all paths leading to nodes matching a certain filter criteria.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanexcludeChildrenOfMatchesprivate DependencyFilterfilterprivate Stack<DependencyNode>parentsprivate java.util.List<java.util.List<DependencyNode>>paths
-
Constructor Summary
Constructors Constructor Description PathRecordingDependencyVisitor(DependencyFilter filter)Creates a new visitor that uses the specified filter to identify terminal nodes of interesting paths.PathRecordingDependencyVisitor(DependencyFilter filter, boolean excludeChildrenOfMatches)Creates a new visitor that uses the specified filter to identify terminal nodes of interesting paths.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DependencyFiltergetFilter()Gets the filter being used to select terminal nodes.java.util.List<java.util.List<DependencyNode>>getPaths()Gets the paths leading to nodes matching the filter that have been recorded during the graph visit.booleanvisitEnter(DependencyNode node)Notifies the visitor of a node visit before its children have been processed.booleanvisitLeave(DependencyNode node)Notifies the visitor of a node visit after its children have been processed.
-
-
-
Field Detail
-
filter
private final DependencyFilter filter
-
paths
private final java.util.List<java.util.List<DependencyNode>> paths
-
parents
private final Stack<DependencyNode> parents
-
excludeChildrenOfMatches
private final boolean excludeChildrenOfMatches
-
-
Constructor Detail
-
PathRecordingDependencyVisitor
public PathRecordingDependencyVisitor(DependencyFilter filter)
Creates a new visitor that uses the specified filter to identify terminal nodes of interesting paths. The visitor will not search for paths going beyond an already matched node.- Parameters:
filter- The filter used to select terminal nodes of paths to record, may benullto match any node.
-
PathRecordingDependencyVisitor
public PathRecordingDependencyVisitor(DependencyFilter filter, boolean excludeChildrenOfMatches)
Creates a new visitor that uses the specified filter to identify terminal nodes of interesting paths.- Parameters:
filter- The filter used to select terminal nodes of paths to record, may benullto match any node.excludeChildrenOfMatches- Flag controlling whether children of matched nodes should be excluded from the traversal, thereby ignoring any potential paths to other matching nodes beneath a matching ancestor node. Iftrue, all recorded paths will have only one matching node (namely the terminal node), iffalsea recorded path can consist of multiple matching nodes.
-
-
Method Detail
-
getFilter
public DependencyFilter getFilter()
Gets the filter being used to select terminal nodes.- Returns:
- The filter being used or
nullif none.
-
getPaths
public java.util.List<java.util.List<DependencyNode>> getPaths()
Gets the paths leading to nodes matching the filter that have been recorded during the graph visit. A path is given as a sequence of nodes, starting with the root node of the graph and ending with a node that matched the filter.- Returns:
- The recorded paths, never
null.
-
visitEnter
public boolean visitEnter(DependencyNode node)
Description copied from interface:DependencyVisitorNotifies the visitor of a node visit before its children have been processed.- Specified by:
visitEnterin interfaceDependencyVisitor- Parameters:
node- The dependency node being visited, must not benull.- Returns:
trueto visit child nodes of the specified node as well,falseto skip children.
-
visitLeave
public boolean visitLeave(DependencyNode node)
Description copied from interface:DependencyVisitorNotifies the visitor of a node visit after its children have been processed. Note that this method is always invoked regardless whether any children have actually been visited.- Specified by:
visitLeavein interfaceDependencyVisitor- Parameters:
node- The dependency node being visited, must not benull.- Returns:
trueto visit siblings nodes of the specified node as well,falseto skip siblings.
-
-