Package snaq.util.jclap
Class BooleanOption
- java.lang.Object
-
- snaq.util.jclap.Option<Boolean>
-
- snaq.util.jclap.BooleanOption
-
-
Field Summary
-
Fields inherited from class snaq.util.jclap.Option
BUNDLE, LOCALE, MAX_COUNT_LIMIT, MIN_COUNT_LIMIT
-
-
Constructor Summary
Constructors Constructor Description BooleanOption(String shortName, String longName, String description, boolean allowMany)Creates a newBooleanOptioninstance.BooleanOption(String shortName, String longName, String description, int minCount, int maxCount)Creates a newBooleanOptioninstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<Boolean>getType()Returns the class type of value this option can take.protected BooleanparseValue(String arg, Locale locale)Parsing of a flag option makes little sense.-
Methods inherited from class snaq.util.jclap.Option
addValue, equals, getDescription, getLongName, getMaxCount, getMinCount, getShortName, getValues, hashCode, isAllowMany, isHidden, isMandatory, requiresValue, setHidden, setMinMaxCounts, toString
-
-
-
-
Constructor Detail
-
BooleanOption
public BooleanOption(String shortName, String longName, String description, int minCount, int maxCount)
Creates a newBooleanOptioninstance.- Parameters:
shortName- short name of the option (e.g. -?)longName- long name of the option (e.g. --help)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 option
-
BooleanOption
public BooleanOption(String shortName, String longName, String description, boolean allowMany)
Creates a newBooleanOptioninstance.- Parameters:
shortName- short name of the option (e.g. -?)longName- long name of the option (e.g. --help)description- helpful description of the option (printed for usage message)allowMany- whether this option can take more than one value (i.e. be specified more than once)
-
-
Method Detail
-
parseValue
protected Boolean parseValue(String arg, Locale locale) throws OptionException
Parsing of a flag option makes little sense. Possible argument for case of -f=true / --flag=1 / etc.- Specified by:
parseValuein classOption<Boolean>- 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
-
-