なぜこの構造を取得するのですか? クイズ-->質問-->と2つの質問要素ではなく、2つの質問要素を期待していたでしょうか?
@XmlRootElement
public class Quiz {
private List<Question> questions;
public Quiz() {
questions = new ArrayList<Question>();
}
public List<Question> getQuestions() {
return questions;
}
public void setQuestions(List<Question> questions) {
for (Question question : questions) {
addQuestion(question);
}
}
public void addQuestion(final Question question) {
if (!(questions.contains(question))) {
questions.add(question);
}
}
public void removeQuestion(final Question question) {
if (questions.contains(question)) {
questions.remove(question);
}
}
public int numberOfQuestions() {
return questions.size();
}
}
質問:
@XmlRootElement
public class Question extends AbstractModel {
}
<quiz><questions></questions><questions></questions></quiz>