Use @EqualsAndHashCode(onlyExplicitlyIncluded = true) in Entity.java

This commit is contained in:
deiflaender 2020-08-07 12:28:21 +02:00
parent 7d0b0ed3d0
commit 99bac4550a

View File

@ -1,6 +1,5 @@
package com.iqser.red.service.redaction.v1.server.redaction.model;
import java.util.ArrayList;
import java.util.List;
@ -8,37 +7,28 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class Entity {
@EqualsAndHashCode.Include
private final String word;
@EqualsAndHashCode.Exclude
private final String type;
@EqualsAndHashCode.Exclude
private boolean redaction;
@EqualsAndHashCode.Exclude
private String redactionReason;
@EqualsAndHashCode.Exclude
private List<EntityPositionSequence> positionSequences = new ArrayList<>();
@EqualsAndHashCode.Exclude
private Integer start;
@EqualsAndHashCode.Exclude
private Integer end;
@EqualsAndHashCode.Include
private String headline;
@EqualsAndHashCode.Exclude
private int matchedRule;
@EqualsAndHashCode.Include
private int sectionNumber;
public Entity(String word, String type, boolean redaction, String redactionReason, List<EntityPositionSequence> positionSequences, String headline, int matchedRule, int sectionNumber) {
this.word = word;
this.type = type;
this.redaction = redaction;
@ -49,7 +39,9 @@ public class Entity {
this.sectionNumber = sectionNumber;
}
public Entity(String word, String type, Integer start, Integer end, String headline, int sectionNumber) {
this.word = word;
this.type = type;
this.start = start;
@ -57,4 +49,5 @@ public class Entity {
this.headline = headline;
this.sectionNumber = sectionNumber;
}
}