Skip to content

Commit a16a87f

Browse files
authored
Add missing hashCode and equals methods to JoinField.
Original Pull Request #1847 Closes #1846
1 parent 3871d2d commit a16a87f

File tree

1 file changed

+20
-0
lines changed
  • src/main/java/org/springframework/data/elasticsearch/core/join

1 file changed

+20
-0
lines changed

src/main/java/org/springframework/data/elasticsearch/core/join/JoinField.java

+20
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
*/
1616
package org.springframework.data.elasticsearch.core.join;
1717

18+
import java.util.Objects;
19+
1820
import org.springframework.data.annotation.PersistenceConstructor;
1921
import org.springframework.lang.Nullable;
2022

2123
/**
2224
* @author Subhobrata Dey
25+
* @author Sascha Woo
2326
* @since 4.1
2427
*/
2528
public class JoinField<ID> {
@@ -54,4 +57,21 @@ public ID getParent() {
5457
public String getName() {
5558
return name;
5659
}
60+
61+
@Override
62+
public int hashCode() {
63+
return Objects.hash(name, parent);
64+
}
65+
66+
@Override
67+
public boolean equals(Object obj) {
68+
if (this == obj) {
69+
return true;
70+
}
71+
if (!(obj instanceof JoinField)) {
72+
return false;
73+
}
74+
JoinField other = (JoinField) obj;
75+
return Objects.equals(name, other.name) && Objects.equals(parent, other.parent);
76+
}
5777
}

0 commit comments

Comments
 (0)