Class Scope
-
- All Implemented Interfaces:
public final class ScopeThe scope class puts package dependencies into context.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringnameprivate final Set<PackageReference>dependencies
-
Constructor Summary
Constructors Constructor Description Scope(String name, Set<PackageReference> dependencies)
-
Method Summary
Modifier and Type Method Description final StringgetName()The respective package manager's native name for the scope, e.g. final Set<PackageReference>getDependencies()The set of references to packages in this scope. final Set<Identifier>collectDependencies(Integer maxDepth, Function1<PackageReference, Boolean> filterPredicate)Return the set of package Identifiers in this Scope, up to and including a depth of maxDepth where counting starts at 0 (for the Scope itself) and 1 are direct dependencies etc. final Booleancontains(Identifier id)Return whether the package identified by id is contained as a (transitive) dependency in this scope. final List<PackageReference>findReferences(Identifier id)Return all references to id as a dependency in this scope. -
-
Constructor Detail
-
Scope
Scope(String name, Set<PackageReference> dependencies)
-
-
Method Detail
-
getName
final String getName()
The respective package manager's native name for the scope, e.g. "compile", "provided" etc. for Maven, or "dependencies", "devDependencies" etc. for NPM.
-
getDependencies
final Set<PackageReference> getDependencies()
The set of references to packages in this scope. Note that only the first-order packages in this set actually belong to the scope of name. Transitive dependency packages usually belong to the scope that describes the packages required to compile the product. As an example, if this was the Maven "test" scope, all first-order items in dependencies would be packages required for testing the product. But transitive dependencies would not be test dependencies of the test dependencies, but compile dependencies of test dependencies.
-
collectDependencies
final Set<Identifier> collectDependencies(Integer maxDepth, Function1<PackageReference, Boolean> filterPredicate)
Return the set of package Identifiers in this Scope, up to and including a depth of maxDepth where counting starts at 0 (for the Scope itself) and 1 are direct dependencies etc. A value below 0 means to not limit the depth. If the given filterPredicate is false for a specific PackageReference the corresponding Identifier is excluded from the result.
-
contains
final Boolean contains(Identifier id)
Return whether the package identified by id is contained as a (transitive) dependency in this scope.
-
findReferences
final List<PackageReference> findReferences(Identifier id)
Return all references to id as a dependency in this scope.
-
-
-
-