Package org.spdx.library.model
Class Relationship
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.Relationship
- All Implemented Interfaces:
Comparable<Relationship>
public class Relationship extends ModelObject implements Comparable<Relationship>
A Relationship represents a relationship between two SpdxElements.
- Author:
- Gary O'Neall
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Relationship()Relationship(String id)Relationship(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(Relationship o)Optional<String>getComment()Optional<SpdxElement>getRelatedSpdxElement()RelationshipTypegetRelationshipType()StringgetType()RelationshipsetComment(String comment)RelationshipsetRelatedSpdxElement(SpdxElement relatedSpdxElement)RelationshipsetRelationshipType(RelationshipType type)Set the relationship typeStringtoString()Methods 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
-
Relationship
- Throws:
InvalidSPDXAnalysisException
-
Relationship
- Parameters:
id-- Throws:
InvalidSPDXAnalysisException
-
Relationship
public Relationship(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore-documentUri-id-copyManager-create-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object- Specified by:
_verifyin classModelObject- Parameters:
verifiedIds- 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
-
getRelationshipType
- Returns:
- the relationshipType
- Throws:
InvalidSPDXAnalysisException
-
setRelationshipType
Set the relationship type- Parameters:
type-- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
getComment
- Returns:
- the comment
- Throws:
InvalidSPDXAnalysisException
-
setComment
- Parameters:
comment- the comment to set- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
getRelatedSpdxElement
- Returns:
- the relatedSpdxElement
- Throws:
InvalidSPDXAnalysisException
-
setRelatedSpdxElement
public Relationship setRelatedSpdxElement(SpdxElement relatedSpdxElement) throws InvalidSPDXAnalysisException- Parameters:
relatedSpdxElement- the relatedSpdxElement to set- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
compareTo
- Specified by:
compareToin interfaceComparable<Relationship>
-
toString
- Overrides:
toStringin classModelObject
-