Class PickQuestionSet

java.lang.Object
nz.org.riskscape.wizard.survey2.PickQuestionSet

public class PickQuestionSet extends Object

Special parameter type used by surveys that is used to indicate a choice of question set. We can't use a QuestionSet directly as there's no way to bind them without interrogating the Survey, which complicates the binding (and/or management of QuestionSets). So instead, we have a PickQuestionSet which gives us a special parameter type that we can look for in our survey logic and a pointer to the question set that was chosen.

The class also has a field for setting the questionSet which can't be relied on as being there, but will be set in specific circumstances. It's a bit of a kludge but makes it nice and easy for passing it around and/or memoizing the question set.

  • Field Details

    • questionSetId

      public String questionSetId
    • questionSet

      @Nullable public QuestionSet questionSet
  • Constructor Details

    • PickQuestionSet

      public PickQuestionSet()
    • PickQuestionSet

      public PickQuestionSet(String questionSetId)
    • PickQuestionSet

      public PickQuestionSet(QuestionSet qs)
  • Method Details

    • isSkip

      public boolean isSkip()
      Returns:
      true if the user's choice was to skip the question sets that were offered to them.
    • asChoice

      public Choice asChoice()
      Returns:
      the QuestionSet as a Choice that can be presented in either the CLI or UI
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getQuestionSetId

      public String getQuestionSetId()