/** * Adds an object to the contents of this AbstractReferenceManufacturer. This is used in * conditions where this AbstractReferenceManufacturer was not used to construct the object. * * <p>Implementation Note: There are various situations where this "external construction" may * happen - the primary one being loading of "game mode" information like CDOMStat objects. * * @param item The object to be imported into this AbstractReferenceManufacturer * @param key The identifier of the object to be imported into this AbstractReferenceManufacturer * @throws IllegalArgumentException if the given object is not of the Class that this * AbstractReferenceManufacturer constructs and references */ @Override public void addObject(T item, String key) { if (!factory.isMember(item)) { throw new IllegalArgumentException( "Attempted to register a " + item.getClass().getName() + " in " + factory.getReferenceDescription()); } T current = active.get(key); if (current == null) { active.put(key, item); } else { duplicates.addToListFor(new CaseInsensitiveString(key), item); } }