/** * {@inheritDoc} */ @Override public <A extends Attribute> A putAttributeInstance(A attributeInstance) { synchronized (attributesInstancesLock) { if (attributeInstance.getEntity() != this) throw new IllegalArgumentException("attributeInstance " + attributeInstance + " not compatible with " + this); A oldAttInstance = (A) attributesInstances.put(attributeInstance.getClass(), attributeInstance); if (attributeInstance != oldAttInstance) { attributeInstance.addObserver(attsInstancesObserver); this.notifyElementUpdated(ContextEvent.ATTINSTANCE_PUT, attributeInstance); } return oldAttInstance; } }
alternativeObservers.put(attributeInstance.getId(), alter = new AlternativeObserver( attributeInstance)); attributeInstance.addObserver(alter);