org.avis.util
Class CommandLineOptions

java.lang.Object
  extended by org.avis.util.CommandLineOptions

public abstract class CommandLineOptions
extends Object

A set of command line options. Subclasses implement handleArg(Queue) and checkOptions().

Author:
Matthew Phillips

Constructor Summary
CommandLineOptions()
          Create a new instance.
CommandLineOptions(String... argv)
          Create a new instance and immediately parse an array of command line options and create an option set.
 
Method Summary
static void handleError(String appName, String usage, Exception ex)
          Handle an error in parsing command line options or starting the command line application by printing an error on the console and exiting the VM with an error code.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLineOptions

public CommandLineOptions()
Create a new instance.

See Also:
handleOptions(String...)

CommandLineOptions

public CommandLineOptions(String... argv)
                   throws IllegalCommandLineOption
Create a new instance and immediately parse an array of command line options and create an option set.

Parameters:
argv - The command line options.
Throws:
IllegalConfigOptionException - if an error is detected.
IllegalCommandLineOption
See Also:
handleOptions(String...)
Method Detail

handleError

public static void handleError(String appName,
                               String usage,
                               Exception ex)
Handle an error in parsing command line options or starting the command line application by printing an error on the console and exiting the VM with an error code.

Parameters:
appName - The application's name.
usage - The command line usage string. The app name will be appended to this, so this should just include the options summary plus any detail.
ex - The error that triggered the exit. IllegalCommandLineOption is handled specially by printing a usage string.


Copyright © 2008 Matthew Phillips. All Rights Reserved.