Package org.spdx.storage.simple
Class StoredTypedItem
java.lang.Object
org.spdx.library.model.TypedValue
org.spdx.storage.simple.StoredTypedItem
public class StoredTypedItem extends TypedValue
Individual item to be stored in memory
- Author:
- Gary O'Neall
-
Constructor Summary
Constructors Constructor Description StoredTypedItem(String documentUri, String id, String type) -
Method Summary
Modifier and Type Method Description booleanaddValueToList(String propertyName, Object value)Adds a value to a property list for a String or Boolean type of value creating the propertyName if it does not existvoidclearPropertyValueList(String propertyName)Sets the value list for the property to an empty list creating the propertyName if it does not existbooleancollectionContains(String propertyName, Object value)intcollectionSize(String propertyName)voidcopyValuesFrom(String fromDocumentUri, IModelStore store)Copy all values for this item from another storeintdecReferenceCount()Decrement the reference count for this stored type itemList<String>getPropertyValueNames()intgetReferenceCount()ObjectgetValue(String propertyName)Iterator<Object>getValueList(String propertyName)intincReferenceCount()Increment the reference count for this stored type item - the number of times this item is referencedbooleanisCollectionMembersAssignableTo(String propertyName, Class<?> clazz)booleanisCollectionProperty(String propertyName)booleanisPropertyValueAssignableTo(String propertyName, Class<?> clazz)voidremoveProperty(String propertyName)Removes a property from the document for the given ID if the property exists.booleanremoveTypedValueFromList(String propertyName, TypedValue value)booleanremoveValueFromList(String propertyName, Object value)Removes a property from a list if it existsvoidsetValue(String propertyName, Object value)booleanusesId(String elementId)
-
Constructor Details
-
StoredTypedItem
public StoredTypedItem(String documentUri, String id, String type) throws InvalidSPDXAnalysisException- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getPropertyValueNames
- Returns:
- Property names for all properties having a value
-
incReferenceCount
public int incReferenceCount()Increment the reference count for this stored type item - the number of times this item is referenced- Returns:
- new number of times this item is referenced
-
decReferenceCount
Decrement the reference count for this stored type item- Returns:
- new number of times this item is referenced
- Throws:
SpdxInvalidTypeException
-
getReferenceCount
- Returns:
- new number of times this item is referenced
- Throws:
SpdxInvalidTypeException
-
setValue
- Parameters:
propertyName- Name of the propertyvalue- Value to be set- Throws:
SpdxInvalidTypeException
-
clearPropertyValueList
Sets the value list for the property to an empty list creating the propertyName if it does not exist- Parameters:
propertyName- Name of the property- Throws:
SpdxInvalidTypeException
-
addValueToList
Adds a value to a property list for a String or Boolean type of value creating the propertyName if it does not exist- Parameters:
propertyName- Name of the propertyvalue- Value to be set- Throws:
SpdxInvalidTypeException
-
removeTypedValueFromList
public boolean removeTypedValueFromList(String propertyName, TypedValue value) throws SpdxInvalidTypeException- Throws:
SpdxInvalidTypeException
-
removeValueFromList
public boolean removeValueFromList(String propertyName, Object value) throws SpdxInvalidTypeExceptionRemoves a property from a list if it exists- Parameters:
propertyName-value-- Throws:
SpdxInvalidTypeException
-
getValueList
- Parameters:
propertyName- Name of the property- Returns:
- List of values associated with the id, propertyName and document
- Throws:
SpdxInvalidTypeException
-
getValue
- Parameters:
propertyName- Name of the property- Returns:
- the single value associated with the id, propertyName and document
-
removeProperty
Removes a property from the document for the given ID if the property exists. Does not raise any exception if the propertyName does not exist- Parameters:
propertyName- Name of the property
-
copyValuesFrom
public void copyValuesFrom(String fromDocumentUri, IModelStore store) throws InvalidSPDXAnalysisExceptionCopy all values for this item from another store- Parameters:
fromDocumentUri-store-- Throws:
InvalidSPDXAnalysisException
-
collectionSize
- Parameters:
propertyName-- Returns:
- Size of the collection
- Throws:
SpdxInvalidTypeException
-
collectionContains
public boolean collectionContains(String propertyName, Object value) throws SpdxInvalidTypeException- Parameters:
propertyName- property namevalue- value to be checked- Returns:
- true if value is in the list associated with the property name
- Throws:
SpdxInvalidTypeException
-
isCollectionMembersAssignableTo
-
isPropertyValueAssignableTo
-
isCollectionProperty
- Parameters:
propertyName- property name- Returns:
- true if there is a list associated with the property name
-
usesId
- Parameters:
elementId- id for the element to check- Returns:
- true if an element using the id is used as a value in a collection
-