public class Option
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Option.Arguments
Arguments may or may not have parameters.
|
static class |
Option.Execute
Any extender of Execute MUST implement one of these methods.
|
static class |
Option.TerminateOptionsException |
Constructor and Description |
---|
Option(char shortOption,
java.lang.String longOption,
boolean required,
java.lang.String description,
Option.Arguments arguments,
java.lang.String argumentName,
Option.Execute execute)
Construct an Option, to be returned by a Driver.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.String> |
execute(java.lang.String program,
java.lang.String[] args,
java.util.List<Option> options,
java.io.PrintStream out)
Construct a list of Options, then invoke Option.execute("myprogram",args,options).
|
static java.util.List<Option> |
getStandardOptions(java.lang.String program,
java.io.PrintStream out)
Return the standard options such as 'options' and 'help'.
|
public Option(char shortOption, java.lang.String longOption, boolean required, java.lang.String description, Option.Arguments arguments, java.lang.String argumentName, Option.Execute execute)
shortOption
- The single character Option.longOption
- The long name Option.required
- If the option MUST be passed.description
- Description of the Option for help.arguments
- Set to one of the Arguments enumeration to determine if
this Option has a parameter.argumentName
- The name of the argument to the Option if it has one,
otherwise must be null.execute
- This callback will be executed when the option is passed.
Typically this will be used to set a field in the Driver, possibly with
validation.public static java.util.List<Option> getStandardOptions(java.lang.String program, java.io.PrintStream out)
program
- out
- public static java.util.List<java.lang.String> execute(java.lang.String program, java.lang.String[] args, java.util.List<Option> options, java.io.PrintStream out) throws java.lang.IllegalArgumentException
program
- The program name, used in help.args
- Program arguments, typically from main(String args[])options
- List of options to executeout
- Typically System.out, but if null will prevent prompting for
required parameters, instead throwing an exception.java.lang.IllegalArgumentException
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.