public class Argument extends Object
| Constructor and Description |
|---|
Argument(String primaryForm,
boolean argRequired,
String... parameterNames)
Contructor to create an argument definition.
|
| Modifier and Type | Method and Description |
|---|---|
Argument |
addForm(String aliasName)
Adds a possible representation of the command line argument.
|
String |
getPrimaryForm()
Returns the primary form of the argument.
|
boolean |
isRequired()
Returns whether or not this argument is required to be defined.
|
Argument |
setArgumentHandler(ArgumentHandler aHandler)
Sets the argument handler.
|
Argument |
setDefaults(String... newDefaults)
Sets the default values when no explicit values were provided.
|
Argument |
setDescription(String str)
Sets a usage description for this argument.
|
Argument |
setEnvVars(String... newEnvVars)
Sets the environment variables which will be checked for values before falling back on the
default values.
|
String |
toString()
Returns a human readable form.
|
public Argument(String primaryForm, boolean argRequired, String... parameterNames)
primaryForm - the form of the argument (e.g., --foo). Should start with a dash.argRequired - flag indicating whether or not the argument is required to be onthe command
lineparameterNames - names of the parameters to this argument for use in the usage generationpublic boolean isRequired()
public Argument setArgumentHandler(ArgumentHandler aHandler)
aHandler - argument handlerpublic Argument addForm(String aliasName)
aliasName - additional form to acceptpublic String getPrimaryForm()
public Argument setDescription(String str)
str - usage descriptionpublic Argument setDefaults(String... newDefaults)
newDefaults - default values for all argument parameterspublic Argument setEnvVars(String... newEnvVars)
newEnvVars - environment variable name array