class MBeanSelector {

    boolean mayMergeWith(MBeanSelector other) {
        if (!Objects.equals(keyName, other.keyName)) return false;
        if (!Objects.equals(key, other.key)) return false;
        if (!Objects.equals(type, other.type)) return false;
        if (!Objects.equals(prefix, other.prefix)) return false;

        for (String key : nestedSelectors.keySet())
            if (other.nestedSelectors.containsKey(key) && !mayMergeCorrespondingChildren(key, other)) return false;
        return true;
    }

    private  MBeanSelector(Map<String, Object> map);
    private  MBeanSelector(MBeanSelector first, MBeanSelector second);

}