diff --git a/src/main/java/org/spdx/storage/simple/StoredTypedItem.java b/src/main/java/org/spdx/storage/simple/StoredTypedItem.java
index a16c7e0e..9cde8f3b 100644
--- a/src/main/java/org/spdx/storage/simple/StoredTypedItem.java
+++ b/src/main/java/org/spdx/storage/simple/StoredTypedItem.java
@@ -58,13 +58,32 @@ public class StoredTypedItem extends TypedValue {
private int referenceCount = 0;
private final ReadWriteLock countLock = new ReentrantReadWriteLock();
-
+
+ /**
+ * Construct a new {@link StoredTypedItem} with the specified object URI, type, and
+ * specification version
+ *
+ * This constructor initializes a stored typed item, which represents an individual item to be
+ * stored in memory with its associated properties and metadata.
+ *
+ * @param objectUri The unique URI identifying this stored item.
+ * @param type The type of the stored item.
+ * @param specVersion The version of the SPDX specification associated with this item.
+ * @throws InvalidSPDXAnalysisException If the provided parameters are invalid or violate SPDX
+ * constraints.
+ */
public StoredTypedItem(String objectUri, String type, String specVersion) throws InvalidSPDXAnalysisException {
super(objectUri, type, specVersion);
}
-
+
/**
- * @return property descriptors for all properties having a value
+ * Retrieve the property descriptors for all properties that have a value
+ *
+ * This method iterates through the stored properties and collects the descriptors
+ * for all properties that currently have an associated value.
+ *
+ * @return An unmodifiable {@link List} of {@link PropertyDescriptor} objects representing
+ * the properties that have values.
*/
public List getPropertyValueDescriptors() {
Iterator> iter = this.properties.entrySet().iterator();
@@ -75,10 +94,12 @@ public List getPropertyValueDescriptors() {
}
return Collections.unmodifiableList(retval);
}
-
+
/**
- * Increment the reference count for this stored type item - the number of times this item is referenced
- * @return new number of times this item is referenced
+ * Increment the reference count for this stored type item - the number of times this item is
+ * referenced
+ *
+ * @return The new number of times this item is referenced.
*/
@SuppressWarnings("UnusedReturnValue")
public int incReferenceCount() {
@@ -93,7 +114,8 @@ public int incReferenceCount() {
/**
* Decrement the reference count for this stored type item
- * @return new number of times this item is referenced
+ *
+ * @return The new number of times this item is referenced.
* @throws SpdxInvalidTypeException on invalid type
*/
public int decReferenceCount() throws SpdxInvalidTypeException {
@@ -108,9 +130,11 @@ public int decReferenceCount() throws SpdxInvalidTypeException {
countLock.writeLock().unlock();
}
}
-
- /**
- * @return new number of times this item is referenced
+
+ /**
+ * Retrieve the current reference count for this stored item
+ *
+ * @return The current number of times this item is referenced.
*/
public int getReferenceCount() {
countLock.readLock().lock();
@@ -120,13 +144,16 @@ public int getReferenceCount() {
countLock.readLock().unlock();
}
}
-
+
/**
- * @param propertyDescriptor Descriptor for the property
- * @param value Value to be set
+ * Set the value for the specified property descriptor
+ *
+ * @param propertyDescriptor The descriptor for the property. Must not be {@code null}.
+ * @param value The value to be set. Must not be {@code null}.
* @throws SpdxInvalidTypeException on invalid type
*/
- public void setValue(PropertyDescriptor propertyDescriptor, Object value) throws SpdxInvalidTypeException {
+ public void setValue(PropertyDescriptor propertyDescriptor, Object value)
+ throws SpdxInvalidTypeException {
Objects.requireNonNull(propertyDescriptor, "Property descriptor can not be null");
Objects.requireNonNull(value, "Value can not be null");
if (value instanceof CoreModelObject) {
@@ -145,14 +172,17 @@ public void setValue(PropertyDescriptor propertyDescriptor, Object value) throws
}
properties.put(propertyDescriptor, value);
}
-
+
/**
- * Sets the value list for the property to an empty list creating the propertyDescriptor if it does not exist
- * @param propertyDescriptor descriptor for the property
+ * Set the value list for the property to an empty list creating the propertyDescriptor if it
+ * does not exist
+ *
+ * @param propertyDescriptor The descriptor for the property. Must not be {@code null}.
* @throws SpdxInvalidTypeException on invalid type
*/
- public void clearPropertyValueList(PropertyDescriptor propertyDescriptor) throws SpdxInvalidTypeException {
- Objects.requireNonNull(propertyDescriptor, "property descriptor can not be null");
+ public void clearPropertyValueList(PropertyDescriptor propertyDescriptor)
+ throws SpdxInvalidTypeException {
+ Objects.requireNonNull(propertyDescriptor, "Property descriptor can not be null");
Object value = properties.get(propertyDescriptor);
if (value == null) {
return;
@@ -166,12 +196,15 @@ public void clearPropertyValueList(PropertyDescriptor propertyDescriptor) throws
}
/**
- * Adds a value to a property list for a String or Boolean type of value creating the propertyDescriptor if it does not exist
- * @param propertyDescriptor Descriptor for the property
- * @param value Value to be set
+ * Add a value to a property list for a String or Boolean type of value creating the
+ * propertyDescriptor if it does not exist
+ *
+ * @param propertyDescriptor The descriptor for the property. Must not be {@code null}.
+ * @param value Th value to be set. Must not be {@code null}.
* @throws SpdxInvalidTypeException on invalid type
*/
- public boolean addValueToList(PropertyDescriptor propertyDescriptor, Object value) throws SpdxInvalidTypeException {
+ public boolean addValueToList(PropertyDescriptor propertyDescriptor, Object value)
+ throws SpdxInvalidTypeException {
Objects.requireNonNull(propertyDescriptor, "Property descriptor can not be null");
Objects.requireNonNull(value, "Value can not be null");
if (value instanceof CoreModelObject) {
@@ -217,15 +250,17 @@ public boolean addValueToList(PropertyDescriptor propertyDescriptor, Object valu
throw new SpdxInvalidTypeException("Invalid list type for "+propertyDescriptor);
}
}
-
/**
- * @param propertyDescriptor descriptor for the property
- * @param value to be removed
- * @return true if the value was removed, false if the value did not exist
+ * Remove a property from a property list if it exists
+ *
+ * @param propertyDescriptor The descriptor for the property.
+ * @param value The value to be removed.
+ * @return {@code true} if the value was removed, {@code false} if the value did not exist.
* @throws SpdxInvalidTypeException for an invalid type
*/
- public boolean removeTypedValueFromList(PropertyDescriptor propertyDescriptor, TypedValue value) throws SpdxInvalidTypeException {
+ public boolean removeTypedValueFromList(PropertyDescriptor propertyDescriptor, TypedValue value)
+ throws SpdxInvalidTypeException {
Object map = properties.get(propertyDescriptor);
if (map == null) {
return false;
@@ -247,13 +282,16 @@ public boolean removeTypedValueFromList(PropertyDescriptor propertyDescriptor, T
}
/**
- * Removes a property from a list if it exists
- * @param propertyDescriptor descriptor for the property
- * @param value value to remove
+ * Remove a property from a property list if it exists
+ *
+ * @param propertyDescriptor The descriptor for the property. Must not be {@code null}.
+ * @param value The value to be removed. Must not be {@code null}.
+ * @return {@code true} if the value was removed, {@code false} if the value did not exist.
* @throws SpdxInvalidTypeException on invalid type
*/
- public boolean removeValueFromList(PropertyDescriptor propertyDescriptor, Object value) throws SpdxInvalidTypeException {
- Objects.requireNonNull(propertyDescriptor, "property descriptor can not be null");
+ public boolean removeValueFromList(PropertyDescriptor propertyDescriptor, Object value)
+ throws SpdxInvalidTypeException {
+ Objects.requireNonNull(propertyDescriptor, "Property descriptor can not be null");
Objects.requireNonNull(value, "Value can not be null");
Object map = properties.get(propertyDescriptor);
if (map == null) {
@@ -280,14 +318,20 @@ public boolean removeValueFromList(PropertyDescriptor propertyDescriptor, Object
throw new SpdxInvalidTypeException("Invalid list type for "+propertyDescriptor);
}
}
-
+
/**
- * @param propertyDescriptor Descriptor for the property
- * @return List of values associated with the objectUri, propertyDescriptor and document
- * @throws SpdxInvalidTypeException on invalid type
+ * Retrieve an iterator over the list of values associated with the specified property
+ * descriptor
+ *
+ * @param propertyDescriptor The descriptor for the property. Must not be {@code null}.
+ * @return An {@link Iterator} over the list of values associated with the property descriptor.
+ * If no values exist, an empty iterator is returned.
+ * @throws SpdxInvalidTypeException If the property is not associated with a list or if the type
+ * is invalid.
*/
- public Iterator