Package org.spdx.library.model.v2
Class SpdxPackage.SpdxPackageBuilder
- java.lang.Object
-
- org.spdx.library.model.v2.SpdxPackage.SpdxPackageBuilder
-
- Enclosing class:
- SpdxPackage
public static class SpdxPackage.SpdxPackageBuilder extends Object
-
-
Constructor Summary
Constructors Constructor Description SpdxPackageBuilder(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager, String name, AnyLicenseInfo concludedLicense, String copyrightText, AnyLicenseInfo licenseDeclared)
Build an SpdxPackage with the required parameters if isFilesAnalyzed is false - note isFilesAnalyzed must be explicitly set to false
-
Method Summary
-
-
-
Constructor Detail
-
SpdxPackageBuilder
public SpdxPackageBuilder(org.spdx.storage.IModelStore modelStore, String documentUri, String id, @Nullable org.spdx.core.IModelCopyManager copyManager, String name, AnyLicenseInfo concludedLicense, String copyrightText, AnyLicenseInfo licenseDeclared)
Build an SpdxPackage with the required parameters if isFilesAnalyzed is false - note isFilesAnalyzed must be explicitly set to false- Parameters:
modelStore
- Storage for the model objectsdocumentUri
- SPDX Document URI for a document associated with this modelid
- ID for this object - must be unique within the SPDX documentname
- File namecopyManager
-concludedLicense
-copyrightText
- Copyright textlicenseDeclared
- Declared license for the package
-
-
Method Detail
-
setAnnotations
public SpdxPackage.SpdxPackageBuilder setAnnotations(Collection<Annotation> annotations)
- Parameters:
annotations
- Annotations- Returns:
- this to continue the build
-
addAnnotation
public SpdxPackage.SpdxPackageBuilder addAnnotation(Annotation annotation)
- Parameters:
annotation
- Annotation to add- Returns:
- this to continue the build
-
setRelationships
public SpdxPackage.SpdxPackageBuilder setRelationships(Collection<Relationship> relationships)
- Parameters:
relationships
- Relationships- Returns:
- this to continue the build
-
addRelationship
public SpdxPackage.SpdxPackageBuilder addRelationship(Relationship relationship)
- Parameters:
relationship
- Relationship to add- Returns:
- this to continue the build
-
setComment
public SpdxPackage.SpdxPackageBuilder setComment(@Nullable String comment)
- Parameters:
comment
- Comment- Returns:
- this to continue the build
-
setLicenseInfosFromFile
public SpdxPackage.SpdxPackageBuilder setLicenseInfosFromFile(Collection<AnyLicenseInfo> licenseInfosFromFile)
- Parameters:
licenseInfosFromFile
- License information from all files in the package- Returns:
- this to continue the build
-
addLicenseInfosFromFile
public SpdxPackage.SpdxPackageBuilder addLicenseInfosFromFile(AnyLicenseInfo licenseInfo)
- Parameters:
licenseInfo
- license info for a file to be added to the collection of license infos- Returns:
- this to continue the build
-
setLicenseComments
public SpdxPackage.SpdxPackageBuilder setLicenseComments(@Nullable String licenseComments)
- Parameters:
licenseComments
- license comments- Returns:
- this to continue the build
-
setChecksums
public SpdxPackage.SpdxPackageBuilder setChecksums(Collection<Checksum> checksums)
- Parameters:
checksums
- Checksum- Returns:
- this to continue the build
-
addChecksum
public SpdxPackage.SpdxPackageBuilder addChecksum(Checksum checksum)
- Parameters:
checksum
- Checksum to add- Returns:
- this to continue the build
-
setDescription
public SpdxPackage.SpdxPackageBuilder setDescription(String description)
- Parameters:
description
- long description- Returns:
- this to continue the build
-
setExternalRefs
public SpdxPackage.SpdxPackageBuilder setExternalRefs(Collection<ExternalRef> externalRefs)
- Parameters:
externalRefs
- external references to this package- Returns:
- this to continue the build
-
addExternalRef
public SpdxPackage.SpdxPackageBuilder addExternalRef(ExternalRef externalRef)
- Parameters:
externalRef
- external reference to this package- Returns:
- this to continue the build
-
setFiles
public SpdxPackage.SpdxPackageBuilder setFiles(Collection<SpdxFile> files)
- Parameters:
files
- files contained in the package- Returns:
- this to continue the build
-
addFile
public SpdxPackage.SpdxPackageBuilder addFile(SpdxFile file)
- Parameters:
file
- file to be added to the collection of files- Returns:
- this to continue the build
-
setHomepage
public SpdxPackage.SpdxPackageBuilder setHomepage(String homepage)
- Parameters:
homepage
- package home page- Returns:
- this to continue the build
-
setOriginator
public SpdxPackage.SpdxPackageBuilder setOriginator(String originator)
- Parameters:
originator
- originator of the package- Returns:
- this to continue the build
-
setPackageFileName
public SpdxPackage.SpdxPackageBuilder setPackageFileName(String packageFileName)
- Parameters:
packageFileName
- file name of the archive containing the package- Returns:
- this to continue the build
-
setPackageVerificationCode
public SpdxPackage.SpdxPackageBuilder setPackageVerificationCode(SpdxPackageVerificationCode packageVerificationCode)
- Parameters:
packageVerificationCode
- Package verification code calculated from the files- Returns:
- this to continue the build
-
setSourceInfo
public SpdxPackage.SpdxPackageBuilder setSourceInfo(String sourceInfo)
- Parameters:
sourceInfo
- Information on the source of the package- Returns:
- this to continue the build
-
setSummary
public SpdxPackage.SpdxPackageBuilder setSummary(String summary)
- Parameters:
summary
- Short description- Returns:
- this to continue the build
-
setSupplier
public SpdxPackage.SpdxPackageBuilder setSupplier(String supplier)
- Parameters:
supplier
- Package supplier- Returns:
- this to continue the build
-
setVersionInfo
public SpdxPackage.SpdxPackageBuilder setVersionInfo(String versionInfo)
- Parameters:
versionInfo
- Package version- Returns:
- this to continue the build
-
setFilesAnalyzed
public SpdxPackage.SpdxPackageBuilder setFilesAnalyzed(boolean filesAnalyzed)
- Parameters:
filesAnalyzed
- if true, files were analyzed for this package - add additional required parameters files, verificationCode and licenseInfosFromFile- Returns:
- this to continue the build
-
setDownloadLocation
public SpdxPackage.SpdxPackageBuilder setDownloadLocation(String downloadLocation)
- Parameters:
downloadLocation
- download location for the package- Returns:
- this to continue the build
-
setAttributionText
public SpdxPackage.SpdxPackageBuilder setAttributionText(Collection<String> attributionText)
- Parameters:
attributionText
- Attribution text for the package- Returns:
- this to continue the build
-
addAttributionText
public SpdxPackage.SpdxPackageBuilder addAttributionText(String attribution)
- Parameters:
attribution
- attribution to add to the attribution text- Returns:
- this to continue the build
-
setPrimaryPurpose
public SpdxPackage.SpdxPackageBuilder setPrimaryPurpose(Purpose purpose)
- Parameters:
purpose
- Package Purpose is intrinsic to how the package is being used rather than the content of the package.- Returns:
- this to continue the build
-
setBuiltDate
public SpdxPackage.SpdxPackageBuilder setBuiltDate(String builtDate)
- Parameters:
builtDate
- This field provides a place for recording the actual date the package was built.- Returns:
- this to continue the build
-
setValidUntilDate
public SpdxPackage.SpdxPackageBuilder setValidUntilDate(String validUntilDate)
- Parameters:
validUntilDate
- This field provides a place for recording the end of the support period for a package from the supplier.- Returns:
- this to continue the build
-
setReleaseDate
public SpdxPackage.SpdxPackageBuilder setReleaseDate(String releaseDate)
- Parameters:
releaseDate
- This field provides a place for recording the date the package was released.- Returns:
- this to continue the build
-
build
public SpdxPackage build() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the SPDX package
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-