public boolean equals()

in scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/resources/PhoneNumber.java [212:275]


  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    PhoneNumber other = (PhoneNumber) obj;

    if (isGlobalNumber != other.isGlobalNumber)
      return false;

    String numberWithoutVisualSeparators = number != null ? number.replaceAll(VISUAL_SEPARATORS, "") : null;
    String otherNumberWithoutVisualSeparators = other.number != null ? other.number.replaceAll(VISUAL_SEPARATORS, "") : null;
    if (numberWithoutVisualSeparators == null) {
      if (otherNumberWithoutVisualSeparators != null)
        return false;
    } else if (!numberWithoutVisualSeparators.equals(otherNumberWithoutVisualSeparators))
      return false;

    String extensionWithoutVisualSeparators = extension != null ? extension.replaceAll(VISUAL_SEPARATORS, "") : null;
    String otherExtensionWithoutVisualSeparators = other.extension != null ? other.extension.replaceAll(VISUAL_SEPARATORS, "") : null;
    if (extensionWithoutVisualSeparators == null) {
      if (otherExtensionWithoutVisualSeparators != null)
        return false;
    } else if (!extensionWithoutVisualSeparators.equals(otherExtensionWithoutVisualSeparators))
      return false;

    if (subAddress == null) {
      if (other.subAddress != null)
        return false;
    } else if (!equalsIgnoreCase(subAddress, other.subAddress))
      return false;

    String phoneContextTemp = phoneContext;
    if (!StringUtils.isBlank(phoneContext) && !isDomainPhoneContext) {
      phoneContextTemp = phoneContext.replaceAll(VISUAL_SEPARATORS, "");
    }

    String otherPhoneContextTemp = other.phoneContext;
    if (!StringUtils.isBlank(other.phoneContext) && !other.isDomainPhoneContext) {
      otherPhoneContextTemp = other.phoneContext.replaceAll(VISUAL_SEPARATORS, "");
    }

    if (phoneContextTemp == null) {
      if (otherPhoneContextTemp != null)
        return false;
    } else if (!equalsIgnoreCase(phoneContextTemp, otherPhoneContextTemp))
      return false;

    if (!equalsIgnoreCaseAndOrderParams(other.params)) {
      return false;
    }

    if (primary == null) {
      if (other.primary != null)
        return false;
    } else if (!primary.equals(other.primary))
      return false;

    if (type == null) {
        return other.type == null;
    } else return equalsIgnoreCase(type, other.type);
  }