NestedBinding (@NotNull MutableAccessor accessor, @NotNull Serializer serializer, @NotNull Property.Style propertyStyle) { Attribute attribute = accessor.getAnnotation(Attribute.class); if (attribute != null) { return new AttributeBinding(accessor, attribute); } Text text = accessor.getAnnotation(Text.class); if (text != null) { return new TextBinding(accessor); } OptionTag optionTag = accessor.getAnnotation(OptionTag.class); if (optionTag != null && optionTag.converter() != Converter.class) { return new OptionTagBinding(accessor, optionTag); } Binding binding = serializer.getBinding(accessor); if (binding instanceof JDOMElementBinding) { return ((JDOMElementBinding)binding); } Tag tag = accessor.getAnnotation(Tag.class); if (tag != null) { return new TagBinding(accessor, tag); } if (binding instanceof CompactCollectionBinding) { return new AccessorBindingWrapper(accessor, binding, false, Property.Style.OPTION_TAG); } boolean surroundWithTag = true; boolean inline = false; Property property = accessor.getAnnotation(Property.class); if (property != null) { surroundWithTag = property.surroundWithTag(); inline = property.flat(); } if (!surroundWithTag || inline) { if (inline && !(binding instanceof BeanBinding)) { throw new XmlSerializationException("inline supported only for BeanBinding: " + accessor); } if (binding == null || binding instanceof TextBinding) { throw new XmlSerializationException("Text-serializable properties can't be serialized without surrounding tags: " + accessor); } return new AccessorBindingWrapper(accessor, binding, inline, property.style()); } XCollection xCollection = accessor.getAnnotation(XCollection.class); if (xCollection != null && (!xCollection.propertyElementName().isEmpty() || xCollection.style() == XCollection.Style.v2)) { return new TagBinding(accessor, xCollection.propertyElementName()); } if (optionTag == null) { XMap xMap = accessor.getAnnotation(XMap.class); if (xMap != null) { return new TagBinding(accessor, xMap.propertyElementName()); } } if (propertyStyle == Property.Style.ATTRIBUTE) { return new AttributeBinding(accessor, null); } return new OptionTagBinding(accessor, optionTag); }