Object (@NotNull Object context, @NotNull Element element) { Attribute valueAttribute = element.getAttribute(myValueAttribute); if (valueAttribute == null) { if (myValueAttribute.isEmpty()) { assert binding != null; accessor.set(context, binding.deserializeUnsafe(context, element)); } else { List<Element> children = element.getChildren(); if (children.isEmpty()) { if (binding instanceof CollectionBinding || binding instanceof MapBinding) { Object oldValue = accessor.read(context); // do nothing if field is already null if (oldValue != null) { Object newValue = ((MultiNodeBinding)binding).deserializeList(oldValue, children); if (oldValue != newValue) { accessor.set(context, newValue); } } } else { accessor.set(context, null); } } else { assert binding != null; Object oldValue = accessor.read(context); Object newValue = Binding.deserializeList(binding, oldValue, children); if (oldValue != newValue) { accessor.set(context, newValue); } } } } else { String value = valueAttribute.getValue(); if (converter == null) { try { XmlSerializerImpl.doSet(context, value, accessor, ClassUtil.typeToClass(accessor.getGenericType())); } catch (Exception e) { throw new RuntimeException("Cannot set value for field " + name, e); } } else { accessor.set(context, converter.fromString(value)); } } return context; }