Interface CommandLine.IParameterExceptionHandler

Enclosing class:
CommandLine

public static interface CommandLine.IParameterExceptionHandler
Classes implementing this interface know how to handle ParameterExceptions (usually from invalid user input).

Implementation Requirements:

Implementors that need to print messages to the console should use the output and error PrintWriters, and the color scheme from the CommandLine object obtained from the exception.

Implementation Note:

See CommandLine.getParameterExceptionHandler() for a description of the default handler.

API Note:

This interface supersedes CommandLine.IExceptionHandler2.

Since:
4.0
See Also:
  • Method Details

    • handleParseException

      int handleParseException(CommandLine.ParameterException ex, String[] args) throws Exception
      Handles a ParameterException that occurred while parsing the command line arguments and returns an exit code suitable for returning from CommandLine.execute(String...).
      Parameters:
      ex - the ParameterException describing the problem that occurred while parsing the command line arguments, and the CommandLine representing the command or subcommand whose input was invalid
      args - the command line arguments that could not be parsed
      Returns:
      an exit code
      Throws:
      Exception