Package snaq.util.jclap
Class EnumeratedIntegerOption
public final class EnumeratedIntegerOption extends EnumeratedOption<Integer>
Implementation of an
Option with value restricted to a
specified enumeration of type Integer.- Author:
- Giles Winstanley
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EnumeratedIntegerOption(String shortName, String longName, String description, boolean mandatory, boolean allowMany, Collection<Integer> allowedValues)Creates a newEnumeratedIntegerOptioninstance.EnumeratedIntegerOption(String shortName, String longName, String description, int minCount, int maxCount, Collection<Integer> allowedValues)Creates a newEnumeratedIntegerOptioninstance. -
Method Summary
Methods inherited from class snaq.util.jclap.EnumeratedOption
getAllowedValues, getAllowedValuesString, getAllowedValuesString, isValueValid, toStringMethods inherited from class snaq.util.jclap.Option
addValue, equals, getDescription, getLongName, getMaxCount, getMinCount, getShortName, getValues, hashCode, isAllowMany, isHidden, isMandatory, requiresValue, setHidden, setMinMaxCounts
-
Constructor Details
-
EnumeratedIntegerOption
public EnumeratedIntegerOption(String shortName, String longName, String description, int minCount, int maxCount, Collection<Integer> allowedValues)Creates a newEnumeratedIntegerOptioninstance.- Parameters:
shortName- short name of the option (e.g. -t)longName- long name of the option (e.g. --type)description- helpful description of the option (printed for usage message)minCount- minimum number of occurrences required for this optionmaxCount- maximum number of occurrences required for this optionallowedValues- collection of possible values this option can take
-
EnumeratedIntegerOption
public EnumeratedIntegerOption(String shortName, String longName, String description, boolean mandatory, boolean allowMany, Collection<Integer> allowedValues)Creates a newEnumeratedIntegerOptioninstance.- Parameters:
shortName- short name of the option (e.g. -t)longName- long name of the option (e.g. --type)description- helpful description of the option (printed for usage message)mandatory- whether this option must be specifiedallowMany- whether this option can take more than one value (i.e. be specified more than once)allowedValues- collection of possible values this option can take
-
-
Method Details
-
parseValue
Parses the argument string for an option value, optionally using the specified locale for reference (e.g. for date parsing).- Specified by:
parseValuein classOption<Integer>- Parameters:
arg- string argument from which a value is to be parsedlocale- locale as specified when initializing theCLAParserinstance- Returns:
- Value of the parsed argument string
- Throws:
OptionException- if a problem occurs while parsing the argument string
-
getType
Returns the class type of value this option can take.
-