private static void registerXmlb(DomExtensionsRegistrar registrar,
                                   @Nullable PsiClass psiClass,
                                   @NotNull List<With> elements) {
    if (psiClass == null) return;

    ExtensionPointBinding binding = new ExtensionPointBinding(psiClass);
    binding.visit(new ExtensionPointBinding.BindingVisitor() {

      @Override
      public void visitAttribute(@NotNull PsiField field, @NotNull @NonNls String attributeName, RequiredFlag required) {
        final With withElement = findWithElement(elements, field);
        final PsiType fieldType = field.getType();
        Class<?> clazz = String.class;
        if (PsiTypes.booleanType().equals(fieldType)) {
          clazz = Boolean.class;
        }
        else if (PsiTypes.intType().equals(fieldType) ||
                 fieldType.equalsToText(CommonClassNames.JAVA_LANG_INTEGER)) {
          clazz = Integer.class;
        }
        else if (withElement != null || Extension.isClassField(attributeName)) {
          clazz = PsiClass.class;
        }
        final DomExtension extension =
          registrar.registerGenericAttributeValueChildExtension(new XmlName(attributeName), clazz).setDeclaringElement(field);
        markAsRequired(extension, required);

        if (clazz == String.class) {
          markStringProperty(extension, field, fieldType, attributeName);
        }
        else if (clazz == PsiClass.class) {
          markAsClass(extension, true, withElement);
        }
      }

      @Override
      public void visitTagOrProperty(@NotNull PsiField field, @NotNull String tagName, RequiredFlag required) {
        boolean isBoolean = PsiTypes.booleanType().equals(field.getType());

        final DomExtension extension =
          registrar.registerFixedNumberChildExtension(new XmlName(tagName), isBoolean ? SimpleBooleanTagValue.class : SimpleTagValue.class)
            .setDeclaringElement(field);
        markAsRequired(extension, required);

        if (isBoolean) {
          return;
        }

        final With withElement = findWithElement(elements, field);
        markAsClass(extension, Extension.isClassField(field.getName()), withElement);

        markStringProperty(extension, field, field.getType(), tagName);
      }

      @Override
      public void visitXCollection(@NotNull PsiField field,
                                   @Nullable String tagName,
                                   @NotNull PsiAnnotation collectionAnnotation,
                                   RequiredFlag required) {
        if (tagName == null) {
          registerCollectionBinding(field, registrar, collectionAnnotation, required);
          return;
        }

        registrar.registerFixedNumberChildExtension(new XmlName(tagName), DomElement.class).addExtender(new DomExtender() {
          @Override
          public void registerExtensions(@NotNull DomElement domElement, @NotNull DomExtensionsRegistrar registrar) {
            registerCollectionBinding(field, registrar, collectionAnnotation, required);
          }
        });
      }
    });
  }
private static void registerXmlb(DomExtensionsRegistrar registrar,
                                   @Nullable PsiClass psiClass,
                                   @NotNull List<With> elements)