mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-01 08:12:11 +00:00
Implement the equals and hashCode contracts for Field.
Original Pull Request #2859 Closes #2858
This commit is contained in:
parent
7a8a9a15f1
commit
205d74b6db
@ -19,6 +19,8 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
|||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The most trivial implementation of a Field. The {@link #name} is updatable, so it may be changed during query
|
* The most trivial implementation of a Field. The {@link #name} is updatable, so it may be changed during query
|
||||||
* preparation by the {@link org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter}.
|
* preparation by the {@link org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter}.
|
||||||
@ -79,4 +81,16 @@ public class SimpleField implements Field {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof SimpleField that)) return false;
|
||||||
|
return Objects.equals(name, that.name) && Objects.equals(fieldType, that.fieldType) && Objects.equals(path, that.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, fieldType, path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user