This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit c8341a7b4053e1ba9260682be83c900cbee64128 Author: Benoit Tellier <[email protected]> AuthorDate: Sat Nov 16 10:54:44 2019 +0700 [Refactoring] JPAProperty equals & hashCode --- .../james/mailbox/jpa/mail/model/JPAProperty.java | 31 ++++++++-------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java index c96cc67..1f07100 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java @@ -18,6 +18,8 @@ ****************************************************************/ package org.apache.james.mailbox.jpa.mail.model; +import java.util.Objects; + import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -125,29 +127,18 @@ public class JPAProperty implements Property { } @Override - public int hashCode() { - final int PRIME = 31; - int result = 1; - result = PRIME * result + (int) (id ^ (id >>> 32)); - return result; + public final boolean equals(Object o) { + if (o instanceof JPAProperty) { + JPAProperty that = (JPAProperty) o; + + return Objects.equals(this.id, that.id); + } + return false; } @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final JPAProperty other = (JPAProperty) obj; - if (id != other.id) { - return false; - } - return true; + public final int hashCode() { + return Objects.hash(id); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
