HHH-15886 Micro optimisations in NavigableRole equals and hashcode

This commit is contained in:
Sanne Grinovero 2022-12-15 18:59:56 +00:00 committed by Sanne Grinovero
parent 2933a759fa
commit 7c068e5be4
1 changed files with 6 additions and 5 deletions

View File

@ -22,7 +22,7 @@ import org.hibernate.spi.NavigablePath;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class NavigableRole implements DotIdentifierSequence, Serializable { public final class NavigableRole implements DotIdentifierSequence, Serializable {
public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY; public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY;
private final NavigableRole parent; private final NavigableRole parent;
@ -111,19 +111,20 @@ public class NavigableRole implements DotIdentifierSequence, Serializable {
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(final Object o) {
if ( this == o ) { if ( this == o ) {
return true; return true;
} }
if ( o == null || getClass() != o.getClass() ) { if ( o == null || NavigableRole.class != o.getClass() ) {
return false; return false;
} }
NavigableRole that = (NavigableRole) o; NavigableRole that = (NavigableRole) o;
return Objects.equals( getFullPath(), that.getFullPath() ); return fullPath.equals( that.fullPath );
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( getFullPath() ); return this.fullPath.hashCode();
} }
} }