picocli

## Class CommandLine.ParseResult.Builder

- java.lang.Object
- - picocli.CommandLine.ParseResult.Builder

Enclosing class:
  CommandLine.ParseResult

    public static class CommandLine.ParseResult.Builder
    extends java.lang.Object

Builds immutable `ParseResult` instances.

### Method Summary

All Methods Instance Methods Concrete Methods
`CommandLine.ParseResult.Builder` `add(CommandLine.Model.ArgSpec arg, int position)` Adds the specified `OptionSpec` or `PositionalParamSpec` to the list of options and parameters that were matched on the command line.
`void` `addError(CommandLine.PicocliException ex)`
`CommandLine.ParseResult.Builder` `addOption(CommandLine.Model.OptionSpec option)` Adds the specified `OptionSpec` to the list of options that were matched on the command line.
`CommandLine.ParseResult.Builder` `addPositionalParam(CommandLine.Model.PositionalParamSpec positionalParam, int position)` Adds the specified `PositionalParamSpec` to the list of parameters that were matched on the command line.
`CommandLine.ParseResult.Builder` `addUnmatched(java.util.Stack<java.lang.String> args)` Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.
`CommandLine.ParseResult.Builder` `addUnmatched(java.lang.String arg)` Adds the specified command line argument to the list of unmatched command line arguments.
`CommandLine.ParseResult` `build()` Creates and returns a new `ParseResult` instance for this builder's configuration.
`CommandLine.ParseResult.Builder` `originalArgs(java.lang.String[] originalArgs)` Sets the specified command line arguments that were parsed.
`CommandLine.ParseResult.Builder` `subcommand(CommandLine.ParseResult subcommand)` Sets the specified `ParseResult` for a subcommand that was matched on the command line.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### build

    public CommandLine.ParseResult build()

Creates and returns a new `ParseResult` instance for this builder's configuration.

#### add

    public CommandLine.ParseResult.Builder add(CommandLine.Model.ArgSpec arg,
                                               int position)

Adds the specified `OptionSpec` or `PositionalParamSpec` to the list of options and parameters that were matched on the command line.

Parameters:
  `arg` - the matched `OptionSpec` or `PositionalParamSpec`
  `position` - the command line position at which the `PositionalParamSpec` was matched. Ignored for `OptionSpec`s.
Returns:
  this builder for method chaining

#### addOption

    public CommandLine.ParseResult.Builder addOption(CommandLine.Model.OptionSpec option)

Adds the specified `OptionSpec` to 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 specified `PositionalParamSpec` to the list of parameters that were matched on the command line.

Parameters:
  `positionalParam` - the matched `PositionalParamSpec`
  `position` - the command line position at which the `PositionalParamSpec` was matched.
Returns:
  this builder for method chaining

#### addUnmatched

    public CommandLine.ParseResult.Builder addUnmatched(java.lang.String arg)

Adds the specified command line argument to the list of unmatched command line arguments.

#### addUnmatched

    public CommandLine.ParseResult.Builder addUnmatched(java.util.Stack<java.lang.String> args)

Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.

#### subcommand

    public CommandLine.ParseResult.Builder subcommand(CommandLine.ParseResult subcommand)

Sets the specified `ParseResult` for a subcommand that was matched on the command line.

#### originalArgs

    public CommandLine.ParseResult.Builder originalArgs(java.lang.String[] originalArgs)

Sets the specified command line arguments that were parsed.

#### addError

    public void addError(CommandLine.PicocliException ex)