Package nz.org.riskscape.wizard.ask
Class CompositeAsker
java.lang.Object
nz.org.riskscape.wizard.ask.BaseAsker
nz.org.riskscape.wizard.ask.CompositeAsker
- All Implemented Interfaces:
Asker
-
Field Summary
Fields inherited from class nz.org.riskscape.wizard.ask.BaseAsker
enumTranslator, translationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.wizard.Answer.Response>ask(AskRequest input) Get a bound value from the user - note that the response's original input is returned fromBaseAsker.askUnbound(AskRequest).nz.org.riskscape.problem.ResultOrProblems<Object>askUnbound(AskRequest input) Drive the givenCliPrompterto answer the givenQuestion.booleancanAsk(nz.org.riskscape.wizard.bld.IncrementalBuildState buildState, nz.org.riskscape.wizard.Question question) Methods inherited from class nz.org.riskscape.wizard.ask.BaseAsker
getChoices, getLocale, getMessage, getMessageSource, getOptionalMessage, pickChoice, toChoice
-
Constructor Details
-
CompositeAsker
public CompositeAsker(nz.org.riskscape.engine.i18n.TranslationContext context)
-
-
Method Details
-
canAsk
public boolean canAsk(nz.org.riskscape.wizard.bld.IncrementalBuildState buildState, nz.org.riskscape.wizard.Question question) Description copied from interface:AskerDetermine whether this
Askeris relevant for the givenQuestionandIncrementalBuildState- Returns:
- true if this
Askercan and should drive the cli to answer the givenQuestion.
-
askUnbound
Description copied from interface:AskerDrive the given
CliPrompterto answer the givenQuestion. Assume thatAsker.canAsk(IncrementalBuildState, Question)has already been tested and returned true.- Specified by:
askUnboundin interfaceAsker- Overrides:
askUnboundin classBaseAsker- Returns:
- an unbound object that should be able to be bound to a value of the type in the input's question, or problems if it failed
-
ask
public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.wizard.Answer.Response> ask(AskRequest input) Description copied from class:BaseAskerGet a bound value from the user - note that the response's original input is returned from
BaseAsker.askUnbound(AskRequest). This is partly here because the original API exposed this method on the interface, and keeping this method here keeps the refactoring/change noise down to a minimum while allowing the interface to change in the way we want to preserve the right amount of encapsulation
-