package net.sourceforge.fenixedu.domain.tests.answers; import java.io.Serializable; import java.util.List; import net.sourceforge.fenixedu.commons.CollectionUtils; import net.sourceforge.fenixedu.domain.DomainObject; import net.sourceforge.fenixedu.domain.DomainReference; public class ConcreteAnswer implements Serializable { private static final long serialVersionUID = 1L; public final Object answer; public ConcreteAnswer(Object answer) { this.answer = answer; } public ConcreteAnswer(List answer) { this.answer = CollectionUtils.toReferences(answer); } public Object getAnswer() { if (answer instanceof List) { return CollectionUtils.toObjects((List>) answer); } return answer; } /* * public String getStringAnswer() { return (String) answer; } * * public void setStringAnswer(String answer) { this.answer = answer; } * * public Double getNumericAnswer() { return (Double) answer; } * * public void setNumericAnswer(Double answer) { this.answer = answer; } * * public DateTime getDateAnswer() { return (DateTime) answer; } * * public void setDateAnswer(DateTime answer) { this.answer = answer; } * * public List getMultipleChoiceAnswer() { List * choices = new ArrayList(); List> * answer = (List>) this.answer; * * for(DomainReference choice : answer) { * choices.add(choice.getObject()); } * * return choices; } * * public void setMultipleChoiceAnswer(List answer) { * List> choices = new * ArrayList>(); * * for(NewChoice choice : answer) { choices.add(new * DomainReference(choice)); } * * this.answer = choices; } */ }