Class Project
-
- All Implemented Interfaces:
public final class ProjectA class describing a software project. A Project is very similar to a Package but contains some additional metadata like e.g. the homepageUrl. Most importantly, it defines the dependency scopes that refer to the actual packages.
-
-
Field Summary
Fields Modifier and Type Field Description public final static ProjectEMPTYprivate final Set<Scope>scopesprivate final Identifieridprivate final Stringcpeprivate final StringdefinitionFilePathprivate final Set<String>authorsprivate final Set<String>declaredLicensesprivate final ProcessedDeclaredLicensedeclaredLicensesProcessedprivate final VcsInfovcsprivate final VcsInfovcsProcessedprivate final StringhomepageUrlprivate final Set<Scope>scopeDependenciesprivate final Set<String>scopeNames
-
Constructor Summary
Constructors Constructor Description Project(Identifier id, String cpe, String definitionFilePath, Set<String> authors, Set<String> declaredLicenses, ProcessedDeclaredLicense declaredLicensesProcessed, VcsInfo vcs, VcsInfo vcsProcessed, String homepageUrl, Set<Scope> scopeDependencies, Set<String> scopeNames)
-
Method Summary
Modifier and Type Method Description final Set<Scope>getScopes()The dependency scopes defined by this project. final IdentifiergetId()The unique identifier of this project. final StringgetCpe()An optional additional identifier in CPE syntax. final StringgetDefinitionFilePath()The path to the definition file of this project, relative to the root of the repository described in vcs and vcsProcessed. final Set<String>getAuthors()The set of authors declared for this project. final Set<String>getDeclaredLicenses()The set of licenses declared for this project. final ProcessedDeclaredLicensegetDeclaredLicensesProcessed()The declared licenses as SpdxExpression. final VcsInfogetVcs()Original VCS-related information as defined in the Project's metadata. final VcsInfogetVcsProcessed()Processed VCS-related information about the Project that has e.g. final StringgetHomepageUrl()The URL to the project's homepage. final Set<Scope>getScopeDependencies()Holds information about the scopes and their dependencies of this project if no DependencyGraph is available. final Set<String>getScopeNames()Contains dependency information as a set of scope names in case a shared DependencyGraph is used. final ProjectwithResolvedScopes(DependencyGraph graph)Return a Project instance that has its scope information directly available, resolved from the given graph. final Booleancontains(Identifier id)Return whether the package identified by id is contained as a (transitive) dependency in this project. final List<PackageReference>findReferences(Identifier id)Return all references to id as a dependency in this project. final PackagetoPackage()Return a Package representation of this Project. -
-
Method Detail
-
getScopes
final Set<Scope> getScopes()
The dependency scopes defined by this project. This property provides access to scope-related information, no matter whether this information has been initialized directly or has been encoded in a DependencyGraph.
-
getId
final Identifier getId()
The unique identifier of this project. The id's type is the name of the package manager that manages this project (e.g. "Gradle" for a Gradle project).
-
getCpe
final String getCpe()
An optional additional identifier in CPE syntax.
-
getDefinitionFilePath
final String getDefinitionFilePath()
The path to the definition file of this project, relative to the root of the repository described in vcs and vcsProcessed.
-
getAuthors
final Set<String> getAuthors()
The set of authors declared for this project.
-
getDeclaredLicenses
final Set<String> getDeclaredLicenses()
The set of licenses declared for this project. This does not necessarily correspond to the licenses as detected by a scanner. Both need to be taken into account for any conclusions.
-
getDeclaredLicensesProcessed
final ProcessedDeclaredLicense getDeclaredLicensesProcessed()
The declared licenses as SpdxExpression. If declaredLicenses contains multiple licenses they are concatenated with SpdxOperator.AND.
-
getVcs
final VcsInfo getVcs()
Original VCS-related information as defined in the Project's metadata.
-
getVcsProcessed
final VcsInfo getVcsProcessed()
Processed VCS-related information about the Project that has e.g. common mistakes corrected.
-
getHomepageUrl
final String getHomepageUrl()
The URL to the project's homepage.
-
getScopeDependencies
final Set<Scope> getScopeDependencies()
Holds information about the scopes and their dependencies of this project if no DependencyGraph is available. NOTE: Do not use this property to access scope information. Use scopes instead, which is correctly initialized in all cases.
-
getScopeNames
final Set<String> getScopeNames()
Contains dependency information as a set of scope names in case a shared DependencyGraph is used. The scopes of this project and their dependencies can then be constructed as the corresponding sub graph of the shared graph.
-
withResolvedScopes
final Project withResolvedScopes(DependencyGraph graph)
Return a Project instance that has its scope information directly available, resolved from the given graph. This function can be used to create a fully initialized Project if dependency information is available in a shared DependencyGraph. In this case, the set with Scopes is constructed as a subset of the provided shared graph. Otherwise, result is this same object.
-
contains
final Boolean contains(Identifier id)
Return whether the package identified by id is contained as a (transitive) dependency in this project.
-
findReferences
final List<PackageReference> findReferences(Identifier id)
Return all references to id as a dependency in this project.
-
-
-
-