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