Class AskAs<T>
An AskAs is a way for a Question to signal to the UI that it can ask the question in a customized way, but ultimately the survey wants the answer to be recorded in a way that can be bound to the Question's parameter type. This allows a user-friendly experience for certain options while being able to still allow a more complex, custom value to be edited in "expert mode" scenarios (such as editing an ini file, or switching a GUI in to expert mode)
NB at the moment, ask as questions are assumed to always be composite, as they are the only examples we've seen so far. There's no reason for it to need to be this way, but it was simpler at the time.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
nz.org.riskscape.problem.ResultOrProblems<Answer.Response>
convert
(nz.org.riskscape.engine.bind.BindingContext context, Question question, Answer.Response response) Convert the result of asking the question (getType()
) to the type the survey wants to have stored (Question#getType()
boolean
getCompositeSubparts
(Question parent) getType()
int
hashCode()
toString()
-
Constructor Details
-
AskAs
-
-
Method Details
-
toAnswer
-
convert
public nz.org.riskscape.problem.ResultOrProblems<Answer.Response> convert(nz.org.riskscape.engine.bind.BindingContext context, Question question, Answer.Response response) Convert the result of asking the question (
getType()
) to the type the survey wants to have stored (Question#getType()
-
asType
- Returns:
- a modified copy of parent with the parametertype set to the ask as type and with the ask as information removed
-
getCompositeSubparts
- Returns:
- a list of questions that can be used to build a response to this question when 'asked as'
-
getType
-
getToAnswer
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-