void (final DomElement other) { if (other == getProxy()) return; assert other.getDomElementType().equals(myType) : "Can't copy from " + other.getDomElementType() + " to " + myType; if (other.getXmlElement() == null) { undefine(); return; } myManager.performAtomicChange(() -> { ensureXmlElementExists(); final DomInvocationHandler otherInvocationHandler = DomManagerImpl.getDomInvocationHandler(other); assert otherInvocationHandler != null : other; final DomGenericInfoEx genericInfo = otherInvocationHandler.getGenericInfo(); for (final AttributeChildDescriptionImpl description : genericInfo.getAttributeChildrenDescriptions()) { description.getDomAttributeValue(this).setStringValue(description.getDomAttributeValue(other).getRawText()); } for (final DomFixedChildDescription description : genericInfo.getFixedChildrenDescriptions()) { final List<? extends DomElement> list = description.getValues(getProxy()); final List<? extends DomElement> otherValues = description.getValues(other); for (int i = 0; i < list.size(); i++) { final DomElement otherValue = otherValues.get(i); final DomElement value = list.get(i); if (!DomUtil.hasXml(otherValue)) { value.undefine(); } else { value.copyFrom(otherValue); } } } for (final DomCollectionChildDescription description : genericInfo.getCollectionChildrenDescriptions()) { for (final DomElement value : description.getValues(getProxy())) { value.undefine(); } for (final DomElement otherValue : description.getValues(other)) { description.addValue(getProxy(), otherValue.getDomElementType()).copyFrom(otherValue); } } final String stringValue = otherInvocationHandler.getValue(); if (StringUtil.isNotEmpty(stringValue)) { setValue(stringValue); } }); if (!myManager.isInsideAtomicChange()) { myManager.fireEvent(new DomEvent(getProxy(), false)); } }