/** * Remove the given object from this AbstractReferenceManufacturer. Returns true if the object was * removed from this AbstractReferenceManufacturer; false otherwise. * * @param item The object to be removed from this AbstractReferenceManufacturer. * @return true if the object was removed from this AbstractReferenceManufacturer; false * otherwise. */ @Override public boolean forgetObject(T item) { if (!factory.isMember(item)) { throw new IllegalArgumentException( "Object to be forgotten does not match Class " + "of this AbstractReferenceManufacturer"); } String key = active.getKeyFor(item); if (key == null) { /* * TODO This is a bug - the key name is not necessarily loaded into * the object, it may have been consumed by the object context... :P */ CaseInsensitiveString ocik = new CaseInsensitiveString(item.getKeyName()); duplicates.removeFromListFor(ocik, item); } else { CaseInsensitiveString ocik = new CaseInsensitiveString(key); List<T> list = duplicates.getListFor(ocik); if (list == null) { // No replacement active.remove(key); } else { T newActive = duplicates.getElementInList(ocik, 0); duplicates.removeFromListFor(ocik, newActive); active.put(key, newActive); } } return true; }