* {@link Item#getItemPropertyIds()}).
* <li>all Properties in the Items corresponding to the same Property ID must
* have the same data type.
+ * <li>All Items within a container are uniquely identified by their non-null ids
* </ul>
*
* <p>
/**
* <p>
* Provides a mechanism for handling a set of Properties, each associated to a
- * locally unique identifier. The interface is split into subinterfaces to
+ * locally unique non-null identifier. The interface is split into subinterfaces to
* enable a class to implement only the functionalities it needs.
* </p>
*
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
final Item item = container.addItem(itemId);
if (!hierarchical && item != null) {
addToHierarchyWrapper(itemId);
* not found in the list
*/
public Item getItem(Object itemId) {
+
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
if (items.containsKey(itemId)
&& (filteredItemIds == null || filteredItemIds.contains(itemId))) {
return new IndexedContainerItem(itemId);
*/
public Item addItem(Object itemId) {
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
// Makes sure that the Item has not been created yet
if (items.containsKey(itemId)) {
return null;
*/
private IndexedContainerProperty(Object itemId, Object propertyId) {
if (itemId == null || propertyId == null) {
- throw new NullPointerException();
+ // Null ids are not accepted
+ throw new NullPointerException("Container item or property ids can not be null");
}
this.propertyId = propertyId;
this.itemId = itemId;
*/
public boolean addItemProperty(Object id, Property property) {
+ // Null ids are not accepted
+ if (id == null) throw new NullPointerException("Item property id can not be null");
+
// Cant add a property twice
if (map.containsKey(id)) {
return false;