Use EqualsAndHashcode annotation from Lombok
This commit is contained in:
parent
d2d7f8c50c
commit
b1a266d4d4
@ -3,22 +3,37 @@ 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;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode
|
||||||
public class Entity {
|
public class Entity {
|
||||||
|
|
||||||
private final String word;
|
private final String word;
|
||||||
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;
|
||||||
|
|
||||||
private String headline;
|
private String headline;
|
||||||
|
|
||||||
|
@EqualsAndHashCode.Exclude
|
||||||
private int matchedRule;
|
private int matchedRule;
|
||||||
|
|
||||||
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) {
|
||||||
@ -40,27 +55,4 @@ public class Entity {
|
|||||||
this.headline = headline;
|
this.headline = headline;
|
||||||
this.sectionNumber = sectionNumber;
|
this.sectionNumber = sectionNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
|
||||||
if (this == o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || getClass() != o.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Entity entity = (Entity) o;
|
|
||||||
return sectionNumber == entity.sectionNumber && Objects.equals(word, entity.word) && Objects.equals(type, entity.type) && Objects
|
|
||||||
.equals(headline, entity.headline);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
|
|
||||||
return Objects.hash(word, type, headline, sectionNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,44 +2,24 @@ 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;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.iqser.red.service.redaction.v1.server.parsing.model.TextPositionSequence;
|
import com.iqser.red.service.redaction.v1.server.parsing.model.TextPositionSequence;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
public class EntityPositionSequence {
|
public class EntityPositionSequence {
|
||||||
|
|
||||||
|
@EqualsAndHashCode.Exclude
|
||||||
private List<TextPositionSequence> sequences = new ArrayList<>();
|
private List<TextPositionSequence> sequences = new ArrayList<>();
|
||||||
private int pageNumber;
|
private int pageNumber;
|
||||||
private final UUID id;
|
private final UUID id;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
|
||||||
if (this == o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || getClass() != o.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
EntityPositionSequence that = (EntityPositionSequence) o;
|
|
||||||
return pageNumber == that.pageNumber && Objects.equals(id, that.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
|
|
||||||
return Objects.hash(pageNumber, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user