Class CompatibilityDependencyNavigator
-
- All Implemented Interfaces:
-
org.ossreviewtoolkit.model.DependencyNavigator
public final class CompatibilityDependencyNavigator implements DependencyNavigator
A DependencyNavigator implementation that can handle all kinds of OrtResults (and is therefore the most compatible one).
While in future newly written OrtResult files are going to use the dependency graph format exclusively, existing files may still store their dependency information in the classic dependency tree format, or even in a mixture of both formats (if some package managers in use have already been ported to the new format while others have not). In such a constellation, it has to be decided on a per-project basis, how dependency information has to be accessed. This is exactly what this implementation does: For each request, it determines the dependency format of the project in question and then delegates to a corresponding DependencyNavigator instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classCompatibilityDependencyNavigator.Companion
-
Field Summary
Fields Modifier and Type Field Description private final DependencyNavigatorgraphNavigatorprivate final DependencyNavigatortreeNavigatorpublic final static CompatibilityDependencyNavigator.CompanionCompanion
-
Method Summary
Modifier and Type Method Description final DependencyNavigatorgetGraphNavigator()The DependencyNavigator to handle projects using the graph format. final DependencyNavigatorgetTreeNavigator()The DependencyNavigator to handle projects using the tree format. Set<String>scopeNames(Project project)Return a set with the names of all the scopes defined for the given project. Sequence<DependencyNode>directDependencies(Project project, String scopeName)Return a sequence with DependencyNodes for the direct dependencies for the given project and scopeName. Set<Identifier>dependenciesForScope(Project project, String scopeName, Integer maxDepth, Function1<DependencyNode, Boolean> matcher)Return a set with information of the dependencies of a specific scope of a project. Set<Identifier>packageDependencies(Project project, Identifier packageId, Integer maxDepth, Function1<DependencyNode, Boolean> matcher)Return a set with the Identifiers of packages that are dependencies of the package with the given packageId in the given project. -
Methods inherited from class org.ossreviewtoolkit.model.DependencyNavigator
collectSubProjects, dependencyTreeDepth, getShortestPaths, projectDependencies, projectIssues, scopeDependencies -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getGraphNavigator
final DependencyNavigator getGraphNavigator()
The DependencyNavigator to handle projects using the graph format.
-
getTreeNavigator
final DependencyNavigator getTreeNavigator()
The DependencyNavigator to handle projects using the tree format.
-
scopeNames
Set<String> scopeNames(Project project)
Return a set with the names of all the scopes defined for the given project.
-
directDependencies
Sequence<DependencyNode> directDependencies(Project project, String scopeName)
Return a sequence with DependencyNodes for the direct dependencies for the given project and scopeName. From this sequence, the whole dependency tree of that scope can be traversed.
-
dependenciesForScope
Set<Identifier> dependenciesForScope(Project project, String scopeName, Integer maxDepth, Function1<DependencyNode, Boolean> matcher)
Return a set with information of the dependencies of a specific scope of a project. With maxDepth the depth of the dependency tree to be traversed can be restricted; negative values mean that there is no restriction. Use the specified matcher to filter for specific dependencies.
-
packageDependencies
Set<Identifier> packageDependencies(Project project, Identifier packageId, Integer maxDepth, Function1<DependencyNode, Boolean> matcher)
Return a set with the Identifiers of packages that are dependencies of the package with the given packageId in the given project. Starting from project, the dependency graph is searched for the package in question; then its dependencies are collected. It is possible to restrict the dependencies to be fetched with maxDepth and matcher.
-
-
-
-