boolean equal(@Nullable Binding binding, @Nullable Object currentValue, @Nullable Object defaultValue) {
    if (defaultValue instanceof Element && currentValue instanceof Element) {
      return JDOMUtil.areElementsEqual((Element)currentValue, (Element)defaultValue);
    }

    if (currentValue == defaultValue) {
      return true;
    }
    if (currentValue == null || defaultValue == null) {
      return false;
    }

    if (binding instanceof TagBinding) {
      Binding referencedBinding = ((TagBinding)binding).binding;
      if (referencedBinding instanceof BeanBinding) {
        BeanBinding classBinding = (BeanBinding)referencedBinding;
        ThreeState compareByFields = classBinding.compareByFields;
        if (compareByFields == ThreeState.UNSURE) {
          Method method = null;
          try {
            method = classBinding.beanClass.getDeclaredMethod("equals", Object.class);
          }
          catch (NoSuchMethodException ignore) {
          }
          compareByFields = method == null ? ThreeState.YES : ThreeState.NO;
          classBinding.compareByFields = compareByFields;
        }

        if (compareByFields == ThreeState.YES) {
          return classBinding.equalByFields(currentValue, defaultValue, this);
        }
      }
    }

    return Comparing.equal(currentValue, defaultValue);
  }
boolean equal(@Nullable Binding binding, @Nullable Object currentValue, @Nullable Object defaultValue)