Skip to content

Commit

Permalink
Remove useless equals and hashcode on StorageUnitNodeMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 27, 2023
1 parent 2fdab36 commit 62aa61c
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.shardingsphere.infra.metadata.database.resource.unit;

import com.google.common.base.Objects;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode;
Expand All @@ -40,22 +39,4 @@ public final class StorageUnitNodeMapper {
public StorageUnitNodeMapper(final String name, final StorageNode storageNode, final String url) {
this(name, storageNode, url, null);
}

@Override
public boolean equals(final Object obj) {
if (obj instanceof StorageUnitNodeMapper) {
StorageUnitNodeMapper mapper = (StorageUnitNodeMapper) obj;
return mapper.name.equalsIgnoreCase(name) && mapper.storageNode.equals(storageNode) && isSameCatalog(mapper);
}
return false;
}

private boolean isSameCatalog(final StorageUnitNodeMapper mapper) {
return null == catalog && null == mapper.getCatalog() || null != catalog && catalog.equalsIgnoreCase(mapper.getCatalog());
}

@Override
public int hashCode() {
return Objects.hashCode(name.toUpperCase(), storageNode.getName().toUpperCase(), null == catalog ? null : catalog.toUpperCase());
}
}

0 comments on commit 62aa61c

Please sign in to comment.