CommandLine.AbstractSimpleParseResultHandler (picocli 3.0.0-alpha-1 API)
Date: 2018-03-21

picocli

## Class CommandLine.AbstractSimpleParseResultHandler

- java.lang.Object
- - picocli.CommandLine.AbstractHandler<java.lang.Void,CommandLine.AbstractSimpleParseResultHandler>
  - - picocli.CommandLine.AbstractSimpleParseResultHandler

- All Implemented Interfaces:
    CommandLine.IParseResultHandler2<java.lang.Void>
  Enclosing class:
    CommandLine

      public abstract static class CommandLine.AbstractSimpleParseResultHandler
      extends CommandLine.AbstractHandler<java.lang.Void,CommandLine.AbstractSimpleParseResultHandler>
      implements CommandLine.IParseResultHandler2<java.lang.Void>

  Command line parse result handler that does not return a result. Prints help if requested, and otherwise calls `handle(CommandLine.ParseResult)` with the parse result. Facilitates implementation of the `CommandLine.IParseResultHandler2` interface.

  An example subclass can look like this:

       class MyResultHandler extends AbstractSimpleParseResultHandler {
           protected void handle(ParseResult parseResult) throws ExecutionException { ... }
       }

  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSimpleParseResultHandler()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `handle(CommandLine.ParseResult parseResult)` Processes the specified `ParseResult`.
    `java.lang.Void` | `handleParseResult(CommandLine.ParseResult parseResult, java.lang.Void ignored)` Prints help if requested, and otherwise calls `handle(CommandLine.ParseResult)`.
    `protected CommandLine.AbstractSimpleParseResultHandler` | `self()` Returns `this` to allow method chaining when calling the setters for a fluent API.

    - ### Methods inherited from class picocli.CommandLine.AbstractHandler

      `andExit, ansi, err, exitCode, hasExitCode, out, returnResultOrExit, useAnsi, useErr, useOut`

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

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

- - ### Constructor Detail

    - #### AbstractSimpleParseResultHandler

          public AbstractSimpleParseResultHandler()

  - ### Method Detail

    - #### handleParseResult

          public java.lang.Void handleParseResult(CommandLine.ParseResult parseResult,
                                                  java.lang.Void ignored)
                                           throws CommandLine.ExecutionException

      Prints help if requested, and otherwise calls `handle(CommandLine.ParseResult)`. Finally, either a list of result objects is returned, or the JVM is terminated if an exit code was set.
      Specified by:
        `handleParseResult` in interface `CommandLine.IParseResultHandler2<java.lang.Void>`
      Parameters:
        `parseResult` - the `ParseResult` that resulted from successfully parsing the command line arguments
        `ignored` - value returned as is
      Returns:
        the specified return value
      Throws:
        `CommandLine.ParameterException` - if the `HelpCommand` was invoked for an unknown subcommand. Any `ParameterExceptions` thrown from this method are treated as if this exception was thrown during parsing and passed to the `CommandLine.IExceptionHandler2`
        `CommandLine.ExecutionException` - if a problem occurred while processing the parse results; client code can use `CommandLine.ExecutionException.getCommandLine()` to get the command or subcommand where processing failed

    - #### handle

          protected abstract void handle(CommandLine.ParseResult parseResult)
                                  throws CommandLine.ExecutionException

      Processes the specified `ParseResult`. Implementations are responsible for catching any exceptions thrown in the `handle` method, and rethrowing an `ExecutionException` that details the problem and captures the offending `CommandLine` object.
      Parameters:
        `parseResult` - the `ParseResult` that resulted from successfully parsing the command line arguments
      Throws:
        `CommandLine.ExecutionException` - if a problem occurred while processing the parse results; client code can use `CommandLine.ExecutionException.getCommandLine()` to get the command or subcommand where processing failed

    - #### self

          protected CommandLine.AbstractSimpleParseResultHandler self()

      Description copied from class: `CommandLine.AbstractHandler`
      Returns `this` to allow method chaining when calling the setters for a fluent API.
      Specified by:
        `self` in class `CommandLine.AbstractHandler<java.lang.Void,CommandLine.AbstractSimpleParseResultHandler>`