mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 05:57:57 +01:00
hashCode and equals on embedded entity
This commit is contained in:
parent
19db8f2445
commit
dcf3e49cb3
@ -97,6 +97,44 @@ public class DocumentTag implements Serializable {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((documentId == null) ? 0 : documentId.hashCode());
|
||||
result = prime * result + ((tagId == null) ? 0 : tagId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DocumentTag other = (DocumentTag) obj;
|
||||
if (documentId == null) {
|
||||
if (other.documentId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!documentId.equals(other.documentId)) {
|
||||
return false;
|
||||
}
|
||||
if (tagId == null) {
|
||||
if (other.tagId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!tagId.equals(other.tagId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
|
Loading…
Reference in New Issue
Block a user