QuestionnaireItemViewItem

data class QuestionnaireItemViewItem(questionnaireItem: <ERROR CLASS>, questionnaireResponseItem: <ERROR CLASS>, validationResult: ValidationResult, answersChangedCallback: (<ERROR CLASS>, <ERROR CLASS>, List<<ERROR CLASS>>) -> Unit, resolveAnswerValueSet: suspend (String) -> List<<ERROR CLASS>>, resolveAnswerExpression: suspend (<ERROR CLASS>) -> List<<ERROR CLASS>>)

Data item for QuestionnaireItemViewHolder in RecyclerView.

The view should use questionnaireItem, answers, answerOption, and validationResult to render the data item in the UI. The view SHOULD NOT mutate the data using these properties.

The view should use the following answer APIs to update the answer(s):

  • setAnswer (for single and repeated answers)

  • clearAnswer (for single and repeated answers)

  • addAnswer (for repeated answers only)

  • removeAnswer (for repeated answers only)

Updates to the answers using these APIs will invoke answersChangedCallback to notify the view model that the answer(s) have been changed. This will trigger a re-render of the RecyclerView UI.

Parameters

questionnaireItem

the Questionnaire.QuestionnaireItemComponent in the Questionnaire

questionnaireResponseItem

the QuestionnaireResponse.QuestionnaireResponseItemComponent in the QuestionnaireResponse

validationResult

the ValidationResult of the answer(s) against the questionnaireItem

answersChangedCallback

the callback to notify the view model that the answers have been changed for the QuestionnaireResponse.QuestionnaireResponseItemComponent

resolveAnswerValueSet

the callback to resolve the answer value set and return the answer

resolveAnswerExpression

the callback to resolve answer options when answer-expression extension exists options

Constructors

Link copied to clipboard
fun QuestionnaireItemViewItem(questionnaireItem: <ERROR CLASS>, questionnaireResponseItem: <ERROR CLASS>, validationResult: ValidationResult, answersChangedCallback: (<ERROR CLASS>, <ERROR CLASS>, List<<ERROR CLASS>>) -> Unit, resolveAnswerValueSet: suspend (String) -> List<<ERROR CLASS>> = { emptyList() }, resolveAnswerExpression: suspend (<ERROR CLASS>) -> List<<ERROR CLASS>> = { emptyList() })

Functions

Link copied to clipboard
fun clearAnswer()

Clears existing answers.

Link copied to clipboard
fun isAnswerOptionSelected(answerOption: <ERROR CLASS>): Boolean
Link copied to clipboard
fun setAnswer(vararg questionnaireResponseItemAnswerComponent: <ERROR CLASS>)

Updates the answers. This will override any existing answers.

Properties

Link copied to clipboard
val answers: List<<ERROR CLASS>>

A read-only list of answers to be rendered in the view.

Link copied to clipboard
val questionnaireItem: <ERROR CLASS>
Link copied to clipboard
val validationResult: ValidationResult