Class ModelObject

java.lang.Object
org.spdx.library.model.ModelObject
Direct Known Subclasses:
Annotation, AnyLicenseInfo, Checksum, CompoundPointer, CrossRef, ExternalDocumentRef, ExternalRef, GenericModelObject, LicenseException, Relationship, SinglePointer, SpdxCreatorInformation, SpdxElement, SpdxPackageVerificationCode

public abstract class ModelObject
extends Object
Author:
Gary O'Neall Superclass for all SPDX model objects Provides the primary interface to the storage class that access and stores the data for the model objects. This class includes several helper methods to manage the storage and retrieval of properties. Each model object is in itself stateless. All state is maintained in the Model Store. The Document URI uniquely identifies the document containing the model object. The concrete classes are expected to implements getters for the model class properties which translate into calls to the getTYPEPropertyValue where TYPE is the type of value to be returned and the property name is passed as a parameter. There are 2 methods of setting values: - call the setPropertyValue, clearValueCollection or addValueToCollection methods - this will call the modelStore and store the value immediately - Gather a list of updates by calling the updatePropertyValue, updateClearValueList, or updateAddPropertyValue methods. These methods return a ModelUpdate which can be applied later by calling the apply() method. A convenience method Write.applyUpdatesInOneTransaction will perform all updates within a single transaction. This method may result in higher performance updates for some Model Store implementations. Note that none of the updates will be applied until the storage manager update method is invoked. Property values are restricted to the following types: - String - Java Strings - Booolean - Java Boolean or primitive boolean types - ModelObject - A concrete subclass of this type - Collection<T> - A Collection of type T where T is one of the supported non-collection types This class also handles the conversion of a ModelObject to and from a TypeValue for storage in the ModelStore.