Package picocli
Class CommandLine.ParseResult.Builder
java.lang.Object
picocli.CommandLine.ParseResult.Builder
- Enclosing class:
CommandLine.ParseResult
Builds immutable
ParseResult instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CommandLine.Model.CommandSpecprivate intprivate final CommandLine.ParseResult.GroupMatchContainer(package private) booleanprivate final List<CommandLine.Model.ArgSpec> private final List<CommandLine.Model.OptionSpec> private final List<CommandLine.Model.PositionalParamSpec> private final Set<CommandLine.Model.OptionSpec> private final List<List<CommandLine.Model.PositionalParamSpec>> private final Set<CommandLine.Model.PositionalParamSpec> private final List<CommandLine.ParseResult> private booleanprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(CommandLine.Model.ArgSpec arg, int position) Adds the specifiedOptionSpecorPositionalParamSpecto the list of options and parameters that were matched on the command line.voidAdds the specifiedOptionSpecto the list of options that were matched on the command line.(package private) voidaddOriginalStringValue(CommandLine.Model.ArgSpec argSpec, String value) addPositionalParam(CommandLine.Model.PositionalParamSpec positionalParam, int position) Adds the specifiedPositionalParamSpecto the list of parameters that were matched on the command line.(package private) voidaddStringValue(CommandLine.Model.ArgSpec argSpec, String value) (package private) voidaddTypedValues(CommandLine.Model.ArgSpec argSpec, int position, Object typedValue) private CommandLine.ParseResult.BuilderaddUnmatched(int position, String arg) Adds the specified command line argument to the list of unmatched command line arguments, and remembers the position of this argument.addUnmatched(String arg) Adds the specified command line argument to the list of unmatched command line arguments.addUnmatched(Stack<String> args) Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.(package private) voidbuild()Creates and returns a newParseResultinstance for this builder's configuration.expandedArgs(Collection<String> expandedArgs) Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.private voidnowProcessing(CommandLine.Model.ArgSpec spec, Object value) originalArgs(String[] originalArgs) Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)method, before @-file expansion.subcommand(CommandLine.ParseResult subcommand) Sets the specifiedParseResultfor a subcommand that was matched on the command line.private int
-
Field Details
-
commandSpec
-
matchedArgsList
-
matchedOptionsList
-
matchedPositionalsList
-
options
-
positionals
-
unmatched
-
firstUnmatchedPosition
private int firstUnmatchedPosition -
originalArgList
-
expandedArgList
-
positionalParams
-
subcommands
-
usageHelpRequested
private boolean usageHelpRequested -
versionHelpRequested
private boolean versionHelpRequested -
isInitializingDefaultValues
boolean isInitializingDefaultValues -
errors
-
nowProcessing
-
groupMatchContainer
-
-
Constructor Details
-
Builder
-
-
Method Details
-
build
Creates and returns a newParseResultinstance for this builder's configuration. -
nowProcessing
-
add
Adds the specifiedOptionSpecorPositionalParamSpecto the list of options and parameters that were matched on the command line.- Parameters:
arg- the matchedOptionSpecorPositionalParamSpecposition- the command line position at which thePositionalParamSpecwas matched. Ignored forOptionSpecs.- Returns:
- this builder for method chaining
-
addOption
Adds the specifiedOptionSpecto the list of options that were matched on the command line. -
addPositionalParam
public CommandLine.ParseResult.Builder addPositionalParam(CommandLine.Model.PositionalParamSpec positionalParam, int position) Adds the specifiedPositionalParamSpecto the list of parameters that were matched on the command line.- Parameters:
positionalParam- the matchedPositionalParamSpecposition- the command line position at which thePositionalParamSpecwas matched.- Returns:
- this builder for method chaining
-
addUnmatched
Adds the specified command line argument to the list of unmatched command line arguments, and remembers the position of this argument. This position is used in the UnmatchedArgumentException message.- Since:
- 4.6
-
addUnmatched
Adds the specified command line argument to the list of unmatched command line arguments. -
addUnmatched
Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments. -
totalArgCount
private int totalArgCount() -
subcommand
Sets the specifiedParseResultfor a subcommand that was matched on the command line. -
originalArgs
Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)method, before @-file expansion.- See Also:
-
expandedArgs
Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.- Since:
- 4.4
- See Also:
-
addStringValue
-
addOriginalStringValue
-
addTypedValues
-
addError
-
beforeMatchingGroupElement
- Throws:
Exception
-