Write record influencers as they are expected in java (elastic/elasticsearch#379)

Original commit: elastic/x-pack-elasticsearch@d016684866
This commit is contained in:
Dimitris Athanasiou 2016-11-24 12:35:24 +00:00 committed by GitHub
parent 2a46837296
commit d8b6ecfb31
1 changed files with 11 additions and 21 deletions

View File

@ -21,8 +21,8 @@ import java.util.Objects;
/**
* Influence field name and list of influence field values/score pairs
*/
public class Influence extends ToXContentToBytes implements Writeable
{
public class Influence extends ToXContentToBytes implements Writeable {
/**
* Note all publicly exposed field names are "influencer" not "influence"
*/
@ -42,8 +42,7 @@ public class Influence extends ToXContentToBytes implements Writeable
private String field;
private List<String> fieldValues;
public Influence(String field, List<String> fieldValues)
{
public Influence(String field, List<String> fieldValues) {
this.field = field;
this.fieldValues = fieldValues;
}
@ -68,43 +67,34 @@ public class Influence extends ToXContentToBytes implements Writeable
return builder;
}
public String getInfluencerFieldName()
{
public String getInfluencerFieldName() {
return field;
}
public List<String> getInfluencerFieldValues()
{
public List<String> getInfluencerFieldValues() {
return fieldValues;
}
@Override
public int hashCode()
{
public int hashCode() {
return Objects.hash(field, fieldValues);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null)
{
if (obj == null) {
return false;
}
if (getClass() != obj.getClass())
{
if (getClass() != obj.getClass()) {
return false;
}
Influence other = (Influence) obj;
return Objects.equals(field, other.field) &&
Objects.equals(fieldValues, other.fieldValues);
return Objects.equals(field, other.field) && Objects.equals(fieldValues, other.fieldValues);
}
}