public MapBinding(ParameterizedType type, Accessor accessor) {
    Type[] arguments = type.getActualTypeArguments();
    Type keyType = arguments[0];
    Type valueType = arguments[1];

    myKeyBinding = XmlSerializerImpl.getBinding(keyType);
    myValueBinding = XmlSerializerImpl.getBinding(valueType);
    myMapAnnotation =
        XmlSerializerImpl.findAnnotation(accessor.getAnnotations(), MapAnnotation.class);
  }
  public Object deserialize(Object o, @NotNull Object... nodes) {
    Map map = (Map) o;
    map.clear();

    final Object[] childNodes;

    if (myMapAnnotation == null || myMapAnnotation.surroundWithTag()) {
      assert nodes.length == 1;
      Element m = (Element) nodes[0];
      childNodes = JDOMUtil.getContent(m);
    } else {
      childNodes = nodes;
    }

    for (Object childNode : childNodes) {
      if (XmlSerializerImpl.isIgnoredNode(childNode)) continue;

      Element entry = (Element) childNode;

      Object k = null;
      Object v = null;

      assert entry.getName().equals(getEntryAttributeName());

      Attribute keyAttr = entry.getAttribute(getKeyAttributeValue());
      if (keyAttr != null) {
        k = myKeyBinding.deserialize(o, keyAttr);
      } else {
        if (myMapAnnotation != null && !myMapAnnotation.surroundKeyWithTag()) {
          final Object[] children = JDOMUtil.getContent(entry);
          for (Object child : children) {
            if (myKeyBinding.isBoundTo(child)) {
              k = myKeyBinding.deserialize(o, child);
              break;
            }
          }

          assert k != null : "no key found";
        } else {
          final Object keyNode = entry.getChildren(getKeyAttributeValue()).get(0);
          k = myKeyBinding.deserialize(o, JDOMUtil.getContent((Element) keyNode));
        }
      }

      Attribute valueAttr = entry.getAttribute(getValueAttributeName());
      if (valueAttr != null) {
        v = myValueBinding.deserialize(o, valueAttr);
      } else {
        if (myMapAnnotation != null && !myMapAnnotation.surroundValueWithTag()) {
          final Object[] children = JDOMUtil.getContent(entry);
          for (Object child : children) {
            if (myValueBinding.isBoundTo(child)) {
              v = myValueBinding.deserialize(o, child);
              break;
            }
          }

          assert v != null : "no value found";
        } else {
          final Object valueNode = entry.getChildren(getValueAttributeName()).get(0);
          v =
              myValueBinding.deserialize(
                  o, XmlSerializerImpl.getNotIgnoredContent((Element) valueNode));
        }
      }

      //noinspection unchecked
      map.put(k, v);
    }

    return map;
  }