diff --git a/CHANGELOG.md b/CHANGELOG.md index bb383844..f0dd2dfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ Corrected an annotation in `PatchRequest` which did not mark `Operations` with a Fixed an issue where Jackson `JsonReadFeature` properties were not used despite the property being set on the MapperFactory. +Fixed `hashCode()` implementations in `Session.java` and `ExternalIdentity.java` which previously +did not include the values of `id` and `meta`. + ## 6.0.0 - 2026-May-11 The UnboundID SCIM SDK has been updated to use version 3 of the Jackson library (this release ships with v3.1.3). This change aligns the SCIM SDK with HTTP libraries such as Spring Framework 7/Spring diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/BaseScimResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/BaseScimResource.java index 48c4a397..7f894a63 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/BaseScimResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/BaseScimResource.java @@ -496,29 +496,13 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - BaseScimResource that = (BaseScimResource) o; - if (!schemaUrns.equals(that.schemaUrns)) - { - return false; - } - if (!Objects.equals(id, that.id)) - { - return false; - } - if (!Objects.equals(externalId, that.externalId)) - { - return false; - } - if (!Objects.equals(meta, that.meta)) - { - return false; - } - return Objects.equals(extensionObjectNode, that.extensionObjectNode); + return o instanceof BaseScimResource that + && schemaUrns.equals(that.schemaUrns) + && Objects.equals(id, that.id) + && Objects.equals(externalId, that.externalId) + && Objects.equals(meta, that.meta) + && Objects.equals(extensionObjectNode, that.extensionObjectNode); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/GenericScimResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/GenericScimResource.java index da8c678c..6be225d2 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/GenericScimResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/GenericScimResource.java @@ -553,14 +553,13 @@ public String toString() @Override public boolean equals(@Nullable final Object o) { - if (!(o instanceof GenericScimResource resource)) + if (this == o) { - return false; + return true; } - // Null nodes should not occur, but we should be defensive about this - // possibility. - return Objects.equals(objectNode, resource.getObjectNode()); + return o instanceof GenericScimResource resource + && Objects.equals(objectNode, resource.getObjectNode()); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/Path.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/Path.java index fe64de1e..3a3f3249 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/Path.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/Path.java @@ -254,18 +254,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - Element element = (Element) o; - - if (!toLowerCase(attribute).equals(toLowerCase(element.attribute))) - { - return false; - } - return Objects.equals(valueFilter, element.valueFilter); + return o instanceof Element element + && Objects.equals(valueFilter, element.valueFilter) + && attribute.equalsIgnoreCase(element.attribute); } /** @@ -669,18 +660,11 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Path path = (Path) o; - if (schemaUrn != null ? !schemaUrn.equalsIgnoreCase(path.schemaUrn) : - path.schemaUrn != null) - { - return false; - } - return elements.equals(path.elements); + return o instanceof Path path + && (schemaUrn == null ? path.schemaUrn == null : + schemaUrn.equalsIgnoreCase(path.schemaUrn)) + && elements.equals(path.elements); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperation.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperation.java index 7f850c33..efe68401 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperation.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperation.java @@ -832,12 +832,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (!(o instanceof BulkOperation that)) - { - return false; - } - return Objects.equals(method, that.method) + return o instanceof BulkOperation that + && Objects.equals(method, that.method) && Objects.equals(path, that.path) && Objects.equals(bulkId, that.bulkId) && Objects.equals(version, that.version) diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperationResult.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperationResult.java index bf2c58ba..d18d8a03 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperationResult.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkOperationResult.java @@ -651,12 +651,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (!(o instanceof BulkOperationResult that)) - { - return false; - } - return Objects.equals(location, that.location) + return o instanceof BulkOperationResult that + && Objects.equals(location, that.location) && method.equals(that.method) && Objects.equals(bulkId, that.bulkId) && Objects.equals(version, that.version) diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkRequest.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkRequest.java index 4ec820c3..1dc498f4 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkRequest.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkRequest.java @@ -663,12 +663,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (!(o instanceof BulkRequest that)) - { - return false; - } - return Objects.equals(failOnErrors, that.failOnErrors) + return o instanceof BulkRequest that + && Objects.equals(failOnErrors, that.failOnErrors) && operations.equals(that.getOperations()); } diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkResponse.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkResponse.java index 37cea23b..1cc7cf4e 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkResponse.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/bulk/BulkResponse.java @@ -207,12 +207,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (!(o instanceof BulkResponse that)) - { - return false; - } - return operations.equals(that.operations); + return o instanceof BulkResponse that + && operations.equals(that.operations); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ErrorResponse.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ErrorResponse.java index 3c09b33d..e07ff166 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ErrorResponse.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ErrorResponse.java @@ -185,25 +185,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ErrorResponse that = (ErrorResponse) o; - if (status != that.status) - { - return false; - } - if (!Objects.equals(detail, that.detail)) - { - return false; - } - return Objects.equals(scimType, that.scimType); + return o instanceof ErrorResponse that + && super.equals(o) + && status == that.status + && Objects.equals(detail, that.detail) + && Objects.equals(scimType, that.scimType); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ListResponse.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ListResponse.java index 213f28ff..36ed00dd 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ListResponse.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/ListResponse.java @@ -468,37 +468,15 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ListResponse that = (ListResponse) o; - if (totalResults != that.totalResults) - { - return false; - } - if (!Objects.equals(itemsPerPage, that.itemsPerPage)) - { - return false; - } - if (!Objects.equals(startIndex, that.startIndex)) - { - return false; - } - if (!Objects.equals(previousCursor, that.previousCursor)) - { - return false; - } - if (!Objects.equals(nextCursor, that.nextCursor)) - { - return false; - } - return resources.equals(that.resources); + return o instanceof ListResponse that + && super.equals(o) + && totalResults == that.totalResults + && Objects.equals(itemsPerPage, that.itemsPerPage) + && Objects.equals(startIndex, that.startIndex) + && Objects.equals(previousCursor, that.previousCursor) + && Objects.equals(nextCursor, that.nextCursor) + && resources.equals(that.resources); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchOperation.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchOperation.java index 4e638df7..4e8caa62 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchOperation.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchOperation.java @@ -561,17 +561,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - AddOperation that = (AddOperation) o; - if (!Objects.equals(getPath(), that.getPath())) - { - return false; - } - return value.equals(that.value); + return o instanceof AddOperation that + && Objects.equals(getPath(), that.getPath()) + && value.equals(that.value); } /** @@ -766,18 +758,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - RemoveOperation that = (RemoveOperation) o; - if (!Objects.equals(value, that.value)) - { - return false; - } - - return Objects.equals(getPath(), that.getPath()); + return o instanceof RemoveOperation that + && Objects.equals(value, that.value) + && Objects.equals(getPath(), that.getPath()); } /** @@ -884,17 +867,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - ReplaceOperation that = (ReplaceOperation) o; - if (!Objects.equals(getPath(), that.getPath())) - { - return false; - } - return value.equals(that.value); + return o instanceof ReplaceOperation that + && Objects.equals(getPath(), that.getPath()) + && value.equals(that.value); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchRequest.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchRequest.java index 21fd9303..e0e42662 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchRequest.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/PatchRequest.java @@ -234,17 +234,10 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - PatchRequest that = (PatchRequest) o; - return operations.equals(that.operations); + return o instanceof PatchRequest that + && super.equals(o) + && operations.equals(that.operations); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/SearchRequest.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/SearchRequest.java index e816a01b..5c1cb582 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/SearchRequest.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/messages/SearchRequest.java @@ -356,45 +356,17 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - SearchRequest that = (SearchRequest) o; - if (!Objects.equals(attributes, that.attributes)) - { - return false; - } - if (!Objects.equals(excludedAttributes, that.excludedAttributes)) - { - return false; - } - if (!Objects.equals(filter, that.filter)) - { - return false; - } - if (!Objects.equals(sortBy, that.sortBy)) - { - return false; - } - if (sortOrder != that.sortOrder) - { - return false; - } - if (!Objects.equals(startIndex, that.startIndex)) - { - return false; - } - if (!Objects.equals(cursor, that.cursor)) - { - return false; - } - return Objects.equals(count, that.count); + return o instanceof SearchRequest that + && super.equals(o) + && Objects.equals(filter, that.filter) + && Objects.equals(sortBy, that.sortBy) + && sortOrder == that.sortOrder + && Objects.equals(startIndex, that.startIndex) + && Objects.equals(cursor, that.cursor) + && Objects.equals(count, that.count) + && Objects.equals(attributes, that.attributes) + && Objects.equals(excludedAttributes, that.excludedAttributes); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Address.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Address.java index b7784faf..63101a86 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Address.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Address.java @@ -344,41 +344,16 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Address address = (Address) o; - if (!Objects.equals(formatted, address.formatted)) - { - return false; - } - if (!Objects.equals(streetAddress, address.streetAddress)) - { - return false; - } - if (!Objects.equals(locality, address.locality)) - { - return false; - } - if (!Objects.equals(region, address.region)) - { - return false; - } - if (!Objects.equals(postalCode, address.postalCode)) - { - return false; - } - if (!Objects.equals(country, address.country)) - { - return false; - } - if (!Objects.equals(type, address.type)) - { - return false; - } - return Objects.equals(primary, address.primary); + return o instanceof Address address + && Objects.equals(formatted, address.formatted) + && Objects.equals(streetAddress, address.streetAddress) + && Objects.equals(locality, address.locality) + && Objects.equals(region, address.region) + && Objects.equals(postalCode, address.postalCode) + && Objects.equals(country, address.country) + && Objects.equals(type, address.type) + && Objects.equals(primary, address.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AttributeDefinition.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AttributeDefinition.java index 08657e77..d020744c 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AttributeDefinition.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AttributeDefinition.java @@ -1083,57 +1083,20 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - AttributeDefinition that = (AttributeDefinition) o; - if (caseExact != that.caseExact) - { - return false; - } - if (multiValued != that.multiValued) - { - return false; - } - if (required != that.required) - { - return false; - } - if (!Objects.equals(canonicalValues, that.canonicalValues)) - { - return false; - } - if (!Objects.equals(description, that.description)) - { - return false; - } - if (!Objects.equals(mutability, that.mutability)) - { - return false; - } - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(referenceTypes, that.referenceTypes)) - { - return false; - } - if (!Objects.equals(returned, that.returned)) - { - return false; - } - if (!Objects.equals(subAttributes, that.subAttributes)) - { - return false; - } - if (!Objects.equals(type, that.type)) - { - return false; - } - return Objects.equals(uniqueness, that.uniqueness); + return o instanceof AttributeDefinition that + && caseExact == that.caseExact + && multiValued == that.multiValued + && required == that.required + && Objects.equals(canonicalValues, that.canonicalValues) + && Objects.equals(description, that.description) + && Objects.equals(mutability, that.mutability) + && Objects.equals(name, that.name) + && Objects.equals(referenceTypes, that.referenceTypes) + && Objects.equals(returned, that.returned) + && Objects.equals(subAttributes, that.subAttributes) + && Objects.equals(type, that.type) + && Objects.equals(uniqueness, that.uniqueness); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AuthenticationScheme.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AuthenticationScheme.java index cbce6581..66f63cee 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AuthenticationScheme.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/AuthenticationScheme.java @@ -208,33 +208,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - AuthenticationScheme that = (AuthenticationScheme) o; - if (primary != that.primary) - { - return false; - } - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(description, that.description)) - { - return false; - } - if (!Objects.equals(specUri, that.specUri)) - { - return false; - } - if (!Objects.equals(documentationUri, that.documentationUri)) - { - return false; - } - return Objects.equals(type, that.type); + return o instanceof AuthenticationScheme that + && primary == that.primary + && Objects.equals(name, that.name) + && Objects.equals(description, that.description) + && Objects.equals(specUri, that.specUri) + && Objects.equals(documentationUri, that.documentationUri) + && Objects.equals(type, that.type); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/BulkConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/BulkConfig.java index 03b9cdcb..78767c2e 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/BulkConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/BulkConfig.java @@ -131,21 +131,11 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - BulkConfig that = (BulkConfig) o; - if (maxOperations != that.maxOperations) - { - return false; - } - if (maxPayloadSize != that.maxPayloadSize) - { - return false; - } - return supported == that.supported; + return o instanceof BulkConfig that + && maxOperations == that.maxOperations + && maxPayloadSize == that.maxPayloadSize + && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ChangePasswordConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ChangePasswordConfig.java index a3baf8a0..551ddc5d 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ChangePasswordConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ChangePasswordConfig.java @@ -90,13 +90,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - ChangePasswordConfig that = (ChangePasswordConfig) o; - return supported == that.supported; + return o instanceof ChangePasswordConfig that + && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ETagConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ETagConfig.java index 51a60c1b..9d232195 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ETagConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ETagConfig.java @@ -118,13 +118,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - ETagConfig that = (ETagConfig) o; - return supported == that.supported; + return o instanceof ETagConfig that + && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Email.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Email.java index d0806349..2c641101 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Email.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Email.java @@ -201,25 +201,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Email email = (Email) o; - if (!Objects.equals(value, email.value)) - { - return false; - } - if (!Objects.equals(display, email.display)) - { - return false; - } - if (!Objects.equals(type, email.type)) - { - return false; - } - return Objects.equals(primary, email.primary); + return o instanceof Email email + && Objects.equals(value, email.value) + && Objects.equals(display, email.display) + && Objects.equals(type, email.type) + && Objects.equals(primary, email.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/EnterpriseUserExtension.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/EnterpriseUserExtension.java index 7fe5cc3f..660a5cfa 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/EnterpriseUserExtension.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/EnterpriseUserExtension.java @@ -268,33 +268,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - EnterpriseUserExtension that = (EnterpriseUserExtension) o; - if (!Objects.equals(employeeNumber, that.employeeNumber)) - { - return false; - } - if (!Objects.equals(costCenter, that.costCenter)) - { - return false; - } - if (!Objects.equals(organization, that.organization)) - { - return false; - } - if (!Objects.equals(division, that.division)) - { - return false; - } - if (!Objects.equals(department, that.department)) - { - return false; - } - return Objects.equals(manager, that.manager); + return o instanceof EnterpriseUserExtension that + && Objects.equals(employeeNumber, that.employeeNumber) + && Objects.equals(costCenter, that.costCenter) + && Objects.equals(organization, that.organization) + && Objects.equals(division, that.division) + && Objects.equals(department, that.department) + && Objects.equals(manager, that.manager); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Entitlement.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Entitlement.java index e9868a8b..e34fa3e6 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Entitlement.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Entitlement.java @@ -195,25 +195,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Entitlement that = (Entitlement) o; - if (!Objects.equals(value, that.value)) - { - return false; - } - if (!Objects.equals(display, that.display)) - { - return false; - } - if (!Objects.equals(type, that.type)) - { - return false; - } - return Objects.equals(primary, that.primary); + return o instanceof Entitlement that + && Objects.equals(value, that.value) + && Objects.equals(display, that.display) + && Objects.equals(type, that.type) + && Objects.equals(primary, that.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/FilterConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/FilterConfig.java index c2bae728..89fe1f16 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/FilterConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/FilterConfig.java @@ -111,17 +111,10 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - FilterConfig that = (FilterConfig) o; - if (maxResults != that.maxResults) - { - return false; - } - return supported == that.supported; + return o instanceof FilterConfig that + && maxResults == that.maxResults + && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Group.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Group.java index bbc05588..845ad157 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Group.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Group.java @@ -226,25 +226,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Group group = (Group) o; - if (!Objects.equals(value, group.value)) - { - return false; - } - if (!Objects.equals(ref, group.ref)) - { - return false; - } - if (!Objects.equals(display, group.display)) - { - return false; - } - return Objects.equals(type, group.type); + return o instanceof Group group + && Objects.equals(value, group.value) + && Objects.equals(ref, group.ref) + && Objects.equals(display, group.display) + && Objects.equals(type, group.type); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/GroupResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/GroupResource.java index 2ff0e26f..bdc2c19e 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/GroupResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/GroupResource.java @@ -192,17 +192,11 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - final GroupResource that = (GroupResource) o; - return Objects.equals(displayName, that.displayName) && - Objects.equals(members, that.members); + + return o instanceof GroupResource that + && super.equals(o) + && Objects.equals(displayName, that.displayName) + && Objects.equals(members, that.members); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/InstantMessagingAddress.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/InstantMessagingAddress.java index 107166a9..a9c32553 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/InstantMessagingAddress.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/InstantMessagingAddress.java @@ -199,25 +199,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - InstantMessagingAddress im = (InstantMessagingAddress) o; - if (!Objects.equals(value, im.value)) - { - return false; - } - if (!Objects.equals(display, im.display)) - { - return false; - } - if (!Objects.equals(type, im.type)) - { - return false; - } - return Objects.equals(primary, im.primary); + return o instanceof InstantMessagingAddress ims + && Objects.equals(value, ims.value) + && Objects.equals(display, ims.display) + && Objects.equals(type, ims.type) + && Objects.equals(primary, ims.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/JsonReference.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/JsonReference.java index f9cd34d9..20d33b1b 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/JsonReference.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/JsonReference.java @@ -151,17 +151,9 @@ public boolean equals(@Nullable final Object o) return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - JsonReference that = (JsonReference) o; - if (set != that.set) - { - return false; - } - return Objects.equals(obj, that.obj); + return o instanceof JsonReference that + && set == that.set + && Objects.equals(obj, that.obj); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Manager.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Manager.java index 51c616af..c456367f 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Manager.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Manager.java @@ -164,21 +164,11 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Manager manager = (Manager) o; - if (!Objects.equals(value, manager.value)) - { - return false; - } - if (!Objects.equals(ref, manager.ref)) - { - return false; - } - return Objects.equals(displayName, manager.displayName); + return o instanceof Manager manager + && Objects.equals(value, manager.value) + && Objects.equals(ref, manager.ref) + && Objects.equals(displayName, manager.displayName); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Member.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Member.java index 9bcffc14..ea8d88ec 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Member.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Member.java @@ -194,15 +194,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - final Member member = (Member) o; - return value.equals(member.value) && - Objects.equals(ref, member.ref) && - Objects.equals(type, member.type) && - Objects.equals(display, member.display); + + return o instanceof Member member + && value.equals(member.value) + && Objects.equals(ref, member.ref) + && Objects.equals(type, member.type) + && Objects.equals(display, member.display); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Meta.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Meta.java index 1334ed98..06a237b7 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Meta.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Meta.java @@ -315,29 +315,13 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Meta meta = (Meta) o; - if (!Objects.equals(created, meta.created)) - { - return false; - } - if (!Objects.equals(lastModified, meta.lastModified)) - { - return false; - } - if (!Objects.equals(location, meta.location)) - { - return false; - } - if (!Objects.equals(resourceType, meta.resourceType)) - { - return false; - } - return Objects.equals(version, meta.version); + return o instanceof Meta meta + && Objects.equals(created, meta.created) + && Objects.equals(lastModified, meta.lastModified) + && Objects.equals(location, meta.location) + && Objects.equals(resourceType, meta.resourceType) + && Objects.equals(version, meta.version); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Name.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Name.java index f9023a43..c5a3f2bd 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Name.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Name.java @@ -298,33 +298,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Name name = (Name) o; - if (!Objects.equals(formatted, name.formatted)) - { - return false; - } - if (!Objects.equals(familyName, name.familyName)) - { - return false; - } - if (!Objects.equals(givenName, name.givenName)) - { - return false; - } - if (!Objects.equals(middleName, name.middleName)) - { - return false; - } - if (!Objects.equals(honorificPrefix, name.honorificPrefix)) - { - return false; - } - return Objects.equals(honorificSuffix, name.honorificSuffix); + return o instanceof Name name + && Objects.equals(formatted, name.formatted) + && Objects.equals(familyName, name.familyName) + && Objects.equals(givenName, name.givenName) + && Objects.equals(middleName, name.middleName) + && Objects.equals(honorificPrefix, name.honorificPrefix) + && Objects.equals(honorificSuffix, name.honorificSuffix); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PaginationConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PaginationConfig.java index a4a345af..9c579563 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PaginationConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PaginationConfig.java @@ -276,32 +276,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (!(o instanceof PaginationConfig that)) - { - return false; - } - if (cursor != that.cursor) - { - return false; - } - if (index != that.index) - { - return false; - } - if (!Objects.equals(defaultPaginationMethod, that.defaultPaginationMethod)) - { - return false; - } - if (!Objects.equals(defaultPageSize, that.defaultPageSize)) - { - return false; - } - if (!Objects.equals(maxPageSize, that.maxPageSize)) - { - return false; - } - return Objects.equals(cursorTimeout, that.cursorTimeout); + return o instanceof PaginationConfig that + && cursor == that.cursor + && index == that.index + && Objects.equals(defaultPaginationMethod, that.defaultPaginationMethod) + && Objects.equals(defaultPageSize, that.defaultPageSize) + && Objects.equals(maxPageSize, that.maxPageSize) + && Objects.equals(cursorTimeout, that.cursorTimeout); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PatchConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PatchConfig.java index 298767f3..f88bc441 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PatchConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PatchConfig.java @@ -87,13 +87,8 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - PatchConfig that = (PatchConfig) o; - return supported == that.supported; + return o instanceof PatchConfig that && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PhoneNumber.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PhoneNumber.java index 7a85c0ea..926db1a4 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PhoneNumber.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/PhoneNumber.java @@ -197,25 +197,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - PhoneNumber that = (PhoneNumber) o; - if (!Objects.equals(value, that.value)) - { - return false; - } - if (!Objects.equals(display, that.display)) - { - return false; - } - if (!Objects.equals(type, that.type)) - { - return false; - } - return Objects.equals(primary, that.primary); + return o instanceof PhoneNumber that + && Objects.equals(value, that.value) + && Objects.equals(display, that.display) + && Objects.equals(type, that.type) + && Objects.equals(primary, that.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Photo.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Photo.java index 0176305b..7a2337c4 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Photo.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Photo.java @@ -198,25 +198,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Photo photo = (Photo) o; - if (!Objects.equals(value, photo.value)) - { - return false; - } - if (!Objects.equals(display, photo.display)) - { - return false; - } - if (!Objects.equals(type, photo.type)) - { - return false; - } - return Objects.equals(primary, photo.primary); + return o instanceof Photo photo + && Objects.equals(value, photo.value) + && Objects.equals(display, photo.display) + && Objects.equals(type, photo.type) + && Objects.equals(primary, photo.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ResourceTypeResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ResourceTypeResource.java index 2b11bbb1..3c5becde 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ResourceTypeResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ResourceTypeResource.java @@ -297,18 +297,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - SchemaExtension that = (SchemaExtension) o; - - if (required != that.required) - { - return false; - } - return Objects.equals(schema, that.schema); + return o instanceof SchemaExtension that + && required == that.required + && Objects.equals(schema, that.schema); } /** @@ -338,33 +329,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ResourceTypeResource that = (ResourceTypeResource) o; - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(description, that.description)) - { - return false; - } - if (!Objects.equals(endpoint, that.endpoint)) - { - return false; - } - if (!Objects.equals(schema, that.schema)) - { - return false; - } - return Objects.equals(schemaExtensions, that.schemaExtensions); + return o instanceof ResourceTypeResource that + && super.equals(o) + && Objects.equals(name, that.name) + && Objects.equals(description, that.description) + && Objects.equals(endpoint, that.endpoint) + && Objects.equals(schema, that.schema) + && Objects.equals(schemaExtensions, that.schemaExtensions); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Role.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Role.java index a7e16d64..eb6ae07f 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Role.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/Role.java @@ -195,25 +195,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - Role role = (Role) o; - if (!Objects.equals(value, role.value)) - { - return false; - } - if (!Objects.equals(display, role.display)) - { - return false; - } - if (!Objects.equals(type, role.type)) - { - return false; - } - return Objects.equals(primary, role.primary); + return o instanceof Role role + && Objects.equals(value, role.value) + && Objects.equals(display, role.display) + && Objects.equals(type, role.type) + && Objects.equals(primary, role.primary); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SchemaResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SchemaResource.java index 1e09152b..49c41e77 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SchemaResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SchemaResource.java @@ -141,25 +141,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - SchemaResource that = (SchemaResource) o; - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(description, that.description)) - { - return false; - } - return Objects.equals(attributes, that.attributes); + return o instanceof SchemaResource that + && super.equals(o) + && Objects.equals(name, that.name) + && Objects.equals(description, that.description) + && Objects.equals(attributes, that.attributes); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ServiceProviderConfigResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ServiceProviderConfigResource.java index 853b9cfd..f7919ac1 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ServiceProviderConfigResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/ServiceProviderConfigResource.java @@ -433,49 +433,18 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ServiceProviderConfigResource that = (ServiceProviderConfigResource) o; - if (!Objects.equals(authenticationSchemes, that.authenticationSchemes)) - { - return false; - } - if (!Objects.equals(bulk, that.bulk)) - { - return false; - } - if (!Objects.equals(changePassword, that.changePassword)) - { - return false; - } - if (!Objects.equals(documentationUri, that.documentationUri)) - { - return false; - } - if (!Objects.equals(etag, that.etag)) - { - return false; - } - if (!Objects.equals(filter, that.filter)) - { - return false; - } - if (!Objects.equals(patch, that.patch)) - { - return false; - } - if (!Objects.equals(pagination, that.pagination)) - { - return false; - } - return Objects.equals(sort, that.sort); + return o instanceof ServiceProviderConfigResource that + && super.equals(o) + && Objects.equals(authenticationSchemes, that.authenticationSchemes) + && Objects.equals(bulk, that.bulk) + && Objects.equals(changePassword, that.changePassword) + && Objects.equals(documentationUri, that.documentationUri) + && Objects.equals(etag, that.etag) + && Objects.equals(filter, that.filter) + && Objects.equals(patch, that.patch) + && Objects.equals(pagination, that.pagination) + && Objects.equals(sort, that.sort); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SortConfig.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SortConfig.java index bca5c04f..e33a8a95 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SortConfig.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/SortConfig.java @@ -87,13 +87,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - SortConfig that = (SortConfig) o; - return supported == that.supported; + return o instanceof SortConfig that + && supported == that.supported; } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/UserResource.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/UserResource.java index 33357094..7ba4ed3a 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/UserResource.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/UserResource.java @@ -1031,97 +1031,30 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - UserResource that = (UserResource) o; - if (!Objects.equals(userName, that.userName)) - { - return false; - } - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(displayName, that.displayName)) - { - return false; - } - if (!Objects.equals(nickName, that.nickName)) - { - return false; - } - if (!Objects.equals(profileUrl, that.profileUrl)) - { - return false; - } - if (!Objects.equals(title, that.title)) - { - return false; - } - if (!Objects.equals(userType, that.userType)) - { - return false; - } - if (!Objects.equals(preferredLanguage, that.preferredLanguage)) - { - return false; - } - if (!Objects.equals(locale, that.locale)) - { - return false; - } - if (!Objects.equals(timezone, that.timezone)) - { - return false; - } - if (!Objects.equals(active, that.active)) - { - return false; - } - if (!Objects.equals(password, that.password)) - { - return false; - } - if (!Objects.equals(emails, that.emails)) - { - return false; - } - if (!Objects.equals(phoneNumbers, that.phoneNumbers)) - { - return false; - } - if (!Objects.equals(ims, that.ims)) - { - return false; - } - if (!Objects.equals(photos, that.photos)) - { - return false; - } - if (!Objects.equals(addresses, that.addresses)) - { - return false; - } - if (!Objects.equals(groups, that.groups)) - { - return false; - } - if (!Objects.equals(entitlements, that.entitlements)) - { - return false; - } - if (!Objects.equals(roles, that.roles)) - { - return false; - } - return Objects.equals(x509Certificates, that.x509Certificates); + return o instanceof UserResource that + && super.equals(o) + && Objects.equals(userName, that.userName) + && Objects.equals(name, that.name) + && Objects.equals(displayName, that.displayName) + && Objects.equals(nickName, that.nickName) + && Objects.equals(profileUrl, that.profileUrl) + && Objects.equals(title, that.title) + && Objects.equals(userType, that.userType) + && Objects.equals(preferredLanguage, that.preferredLanguage) + && Objects.equals(locale, that.locale) + && Objects.equals(timezone, that.timezone) + && Objects.equals(active, that.active) + && Objects.equals(password, that.password) + && Objects.equals(emails, that.emails) + && Objects.equals(phoneNumbers, that.phoneNumbers) + && Objects.equals(ims, that.ims) + && Objects.equals(photos, that.photos) + && Objects.equals(addresses, that.addresses) + && Objects.equals(groups, that.groups) + && Objects.equals(entitlements, that.entitlements) + && Objects.equals(roles, that.roles) + && Objects.equals(x509Certificates, that.x509Certificates); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/X509Certificate.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/X509Certificate.java index c76d6173..1e009850 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/X509Certificate.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/X509Certificate.java @@ -198,25 +198,12 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - X509Certificate that = (X509Certificate) o; - if (!Objects.equals(display, that.display)) - { - return false; - } - if (!Objects.equals(type, that.type)) - { - return false; - } - if (!Objects.equals(primary, that.primary)) - { - return false; - } - return Arrays.equals(value, that.value); + return o instanceof X509Certificate that + && Objects.equals(display, that.display) + && Objects.equals(type, that.type) + && Objects.equals(primary, that.primary) + && Arrays.equals(value, that.value); } /** diff --git a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/utils/CaseIgnoreMap.java b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/utils/CaseIgnoreMap.java index 6aed2813..cdd849d1 100644 --- a/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/utils/CaseIgnoreMap.java +++ b/scim2-sdk-common/src/main/java/com/unboundid/scim2/common/utils/CaseIgnoreMap.java @@ -326,13 +326,9 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - CaseIgnoreMap that = (CaseIgnoreMap) o; - return attributes.equals(that.attributes); + return o instanceof CaseIgnoreMap that + && attributes.equals(that.attributes); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Consent.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Consent.java index 6668947c..67269d12 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Consent.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Consent.java @@ -121,22 +121,10 @@ public boolean equals(@Nullable final Object o) return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - if (!super.equals(o)) - { - return false; - } - - Consent consent = (Consent) o; - if (!Objects.equals(client, consent.client)) - { - return false; - } - return Objects.equals(scopes, consent.scopes); + return o instanceof Consent consent + && super.equals(o) + && Objects.equals(client, consent.client) + && Objects.equals(scopes, consent.scopes); } /** @@ -150,4 +138,3 @@ public int hashCode() return Objects.hash(super.hashCode(), client, scopes); } } - diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/ConsentHistory.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/ConsentHistory.java index 62550a37..9300d276 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/ConsentHistory.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/ConsentHistory.java @@ -121,21 +121,11 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ConsentHistory that = (ConsentHistory) o; - if (!Objects.equals(client, that.client)) - { - return false; - } - return Objects.equals(scopes, that.scopes); + return o instanceof ConsentHistory that + && super.equals(o) + && Objects.equals(client, that.client) + && Objects.equals(scopes, that.scopes); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/OAuth2Client.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/OAuth2Client.java index 7e4e5324..cfde7931 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/OAuth2Client.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/OAuth2Client.java @@ -278,33 +278,14 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - OAuth2Client that = (OAuth2Client) o; - if (!Objects.equals(name, that.name)) - { - return false; - } - if (!Objects.equals(description, that.description)) - { - return false; - } - if (!Objects.equals(url, that.url)) - { - return false; - } - if (!Objects.equals(iconUrl, that.iconUrl)) - { - return false; - } - if (!Objects.equals(emailAddress, that.emailAddress)) - { - return false; - } - return Objects.equals(lastAuthorization, that.lastAuthorization); + return o instanceof OAuth2Client that + && Objects.equals(name, that.name) + && Objects.equals(description, that.description) + && Objects.equals(url, that.url) + && Objects.equals(iconUrl, that.iconUrl) + && Objects.equals(emailAddress, that.emailAddress) + && Objects.equals(lastAuthorization, that.lastAuthorization); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Scope.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Scope.java index cbb10f3a..d4ed1341 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Scope.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/consent/Scope.java @@ -234,21 +234,10 @@ public boolean equals(@Nullable final Object o) return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - Scope scope = (Scope) o; - if (!Objects.equals(name, scope.name)) - { - return false; - } - if (!Objects.equals(description, scope.description)) - { - return false; - } - return Objects.equals(consent, scope.consent); + return o instanceof Scope scope + && Objects.equals(name, scope.name) + && Objects.equals(description, scope.description) + && Objects.equals(consent, scope.consent); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/ExternalIdentity.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/ExternalIdentity.java index df626aff..aa0fe650 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/ExternalIdentity.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/ExternalIdentity.java @@ -280,41 +280,16 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - ExternalIdentity that = (ExternalIdentity) o; - if (!Objects.equals(provider, that.provider)) - { - return false; - } - if (!Objects.equals(providerUserId, that.providerUserId)) - { - return false; - } - if (!Objects.equals(accessToken, that.accessToken)) - { - return false; - } - if (!Objects.equals(refreshToken, that.refreshToken)) - { - return false; - } - if (!Objects.equals(providerRedirectUrl, that.providerRedirectUrl)) - { - return false; - } - if (!Objects.equals(callbackUrl, that.callbackUrl)) - { - return false; - } - return Objects.equals(callbackParameters, that.callbackParameters); + return o instanceof ExternalIdentity that + && super.equals(o) + && Objects.equals(provider, that.provider) + && Objects.equals(providerUserId, that.providerUserId) + && Objects.equals(accessToken, that.accessToken) + && Objects.equals(refreshToken, that.refreshToken) + && Objects.equals(providerRedirectUrl, that.providerRedirectUrl) + && Objects.equals(callbackUrl, that.callbackUrl) + && Objects.equals(callbackParameters, that.callbackParameters); } /** @@ -325,7 +300,7 @@ public boolean equals(@Nullable final Object o) @Override public int hashCode() { - return Objects.hash(provider, providerUserId, accessToken, refreshToken, - providerRedirectUrl, callbackUrl, callbackParameters); + return Objects.hash(super.hashCode(), provider, providerUserId, accessToken, + refreshToken, providerRedirectUrl, callbackUrl, callbackParameters); } } diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/Provider.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/Provider.java index 582b95d3..4d74b564 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/Provider.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/externalidentity/Provider.java @@ -262,29 +262,13 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - final Provider provider = (Provider) o; - if (!Objects.equals(name, provider.name)) - { - return false; - } - if (!Objects.equals(description, provider.description)) - { - return false; - } - if (!Objects.equals(iconUrl, provider.iconUrl)) - { - return false; - } - if (!Objects.equals(type, provider.type)) - { - return false; - } - return Objects.equals(samlResponseBinding, provider.samlResponseBinding); + return o instanceof Provider provider + && Objects.equals(name, provider.name) + && Objects.equals(description, provider.description) + && Objects.equals(iconUrl, provider.iconUrl) + && Objects.equals(type, provider.type) + && Objects.equals(samlResponseBinding, provider.samlResponseBinding); } diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountState.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountState.java index 2fae7901..0739f890 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountState.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountState.java @@ -795,130 +795,46 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - AccountState that = (AccountState) o; - if (!Objects.equals(accountDisabled, that.accountDisabled)) - { - return false; - } - if (!Objects.equals(accountExpirationTime, that.accountExpirationTime)) - { - return false; - } - if (!Objects.equals(secondsUntilAccountExpiration, - that.secondsUntilAccountExpiration)) - { - return false; - } - if (!Objects.equals(passwordChangedTime, that.passwordChangedTime)) - { - return false; - } - if (!Objects.equals(passwordExpirationWarnedTime, - that.passwordExpirationWarnedTime)) - { - return false; - } - if (!Objects.equals(secondsUntilPasswordExpiration, - that.secondsUntilPasswordExpiration)) - { - return false; - } - if (!Objects.equals(secondsUntilPasswordExpirationWarning, - that.secondsUntilPasswordExpirationWarning)) - { - return false; - } - if (!Objects.equals(authenticationFailureTimes, - that.authenticationFailureTimes)) - { - return false; - } - if (!Objects.equals(secondsUntilAuthenticationFailureUnlock, - that.secondsUntilAuthenticationFailureUnlock)) - { - return false; - } - if (!Objects.equals(remainingAuthenticationFailureCount, - that.remainingAuthenticationFailureCount)) - { - return false; - } - if (!Objects.equals(lastLoginTime, that.lastLoginTime)) - { - return false; - } - if (!Objects.equals(secondsUntilIdleLockout, that.secondsUntilIdleLockout)) - { - return false; - } - if (!Objects.equals(mustChangePassword, that.mustChangePassword)) - { - return false; - } - if (!Objects.equals(secondsUntilPasswordResetLockout, - that.secondsUntilPasswordResetLockout)) - { - return false; - } - if (!Objects.equals(graceLoginTimes, that.graceLoginTimes)) - { - return false; - } - if (!Objects.equals(remainingGraceLoginCount, - that.remainingGraceLoginCount)) - { - return false; - } - if (!Objects.equals(passwordChangedByRequiredTime, - that.passwordChangedByRequiredTime)) - { - return false; - } - if (!Objects.equals(secondsUntilRequiredChangeTime, - that.secondsUntilRequiredChangeTime)) - { - return false; - } - if (!Objects.equals(passwordHistory, that.passwordHistory)) - { - return false; - } - if (!Objects.equals(retiredPassword, that.retiredPassword)) - { - return false; - } - if (!Objects.equals(accountActivationTime, that.accountActivationTime)) - { - return false; - } - if (!Objects.equals(secondsUntilAccountActivation, - that.secondsUntilAccountActivation)) - { - return false; - } - if (!Objects.equals(lastLoginIpAddress, that.lastLoginIpAddress)) - { - return false; - } - if (!Objects.equals(accountUsabilityNotices, that.accountUsabilityNotices)) - { - return false; - } - if (!Objects.equals(accountUsabilityWarnings, - that.accountUsabilityWarnings)) - { - return false; - } - return Objects.equals(accountUsabilityErrors, that.accountUsabilityErrors); + return o instanceof AccountState a + && super.equals(o) + && Objects.equals(accountDisabled, a.accountDisabled) + && Objects.equals(accountExpirationTime, a.accountExpirationTime) + && Objects.equals(secondsUntilAccountExpiration, + a.secondsUntilAccountExpiration) + && Objects.equals(passwordChangedTime, a.passwordChangedTime) + && Objects.equals(passwordExpirationWarnedTime, + a.passwordExpirationWarnedTime) + && Objects.equals(secondsUntilPasswordExpiration, + a.secondsUntilPasswordExpiration) + && Objects.equals(secondsUntilPasswordExpirationWarning, + a.secondsUntilPasswordExpirationWarning) + && Objects.equals(authenticationFailureTimes, + a.authenticationFailureTimes) + && Objects.equals(secondsUntilAuthenticationFailureUnlock, + a.secondsUntilAuthenticationFailureUnlock) + && Objects.equals(remainingAuthenticationFailureCount, + a.remainingAuthenticationFailureCount) + && Objects.equals(lastLoginTime, a.lastLoginTime) + && Objects.equals(secondsUntilIdleLockout, a.secondsUntilIdleLockout) + && Objects.equals(mustChangePassword, a.mustChangePassword) + && Objects.equals(secondsUntilPasswordResetLockout, + a.secondsUntilPasswordResetLockout) + && Objects.equals(graceLoginTimes, a.graceLoginTimes) + && Objects.equals(remainingGraceLoginCount, a.remainingGraceLoginCount) + && Objects.equals(passwordChangedByRequiredTime, + a.passwordChangedByRequiredTime) + && Objects.equals(secondsUntilRequiredChangeTime, + a.secondsUntilRequiredChangeTime) + && Objects.equals(passwordHistory, a.passwordHistory) + && Objects.equals(retiredPassword, a.retiredPassword) + && Objects.equals(accountActivationTime, a.accountActivationTime) + && Objects.equals(secondsUntilAccountActivation, + a.secondsUntilAccountActivation) + && Objects.equals(lastLoginIpAddress, a.lastLoginIpAddress) + && Objects.equals(accountUsabilityNotices, a.accountUsabilityNotices) + && Objects.equals(accountUsabilityWarnings, a.accountUsabilityWarnings) + && Objects.equals(accountUsabilityErrors, a.accountUsabilityErrors); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountUsabilityIssue.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountUsabilityIssue.java index 54fa7a2a..ce4da7c8 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountUsabilityIssue.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/AccountUsabilityIssue.java @@ -105,17 +105,10 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - AccountUsabilityIssue that = (AccountUsabilityIssue) o; - if (!Objects.equals(name, that.name)) - { - return false; - } - return Objects.equals(message, that.message); + return o instanceof AccountUsabilityIssue that + && Objects.equals(name, that.name) + && Objects.equals(message, that.message); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/RetiredPassword.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/RetiredPassword.java index 446c2b20..f5160fb4 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/RetiredPassword.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/pwdmgmt/RetiredPassword.java @@ -112,17 +112,9 @@ public boolean equals(@Nullable final Object o) return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - RetiredPassword that = (RetiredPassword) o; - if (!Objects.equals(passwordRetiredTime, that.passwordRetiredTime)) - { - return false; - } - return Objects.equals(passwordExpirationTime, that.passwordExpirationTime); + return o instanceof RetiredPassword that + && Objects.equals(passwordRetiredTime, that.passwordRetiredTime) + && Objects.equals(passwordExpirationTime, that.passwordExpirationTime); } /** diff --git a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/sessionmgmt/Session.java b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/sessionmgmt/Session.java index 5d301de2..2ebbf702 100644 --- a/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/sessionmgmt/Session.java +++ b/scim2-ubid-extensions/src/main/java/com/unboundid/scim2/extension/messages/sessionmgmt/Session.java @@ -254,42 +254,16 @@ public boolean equals(@Nullable final Object o) { return true; } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - Session session = (Session) o; - if (!Objects.equals(lastLoginMethods, session.lastLoginMethods)) - { - return false; - } - if (!Objects.equals(lastSecondFactorMethods, - session.lastSecondFactorMethods)) - { - return false; - } - if (!Objects.equals(lastLogin, session.lastLogin)) - { - return false; - } - if (!Objects.equals(lastSecondFactor, session.lastSecondFactor)) - { - return false; - } - if (!Objects.equals(ipAddress, session.ipAddress)) - { - return false; - } - if (!Objects.equals(userAgentString, session.userAgentString)) - { - return false; - } - return Objects.equals(clients, session.clients); + return o instanceof Session session + && super.equals(o) + && Objects.equals(lastLoginMethods, session.lastLoginMethods) + && Objects.equals(lastSecondFactorMethods, session.lastSecondFactorMethods) + && Objects.equals(lastLogin, session.lastLogin) + && Objects.equals(lastSecondFactor, session.lastSecondFactor) + && Objects.equals(ipAddress, session.ipAddress) + && Objects.equals(userAgentString, session.userAgentString) + && Objects.equals(clients, session.clients); } /** @@ -300,8 +274,8 @@ public boolean equals(@Nullable final Object o) @Override public int hashCode() { - return Objects.hash(lastLoginMethods, lastSecondFactorMethods, lastLogin, - lastSecondFactor, ipAddress, userAgentString, clients); + return Objects.hash(super.hashCode(), lastLoginMethods, + lastSecondFactorMethods, lastLogin, lastSecondFactor, ipAddress, + userAgentString, clients); } } -