@Override public void onAttributesChanged(E element, final Map<String, String> oldValues, final Map<String, String> newValues) { assert element.equals(this.element) : "Received event for unrelated element"; final Map<K, V> oldFields = CollectionUtils.newHashMap(); final Map<K, V> newFields = CollectionUtils.newHashMap(); K[] names = keyClass.getEnumConstants(); for (K name : names) { if (oldValues.containsKey(name.toString()) || newValues.containsKey(name.toString())) { String oldValueStr = oldValues.get(name.toString()); String newValueStr = newValues.get(name.toString()); V oldValue = serializer.fromString(oldValueStr); V newValue = serializer.fromString(newValueStr); if (ValueUtils.notEqual(oldValue, newValue)) { oldFields.put(name, oldValue); newFields.put(name, newValue); } } } assert oldFields.keySet().equals(newFields.keySet()); if (!oldFields.isEmpty()) { triggerOnValuesChanged(oldFields, newFields); } }