Class AddQuestion<T>

java.lang.Object
nz.org.riskscape.wizard.survey2.AddQuestion<T>

public class AddQuestion<T> extends Object

Returned from a call to DefaultQuestionSet2.addQuestion(String, Class) to allow simpler declaration of pipeline building following a question being answered

  • Constructor Details

  • Method Details

    • then

      public DefaultQuestionSet2 then(TypedPipelineChanger<T> changer)

      Finish adding the question to the set by describing the change to make when it is answered. Note this is only suitable for single-value Questions - for multi-value Questions use thenForEach(BiFunction).

      Returns:
      the question set to allow more questions to be added in a fluid style
    • then

      public DefaultQuestionSet2 then(PipelineChanger changer)

      Finish adding the question to the set by describing the change to make when it is answered

      Returns:
      the question set to allow more questions to be added in a fluid style
    • thenForEach

      Same as then(TypedPipelineChanger) but handles multi-valued Questions.

      Returns:
      the question set to allow more questions to be added in a fluid style
    • customizeQuestion

      public AddQuestion<T> customizeQuestion(Function<Question,Question> mutator)

      Allow arbitrary changes to the question by supplying a function that returns a new function, e.g. customizeQuestion(q -> q.optionalOne())

    • dependsOn

      public AddQuestion<T> dependsOn(String questionNamed)
    • thenNoChange

      public DefaultQuestionSet2 thenNoChange()
      Returns:
      the question set to allow more questions to be added in a fluid style
    • askWhenResponseIs

      public AddQuestion<T> askWhenResponseIs(String questionNamed, Object hasResponse)

      Convenience for when a question depends on a previous question having been answered, and that response must also have a certain value.

    • askWhenDependencyIs

      public AddQuestion<T> askWhenDependencyIs(Predicate<Object> predicate)
    • ifNotAnswered

      public AddQuestion<T> ifNotAnswered(String questionName)

      Only asks this question if the other question was not answered (i.e. skipped or not offered).

    • getQuestionSet

      public DefaultQuestionSet2 getQuestionSet()
    • getParameterType

      public Class<T> getParameterType()
    • getBuilding

      public Question getBuilding()