Package org.spdx.library.model.v2
Class SpdxFile
- java.lang.Object
-
- org.spdx.core.CoreModelObject
-
- org.spdx.library.model.v2.ModelObjectV2
-
- org.spdx.library.model.v2.SpdxElement
-
- org.spdx.library.model.v2.SpdxItem
-
- org.spdx.library.model.v2.SpdxFile
-
- All Implemented Interfaces:
Comparable<SpdxFile>
public class SpdxFile extends SpdxItem implements Comparable<SpdxFile>
A File represents a named sequence of information that is contained in a software package.- Author:
- Gary O'Neall
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpdxFile.SpdxFileBuilder
-
Field Summary
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Constructor Summary
Constructors Modifier Constructor Description SpdxFile()
SpdxFile(String id)
protected
SpdxFile(SpdxFile.SpdxFileBuilder spdxFileBuilder)
SpdxFile(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager, boolean create)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected List<String>
_verify(Set<String> verifiedIds, String specVersion)
Implementation of the specific verifications for this model objectboolean
addChecksum(Checksum checksum)
Add a checksumboolean
addFileContributor(String contributor)
Add a file contributor to the file contributors collectionboolean
addFileType(FileType fileType)
Add a file type to this fileint
compareTo(SpdxFile o)
Collection<Checksum>
getChecksums()
Collection<String>
getFileContributors()
Collection<SpdxFile>
getFileDependency()
Deprecated.Collection<FileType>
getFileTypes()
protected org.spdx.storage.PropertyDescriptor
getLicenseInfoFromFilesPropertyDescriptor()
protected org.spdx.storage.PropertyDescriptor
getNamePropertyDescriptor()
Optional<String>
getNoticeText()
String
getSha1()
String
getType()
SpdxFile
setCopyrightText(String copyrightText)
SpdxFile
setLicenseComments(String licenseComments)
SpdxFile
setLicenseConcluded(AnyLicenseInfo license)
Set the licenseConcludedSpdxFile
setName(String name)
Set the nameSpdxFile
setNoticeText(String noticeText)
-
Methods inherited from class org.spdx.library.model.v2.SpdxItem
getAttributionText, getCopyrightText, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFiles
-
Methods inherited from class org.spdx.library.model.v2.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getRelationships, removeAnnotation, removeRelationship, setAnnotations, setComment, setRelationships
-
Methods inherited from class org.spdx.library.model.v2.ModelObjectV2
_verify, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createExtractedLicense, createLineCharPointer, createPackage, createPackageVerificationCode, createRelationship, createSpdxFile, createSpdxSnippet, createStartEndPointer, equals, getAnyLicenseInfoPropertyValue, getDocumentUri, getElementPropertyValue, getId, hashCode, isEquivalentToNull, isNoAssertion, isRelatedElement, toString, toTypedValue, verify
-
Methods inherited from class org.spdx.core.CoreModelObject
addPropertyValueToCollection, clearValueCollection, clone, copyFrom, enterCriticalSection, equivalent, equivalent, getBooleanPropertyValue, getCopyManager, getDoublePropertyValue, getEnumPropertyValue, getIdPrefix, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getObjectUri, getPropertyValueDescriptors, getSpecVersion, getStringCollection, getStringPropertyValue, isCollectionMembersAssignableTo, isExternal, isStrict, leaveCriticalSection, removeProperty, removePropertyValueFromCollection, setCopyManager, setIdPrefix, setPropertyValue, setStrict, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verifyCollection
-
-
-
-
Constructor Detail
-
SpdxFile
public SpdxFile() throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxFile
public SpdxFile(String id) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
id
- identifier- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxFile
public SpdxFile(org.spdx.storage.IModelStore modelStore, String documentUri, String id, @Nullable org.spdx.core.IModelCopyManager copyManager, boolean create) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
modelStore
- container which includes the model datadocumentUri
- URI for the SPDX document containing the model dataid
- identifiercopyManager
- if non-null, allows for copying of any properties set which use other model stores or document URI'screate
- if true, create the license if it does not exist- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxFile
protected SpdxFile(SpdxFile.SpdxFileBuilder spdxFileBuilder) throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-
Method Detail
-
getType
public String getType()
- Specified by:
getType
in classorg.spdx.core.CoreModelObject
-
getSha1
public String getSha1() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the Sha1 checksum value for this file, or a blank string if no sha1 checksum has been set
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setCopyrightText
public SpdxFile setCopyrightText(@Nullable String copyrightText) throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
setCopyrightText
in classSpdxItem
- Parameters:
copyrightText
- the copyrightText to set- Returns:
- myself - so you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setName
public SpdxFile setName(@Nullable String name) throws org.spdx.core.InvalidSPDXAnalysisException
Description copied from class:SpdxElement
Set the name
-
setLicenseConcluded
public SpdxFile setLicenseConcluded(@Nullable AnyLicenseInfo license) throws org.spdx.core.InvalidSPDXAnalysisException
Description copied from class:SpdxItem
Set the licenseConcluded- Overrides:
setLicenseConcluded
in classSpdxItem
- Returns:
- this so you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setLicenseComments
public SpdxFile setLicenseComments(String licenseComments) throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
setLicenseComments
in classSpdxItem
- Parameters:
licenseComments
- the licenseComment to set- Returns:
- this so you chan chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getLicenseInfoFromFilesPropertyDescriptor
protected org.spdx.storage.PropertyDescriptor getLicenseInfoFromFilesPropertyDescriptor()
- Overrides:
getLicenseInfoFromFilesPropertyDescriptor
in classSpdxItem
- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getNamePropertyDescriptor
protected org.spdx.storage.PropertyDescriptor getNamePropertyDescriptor()
- Overrides:
getNamePropertyDescriptor
in classSpdxElement
- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getFileTypes
public Collection<FileType> getFileTypes() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- File types for the file
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
addFileType
public boolean addFileType(FileType fileType) throws org.spdx.core.InvalidSPDXAnalysisException
Add a file type to this file- Parameters:
fileType
-- Returns:
- true if the list was modified
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getChecksums
public Collection<Checksum> getChecksums()
- Returns:
- the checksums
-
addChecksum
public boolean addChecksum(Checksum checksum) throws org.spdx.core.InvalidSPDXAnalysisException
Add a checksum- Parameters:
checksum
-- Returns:
- true if the list was modified
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getFileContributors
public Collection<String> getFileContributors()
- Returns:
- the fileContributors
-
addFileContributor
public boolean addFileContributor(String contributor)
Add a file contributor to the file contributors collection- Parameters:
contributor
-- Returns:
-
getNoticeText
public Optional<String> getNoticeText() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the noticeText
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setNoticeText
public SpdxFile setNoticeText(@Nullable String noticeText) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
noticeText
- the noticeText to set- Returns:
- this so you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getFileDependency
@Deprecated public Collection<SpdxFile> getFileDependency() throws org.spdx.core.InvalidSPDXAnalysisException
Deprecated.- Returns:
- file dependencies - note: this is deprecated, use relationships between files rather than this field
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
_verify
protected List<String> _verify(Set<String> verifiedIds, String specVersion)
Description copied from class:ModelObjectV2
Implementation of the specific verifications for this model object
-
compareTo
public int compareTo(SpdxFile o)
- Specified by:
compareTo
in interfaceComparable<SpdxFile>
-
-