Package org.spdx.library.model
Class SpdxSnippet
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.SpdxElement
org.spdx.library.model.SpdxItem
org.spdx.library.model.SpdxSnippet
- All Implemented Interfaces:
Comparable<SpdxSnippet>
public class SpdxSnippet extends SpdxItem implements Comparable<SpdxSnippet>
Snippets can optionally be used when a file is known to have some content that has been included from another original source.
They are useful for denoting when part of a file may have been originally created under another license.
Each instance of Snippet Information needs to be associated with a specific File in an SPDX Document.
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpdxSnippet.SpdxSnippetBuilder -
Field Summary
-
Constructor Summary
Constructors Constructor Description SpdxSnippet()SpdxSnippet(String id)SpdxSnippet(SpdxSnippet.SpdxSnippetBuilder spdxSnippetBuilder)SpdxSnippet(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 objectintcompareTo(SpdxSnippet o)StartEndPointergetByteRange()StringgetLicenseInfoFromFilesPropertyName()Optional<StartEndPointer>getLineRange()SpdxFilegetSnippetFromFile()StringgetType()SpdxSnippetsetByteRange(int startByte, int endByte)SpdxSnippetsetLineRange(int startLine, int endLine)SpdxSnippetsetSnippetFromFile(SpdxFile snippetFromFile)StringtoString()Methods inherited from class org.spdx.library.model.SpdxItem
getAttributionText, getCopyrightText, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFiles, setCopyrightText, setLicenseComments, setLicenseConcluded, setNameMethods inherited from class org.spdx.library.model.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getNamePropertyName, 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, toTypedValue, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verify, verifyCollection
-
Constructor Details
-
SpdxSnippet
- Throws:
InvalidSPDXAnalysisException
-
SpdxSnippet
- Parameters:
id-- Throws:
InvalidSPDXAnalysisException
-
SpdxSnippet
public SpdxSnippet(IModelStore modelStore, String documentUri, String id, @Nullable ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore-documentUri-id-copyManager-create-- Throws:
InvalidSPDXAnalysisException
-
SpdxSnippet
public SpdxSnippet(SpdxSnippet.SpdxSnippetBuilder spdxSnippetBuilder) throws InvalidSPDXAnalysisException- Parameters:
spdxSnippetBuilder-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
getLicenseInfoFromFilesPropertyName
- Overrides:
getLicenseInfoFromFilesPropertyNamein classSpdxItem- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getSnippetFromFile
- Returns:
- the snippetFromFile, null if the file is not present in the model
- Throws:
InvalidSPDXAnalysisException
-
setSnippetFromFile
public SpdxSnippet setSnippetFromFile(SpdxFile snippetFromFile) throws InvalidSPDXAnalysisException- Parameters:
snippetFromFile- the snippetFromFile to set- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
getByteRange
- Returns:
- the byteRange or null if no byte range is present
- Throws:
InvalidSPDXAnalysisException
-
setByteRange
- Parameters:
startByte- first byte of the rangeendByte- end byte of the range- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
getLineRange
- Returns:
- the lineRange
- Throws:
InvalidSPDXAnalysisException
-
setLineRange
- Parameters:
startLine- the start position of lineRange to set, inclusiveendLine- the end position of lineRange to set, exclusive- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object -
compareTo
- Specified by:
compareToin interfaceComparable<SpdxSnippet>
-
toString
- Overrides:
toStringin classModelObject
-