public QuestionTemplateDto build() { if (question.getType() == QuestionTypeEnum.SINGLE_CHOICE) { for (AnswerTemplateDto answer : question.getAnswers()) { answer.setExcludesOtherAnswers(true); } } return question; }
public QuestionBuilder(QuestionTypeEnum type, String text) { question.setType(type); question.setText(text); }
public QuestionBuilder withAnswers(AnswerBuilder... answers) { for (AnswerBuilder answerBuilder : answers) { question.getAnswers().add(answerBuilder.build()); } return this; }