Package com.portal.common
Class Options.FlagOptionDef
java.lang.Object
com.portal.common.Options.OptionDef
com.portal.common.Options.FlagOptionDef
- Enclosing class:
Options
Definition of a flag option. This is an option that will be
true if it appears on the command line and false if it does not
appear on the command line.
-
Field Summary
Fields inherited from class com.portal.common.Options.OptionDef
mDefaultValues, mNumValuesNeeded
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the ith value for the option as a boolean.void
validateOption
(ArrayList values) Ensure that the option does not have any values.Methods inherited from class com.portal.common.Options.OptionDef
getBigDecimal, getBoolean, getDate, getDefaultValues, getDesc, getInteger, getIthDefaultAsString, getName, getNumValuesNeeded, getStrings, isRequiredOption, toString
-
Constructor Details
-
FlagOptionDef
Construct a flag option. This is an option that will be true if it appears on the command line and false if it does not appear on the command line.- Parameters:
name
- The name of the option. The name should include the leading "-" (i.e. "-verbose").desc
- The description of the option.
-
-
Method Details
-
validateOption
Ensure that the option does not have any values. The appearance of the option on the command line implies a value of true.- Overrides:
validateOption
in classOptions.OptionDef
- Parameters:
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.- Throws:
CommandLineParser.OptionDataException
- One or more values followed this option.
-
getString
Return the ith value for the option as a boolean. For a FlagOption this method only makes senses for an index of zero.- Overrides:
getString
in classOptions.OptionDef
- Parameters:
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). This method only makes senses for an index of zero.- Returns:
- If the index is zero, true will be returned if the option exist (otherwise false). If the index is not zero then an OptionDataException will be thrown.
- Throws:
CommandLineParser.OptionDataException
- The value for i is not zero.
-