Class AddQuestion<T>
Returned from a call to DefaultQuestionSet2.addQuestion(String, Class)
to allow simpler declaration of
pipeline building following a question being answered
-
Constructor Summary
ConstructorDescriptionAddQuestion
(DefaultQuestionSet2 questionSet, String name, Class<T> parameterType) AddQuestion
(DefaultQuestionSet2 questionSet, Question q, Class<T> parameterType) -
Method Summary
Modifier and TypeMethodDescriptionaskWhenDependencyIs
(Predicate<Object> predicate) askWhenResponseIs
(String questionNamed, Object hasResponse) askWhenResponseIs
(Question dependency, Object hasResponse) Convenience for when a question depends on a previous question having been answered, and that response must also have a certain value.customizeQuestion
(Function<Question, Question> mutator) Allow arbitrary changes to the question by supplying a function that returns a new function, e.g.ifNotAnswered
(String questionName) Only asks this question if the other question was not answered (i.e.then
(PipelineChanger changer) Finish adding the question to the set by describing the change to make when it is answeredthen
(TypedPipelineChanger<T> changer) Finish adding the question to the set by describing the change to make when it is answered.Same asthen(TypedPipelineChanger)
but handles multi-valued Questions.
-
Constructor Details
-
AddQuestion
-
AddQuestion
-
-
Method Details
-
then
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
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
public DefaultQuestionSet2 thenForEach(BiFunction<PipelineChangeInput, List<T>, IncompletePipelineChange> changer) 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
Allow arbitrary changes to the question by supplying a function that returns a new function, e.g.
customizeQuestion(q -> q.optionalOne())
-
dependsOn
-
dependsOn
-
thenNoChange
- Returns:
- the question set to allow more questions to be added in a fluid style
-
askWhenResponseIs
-
askWhenResponseIs
Convenience for when a question depends on a previous question having been answered, and that response must also have a certain value.
-
askWhenDependencyIs
-
ifNotAnswered
Only asks this question if the other question was not answered (i.e. skipped or not offered).
-
getQuestionSet
-
getParameterType
-
getBuilding
-