protected abstract class Options.OptionDef extends Object
Modifier and Type | Field and Description |
---|---|
protected String[] |
mDefaultValues |
protected int |
mNumValuesNeeded |
Modifier | Constructor and Description |
---|---|
protected |
OptionDef(String name,
int numValuesNeeded,
String desc)
Construct an option that will be required (it must appear on
the command line and it does not have a default value.)
|
protected |
OptionDef(String name,
String[] defaultValues,
int numValuesNeeded,
String desc)
Construct an option that will be not be required to appear on
the command line and there will be multiple default values if
it does not appear on the command line.
|
protected |
OptionDef(String name,
String defaultValue,
int numValuesNeeded,
String desc)
Construct an option that will be not be required to appear on
the command line and there will be a default value if it does
not appear on the command line.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
getBigDecimal(String[] values,
int i)
Return the ith value for the option as a BigDecimal.
|
boolean |
getBoolean(String[] values,
int i)
Return the ith value for the option as a boolean.
|
Date |
getDate(String[] values,
int i)
Return the ith value for the option as a Date.
|
String[] |
getDefaultValues()
Get the default values for the option.
|
String |
getDesc()
Get the name description for the option.
|
Integer |
getInteger(String[] values,
int i)
Return the ith value for the option as an Integer.
|
protected String |
getIthDefaultAsString(int i)
Return the ith default value for the option as a String.
|
String |
getName()
Get the name of the option.
|
int |
getNumValuesNeeded()
Return the number of value(s) required by the option.
|
String |
getString(String[] values,
int i)
Return the ith value for the option as a String.
|
String[] |
getStrings(String[] values)
Return the values for the option as an array of strings.
|
boolean |
isRequiredOption()
Is the option required to appear on the command line?
|
String |
toString()
Convert this class to a string that will contain the following:
Name of the option class
Name of the option
Values needed by the option
The default values for the option
The is required flag
|
void |
validateOption(ArrayList values)
Method used to validate the values specified on the command line
for the option.
|
protected String[] mDefaultValues
protected int mNumValuesNeeded
protected OptionDef(String name, int numValuesNeeded, String desc)
name
- The name of the option. The name should include
the leading "-" (i.e. "-verbose").numValuesNeeded
- The number of value(s) required
by the option.desc
- The description of the option.protected OptionDef(String name, String defaultValue, int numValuesNeeded, String desc)
name
- The name of the option. The name should include
the leading "-" (i.e. "-verbose").The
- default value for the option if the option does
not appear on the command line.numValuesNeeded
- The number of value(s) required
by the option.desc
- The description of the option.protected OptionDef(String name, String[] defaultValues, int numValuesNeeded, String desc)
name
- The name of the option. The name should include
the leading "-" (i.e. "-verbose").The
- default values for the option if the option does
not appear on the command line.numValuesNeeded
- The number of value(s) required
by the option.desc
- The description of the option.public String getName()
public String getDesc()
public String getString(String[] values, int i) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.i
- The index of the value to return. The index is zero
relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith value or
ith default value for the option.CommandLineParser.OptionDataException
public Integer getInteger(String[] values, int i) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.i
- The index of the value to return. The index is zero
relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith value or
ith default value for the option.CommandLineParser.OptionDataException
public BigDecimal getBigDecimal(String[] values, int i) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.i
- The index of the value to return. The index is zero
relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith value or
ith default value for the option.CommandLineParser.OptionDataException
public boolean getBoolean(String[] values, int i) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.i
- The index of the value to return. The index is zero
relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith value or
ith default value for the option.CommandLineParser.OptionDataException
public Date getDate(String[] values, int i) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.i
- The index of the value to return. The index is zero
relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith value or
ith default value for the option.CommandLineParser.OptionDataException
public String[] getStrings(String[] values) throws CommandLineParser.OptionDataException
values
- The array of values retrieved from the command
line for the option.OptionDataException
- There are no values or default values
for the option.CommandLineParser.OptionDataException
public String[] getDefaultValues()
public boolean isRequiredOption()
public void validateOption(ArrayList values) throws CommandLineParser.OptionDataException
values
- An array that contains the values that were specified
on the command line for the option. If no values were specified then
the array will be empty.OptionDataException
- The value(s) specified for the
option are invalid.CommandLineParser.OptionDataException
public int getNumValuesNeeded()
ALL
implies an indefinite number of values are
required (or needed) by the option.
public String toString()
protected String getIthDefaultAsString(int i) throws CommandLineParser.OptionDataException
i
- The index of the default value to return. The index is
zero relative (i.e. a value of zero implies the first value).OptionDataException
- There is no ith default
value for the option.CommandLineParser.OptionDataException
Copyright © 2003, 2023, Oracle and/or its affiliates.