Package org.spdx.library.model
Class SpdxElement
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.SpdxElement
- Direct Known Subclasses:
ExternalSpdxElement,GenericSpdxElement,SpdxConstantElement,SpdxDocument,SpdxItem
An SpdxElement is any thing described in SPDX, either a document or an SpdxItem.
SpdxElements can be related to other SpdxElements.
If a subproperty is used for the name property name, getNamePropertyName should be overridden.
- Author:
- Gary O'Neall
-
Field Summary
Fields inherited from class org.spdx.library.model.ModelObject
strict -
Constructor Summary
ConstructorsConstructorDescriptionSpdxElement(String id) SpdxElement(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create) -
Method Summary
Modifier and TypeMethodDescriptionImplementation of the specific verifications for this model objectbooleanaddAnnotation(Annotation annotation) Add an annotationaddNameToWarnings(List<String> warnings) Add the name of the element to all strings in the listbooleanaddRelationship(Relationship relationship) Add a relationshipgetName()protected StringbooleanremoveAnnotation(Annotation annotation) Remove an annotationbooleanremoveRelationship(Relationship relationship) Remove a relationshipsetAnnotations(Collection<Annotation> annotations) Clears and resets the annotations collection to the parametervoidsetComment(String comment) Sets the commentSet the namesetRelationships(Collection<Relationship> relationships) clear and reset the relationships to the paramater relationshipMethods inherited from class org.spdx.library.model.ModelObject
addPropertyValueToCollection, addValueToCollection, clearValueCollection, clearValueCollection, clone, copyFrom, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createExtractedLicense, 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, getType, 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
-
SpdxElement
- Throws:
InvalidSPDXAnalysisException
-
SpdxElement
- Parameters:
id-- Throws:
InvalidSPDXAnalysisException
-
SpdxElement
public SpdxElement(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException - Parameters:
modelStore-documentUri-id-create-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object- Specified by:
_verifyin classModelObject- Parameters:
verifiedElementIds- list of all Element Id's which have already been verified - prevents infinite recursionspecVersion- Version of the SPDX spec to verify against- Returns:
- Any verification errors or warnings associated with this object
-
addNameToWarnings
Add the name of the element to all strings in the list- Parameters:
warnings-- Returns:
- the same last after being modified (Note: a new list is not created - this modifies the warnings list)
-
getAnnotations
- Returns:
- Annotations
- Throws:
InvalidSPDXAnalysisException
-
setAnnotations
public SpdxElement setAnnotations(Collection<Annotation> annotations) throws InvalidSPDXAnalysisException Clears and resets the annotations collection to the parameter- Parameters:
annotations-- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
addAnnotation
Add an annotation- Parameters:
annotation-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
removeAnnotation
Remove an annotation- Parameters:
annotation-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
getRelationships
- Returns:
- Relationships
- Throws:
InvalidSPDXAnalysisException
-
setRelationships
public SpdxElement setRelationships(Collection<Relationship> relationships) throws InvalidSPDXAnalysisException clear and reset the relationships to the paramater relationship- Parameters:
relationships-- Returns:
- this to chain sets
- Throws:
InvalidSPDXAnalysisException
-
addRelationship
Add a relationship- Parameters:
relationship-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
removeRelationship
Remove a relationship- Parameters:
relationship-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
getComment
- Returns:
- the comment
- Throws:
InvalidSPDXAnalysisException
-
setComment
Sets the comment- Parameters:
comment-- Throws:
InvalidSPDXAnalysisException
-
getNamePropertyName
- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getName
- Returns:
- the name
- Throws:
InvalidSPDXAnalysisException
-
setName
Set the name- Parameters:
name-- Returns:
- this so that you can chain setters
- Throws:
InvalidSPDXAnalysisException
-