#16 board: hashcode, equals
This commit is contained in:
@@ -62,11 +62,11 @@ public class Article extends AuditingFields {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Article article)) return false;
|
||||
return id != null && id.equals(article.id);
|
||||
return this.getId() != null && this.getId().equals(article.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
return Objects.hash(this.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public class ArticleComment extends AuditingFields {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof ArticleComment that)) return false;
|
||||
return id != null && id.equals(that.id);
|
||||
return this.getId() != null && this.getId().equals(that.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
return Objects.hash(this.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,12 +54,12 @@ public class UserAccount extends AuditingFields {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof UserAccount userAccount)) return false;
|
||||
return userId != null && userId.equals(userAccount.userId);
|
||||
return this.getUserId() != null && this.getUserId().equals(userAccount.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(userId);
|
||||
return Objects.hash(this.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user