Class ConfigParser
Reconstructs a wizard's answers from INI config. This goes through the possible Survey Questions and "answers" them in roughly the same order that an interactive wizard user would have.
Note that we deliberately use this ordered approach rather than just converting all
the Survey's Questions into Parameters and binding them all in one go. The reason for
doing so is the 'requiredness' of a wizard Parameter/Question is relatively static (i.e.
Question.isRequired()
, whereas whether a question is applicable/should be asked
changes dynamically based on earlier answers (i.e. an answer can unlock follow-up questions).
In other words, a straight conversion from Survey to List
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
appendComponent
(String prefix, Object subkey) Convenience for returning prefix[subkey]getConfigToWrite
(IncrementalBuildState buildState) getModelParameters
(IncrementalBuildState buildState) getVersion
(IncrementalBuildState buildState) nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState>
loadConfig
(nz.org.riskscape.engine.pipeline.ExecutionContext context, Map<String, List<?>> configToLoad) Produces aIncrementalBuildState
that's the same (roughly) as if the saved INIconfigToLoad
had been entered as answers to the interactive wizard.nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState>
loadConfig2
(Survey survey, nz.org.riskscape.engine.pipeline.ExecutionContext context, Map<String, List<?>> configToLoad) Produces aIncrementalBuildState
that's the same (roughly) as if the saved INIconfigToLoad
had been entered as answers to the interactive wizard.
-
Field Details
-
PROBLEMS
-
-
Constructor Details
-
ConfigParser
-
-
Method Details
-
appendComponent
Convenience for returning prefix[subkey]
-
loadConfig
public nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState> loadConfig(nz.org.riskscape.engine.pipeline.ExecutionContext context, Map<String, List<?>> configToLoad) Produces a
IncrementalBuildState
that's the same (roughly) as if the saved INIconfigToLoad
had been entered as answers to the interactive wizard. -
loadConfig2
public nz.org.riskscape.problem.ResultOrProblems<IncrementalBuildState> loadConfig2(Survey survey, nz.org.riskscape.engine.pipeline.ExecutionContext context, Map<String, List<?>> configToLoad) Produces a
IncrementalBuildState
that's the same (roughly) as if the saved INIconfigToLoad
had been entered as answers to the interactive wizard. -
getModelParameters
- Returns:
- a list of model parameters representing the wizard model's config
-
getConfigToWrite
public Stream<nz.org.riskscape.engine.util.Pair<String,String>> getConfigToWrite(IncrementalBuildState buildState) - Returns:
- A stream of unescaped key/value pairs, suitable for writing to a standard config file (like an ini file) which, when read back in to a sorted map, can be parsed by this config parser
-
getVersion
-