mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-13 07:32:11 +00:00
Add missing hashCode and equals methods to JoinField.
Original Pull Request #1847 Closes #1846 (cherry picked from commit a16a87f3fa42c96566fac06e89aa703767a4842e) (cherry picked from commit 0bb239a67465fd1304d0f318690b301cd6f3b4fe)
This commit is contained in:
parent
58925fca98
commit
84a74f5921
@ -15,10 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core.join;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Subhobrata Dey
|
||||
* @author Sascha Woo
|
||||
* @since 4.1
|
||||
*/
|
||||
public class JoinField<ID> {
|
||||
@ -35,6 +39,7 @@ public class JoinField<ID> {
|
||||
this(name, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
public JoinField(String name, @Nullable ID parent) {
|
||||
this.name = name;
|
||||
this.parent = parent;
|
||||
@ -52,4 +57,21 @@ public class JoinField<ID> {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof JoinField)) {
|
||||
return false;
|
||||
}
|
||||
JoinField other = (JoinField) obj;
|
||||
return Objects.equals(name, other.name) && Objects.equals(parent, other.parent);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user