116 lines
2.4 KiB
Java
116 lines
2.4 KiB
Java
package com.example.questionbank.service.dto;
|
|
|
|
import com.example.questionbank.domain.enumeration.OptionKey;
|
|
import jakarta.validation.constraints.*;
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
|
|
/**
|
|
* A DTO for the {@link com.example.questionbank.domain.Choice} entity.
|
|
*/
|
|
@SuppressWarnings("common-java:DuplicatedBlocks")
|
|
public class ChoiceDTO implements Serializable {
|
|
|
|
private Long id;
|
|
|
|
@NotNull
|
|
private OptionKey optionKey;
|
|
|
|
@NotNull
|
|
@Size(max = 500)
|
|
private String content;
|
|
|
|
@NotNull
|
|
@Min(value = 1)
|
|
@Max(value = 4)
|
|
private Integer displayOrder;
|
|
|
|
@NotNull
|
|
private Boolean correct;
|
|
|
|
@NotNull
|
|
private QuestionDTO question;
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public OptionKey getOptionKey() {
|
|
return optionKey;
|
|
}
|
|
|
|
public void setOptionKey(OptionKey optionKey) {
|
|
this.optionKey = optionKey;
|
|
}
|
|
|
|
public String getContent() {
|
|
return content;
|
|
}
|
|
|
|
public void setContent(String content) {
|
|
this.content = content;
|
|
}
|
|
|
|
public Integer getDisplayOrder() {
|
|
return displayOrder;
|
|
}
|
|
|
|
public void setDisplayOrder(Integer displayOrder) {
|
|
this.displayOrder = displayOrder;
|
|
}
|
|
|
|
public Boolean getCorrect() {
|
|
return correct;
|
|
}
|
|
|
|
public void setCorrect(Boolean correct) {
|
|
this.correct = correct;
|
|
}
|
|
|
|
public QuestionDTO getQuestion() {
|
|
return question;
|
|
}
|
|
|
|
public void setQuestion(QuestionDTO question) {
|
|
this.question = question;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (!(o instanceof ChoiceDTO)) {
|
|
return false;
|
|
}
|
|
|
|
ChoiceDTO choiceDTO = (ChoiceDTO) o;
|
|
if (this.id == null) {
|
|
return false;
|
|
}
|
|
return Objects.equals(this.id, choiceDTO.id);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(this.id);
|
|
}
|
|
|
|
// prettier-ignore
|
|
@Override
|
|
public String toString() {
|
|
return "ChoiceDTO{" +
|
|
"id=" + getId() +
|
|
", optionKey='" + getOptionKey() + "'" +
|
|
", content='" + getContent() + "'" +
|
|
", displayOrder=" + getDisplayOrder() +
|
|
", correct='" + getCorrect() + "'" +
|
|
", question=" + getQuestion() +
|
|
"}";
|
|
}
|
|
}
|