Package org.spdx.library.model
Class SpdxFile
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.SpdxElement
org.spdx.library.model.SpdxItem
org.spdx.library.model.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 classSpdxFile.SpdxFileBuilder -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description SpdxFile()SpdxFile(String id)protectedSpdxFile(SpdxFile.SpdxFileBuilder spdxFileBuilder)SpdxFile(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create) -
Method Summary
Modifier and Type Method Description protected List<String>_verify(Set<String> verifiedIds, String specVersion)Implementation of the specific verifications for this model objectbooleanaddChecksum(Checksum checksum)Add a checksumbooleanaddFileContributor(String contributor)Add a file contributor to the file contributors collectionbooleanaddFileType(FileType fileType)Add a file type to this fileintcompareTo(SpdxFile o)Collection<Checksum>getChecksums()Collection<String>getFileContributors()Collection<SpdxFile>getFileDependency()Deprecated.Collection<FileType>getFileTypes()protected StringgetLicenseInfoFromFilesPropertyName()protected StringgetNamePropertyName()Optional<String>getNoticeText()StringgetSha1()StringgetType()SpdxFilesetCopyrightText(String copyrightText)SpdxFilesetLicenseComments(String licenseComments)SpdxFilesetLicenseConcluded(AnyLicenseInfo license)Set the licenseConcludedSpdxFilesetName(String name)Set the nameSpdxFilesetNoticeText(String noticeText)Methods inherited from class org.spdx.library.model.SpdxItem
getAttributionText, getCopyrightText, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFilesMethods inherited from class org.spdx.library.model.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getRelationships, removeAnnotation, removeRelationship, setAnnotations, setComment, setRelationshipsMethods inherited from class org.spdx.library.model.ModelObject
addPropertyValueToCollection, addValueToCollection, clearValueCollection, clearValueCollection, clone, copyFrom, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createLineCharPointer, createPackage, createPackageVerificationCode, createRelationship, createSpdxFile, createSpdxSnippet, createStartEndPointer, enterCriticalSection, equals, equivalent, equivalent, getAnyLicenseInfoPropertyValue, getBooleanPropertyValue, getCopyManager, getDocumentUri, getElementPropertyValue, getEnumPropertyValue, getId, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getPropertyValueNames, getStringCollection, getStringPropertyValue, hashCode, idToIdType, isCollectionMembersAssignableTo, isStrict, leaveCriticalSection, removeProperty, removeProperty, removePropertyValueFromCollection, removePropertyValueFromCollection, replacePropertyValueCollection, setCopyManager, setPropertyValue, setPropertyValue, setStrict, toString, toTypedValue, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verify, verifyCollection
-
Constructor Details
-
SpdxFile
- Throws:
InvalidSPDXAnalysisException
-
SpdxFile
- Parameters:
id-- Throws:
InvalidSPDXAnalysisException
-
SpdxFile
public SpdxFile(IModelStore modelStore, String documentUri, String id, @Nullable ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore-documentUri-id-create-- Throws:
InvalidSPDXAnalysisException
-
SpdxFile
- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
getSha1
- Returns:
- the Sha1 checksum value for this file, or a blank string if no sha1 checksum has been set
- Throws:
InvalidSPDXAnalysisException
-
setCopyrightText
public SpdxFile setCopyrightText(@Nullable String copyrightText) throws InvalidSPDXAnalysisException- Overrides:
setCopyrightTextin classSpdxItem- Parameters:
copyrightText- the copyrightText to set- Returns:
- myself - so you can chain setters
- Throws:
InvalidSPDXAnalysisException
-
setName
Description copied from class:SpdxElementSet the name- Overrides:
setNamein classSpdxItem- Returns:
- this so that you can chain setters
- Throws:
InvalidSPDXAnalysisException
-
setLicenseConcluded
public SpdxFile setLicenseConcluded(@Nullable AnyLicenseInfo license) throws InvalidSPDXAnalysisExceptionDescription copied from class:SpdxItemSet the licenseConcluded- Overrides:
setLicenseConcludedin classSpdxItem- Returns:
- this so you can chain setters
- Throws:
InvalidSPDXAnalysisException
-
setLicenseComments
- Overrides:
setLicenseCommentsin classSpdxItem- Parameters:
licenseComments- the licenseComment to set- Returns:
- this so you chan chain setters
- Throws:
InvalidSPDXAnalysisException
-
getLicenseInfoFromFilesPropertyName
- Overrides:
getLicenseInfoFromFilesPropertyNamein classSpdxItem- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getNamePropertyName
- Overrides:
getNamePropertyNamein classSpdxElement- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getFileTypes
- Returns:
- File types for the file
- Throws:
InvalidSPDXAnalysisException
-
addFileType
Add a file type to this file- Parameters:
fileType-- Returns:
- true if the list was modified
- Throws:
InvalidSPDXAnalysisException
-
getChecksums
- Returns:
- the checksums
-
addChecksum
Add a checksum- Parameters:
checksum-- Returns:
- true if the list was modified
- Throws:
InvalidSPDXAnalysisException
-
getFileContributors
- Returns:
- the fileContributors
-
addFileContributor
Add a file contributor to the file contributors collection- Parameters:
contributor-- Returns:
-
getNoticeText
- Returns:
- the noticeText
- Throws:
InvalidSPDXAnalysisException
-
setNoticeText
- Parameters:
noticeText- the noticeText to set- Returns:
- this so you can chain setters
- Throws:
InvalidSPDXAnalysisException
-
getFileDependency
Deprecated.- Returns:
- file dependencies - note: this is deprecated, use relationships between files rather than this field
- Throws:
InvalidSPDXAnalysisException
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object -
compareTo
- Specified by:
compareToin interfaceComparable<SpdxFile>
-