Skip to content
Snippets Groups Projects
Commit 4a131daf authored by Martin Gargalovič's avatar Martin Gargalovič
Browse files

added hash and equals overide

parent 1f1240f8
No related branches found
No related tags found
3 merge requests!31M2,!28M2 user,!27Draft: M2 user
...@@ -7,6 +7,8 @@ import lombok.Getter; ...@@ -7,6 +7,8 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.fuseri.model.dto.common.DomainObjectDto; import org.fuseri.model.dto.common.DomainObjectDto;
import java.util.Objects;
@Getter @Getter
@Setter @Setter
public class ExerciseDto extends DomainObjectDto { public class ExerciseDto extends DomainObjectDto {
...@@ -23,4 +25,26 @@ public class ExerciseDto extends DomainObjectDto { ...@@ -23,4 +25,26 @@ public class ExerciseDto extends DomainObjectDto {
@NotBlank @NotBlank
private String courseId; private String courseId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExerciseDto that = (ExerciseDto) o;
if (difficulty != that.difficulty) return false;
if (!Objects.equals(name, that.name)) return false;
if (!Objects.equals(description, that.description)) return false;
return Objects.equals(courseId, that.courseId);
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + difficulty;
result = 31 * result + (courseId != null ? courseId.hashCode() : 0);
return result;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment