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 storeList<String>getPropertyValueNames()ObjectgetValue(String propertyName)Iterator<Object>getValueList(String propertyName)booleanisCollectionMembersAssignableTo(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.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
-
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
-
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- Throws:
SpdxInvalidTypeException
-
isCollectionMembersAssignableTo
-
isPropertyValueAssignableTo
-
isCollectionProperty
-
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
-