public abstract static class CommandLine.AbstractSimpleParseResultHandler extends CommandLine.AbstractHandler<java.lang.Void,CommandLine.AbstractSimpleParseResultHandler> implements CommandLine.IParseResultHandler2<java.lang.Void>
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 { ... }
}
| Constructor and Description |
|---|
AbstractSimpleParseResultHandler() |
| 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. |
andExit, ansi, err, exitCode, hasExitCode, out, returnResultOrExit, useAnsi, useErr, useOutpublic java.lang.Void handleParseResult(CommandLine.ParseResult parseResult, java.lang.Void ignored) throws CommandLine.ExecutionException
handle(CommandLine.ParseResult).
Finally, either a list of result objects is returned, or the JVM is terminated if an exit code was set.handleParseResult in interface CommandLine.IParseResultHandler2<java.lang.Void>parseResult - the ParseResult that resulted from successfully parsing the command line argumentsignored - value returned as isCommandLine.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.IExceptionHandler2CommandLine.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 failedprotected abstract void handle(CommandLine.ParseResult parseResult) throws CommandLine.ExecutionException
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.parseResult - the ParseResult that resulted from successfully parsing the command line argumentsCommandLine.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 failedprotected CommandLine.AbstractSimpleParseResultHandler self()
CommandLine.AbstractHandlerthis to allow method chaining when calling the setters for a fluent API.self in class CommandLine.AbstractHandler<java.lang.Void,CommandLine.AbstractSimpleParseResultHandler>