Class NullOption
java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<Boolean,NullOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.NullOption
Represents a command-line option that accepts exactly zero parameters.
Often used for flags that are either present or absent.
-
Field Summary
Fields inherited from class eu.svjatoslav.commons.cli_helper.parameter_parser.Option
description, mandatory, parameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDescribes the expected format of this option (i.e., no parameters).getValue()Returns whether this option was present on the command line.booleanAlways returnstrue, since this option has no parameters and needs no validation.Methods inherited from class eu.svjatoslav.commons.cli_helper.parameter_parser.Option
addAliases, addParameter, getAliasesAsString, getHelp, isMandatory, isPresent, matchesAlias, noMoreArguments, setMandatory, setPresent
-
Constructor Details
-
NullOption
Creates a NullOption (e.g. a boolean flag) that requires no parameters.- Parameters:
description- a brief description of what this option does (e.g., "Enable debug mode").
-
-
Method Details
-
describeFormat
Describes the expected format of this option (i.e., no parameters).- Specified by:
describeFormatin classOption<Boolean,NullOption> - Returns:
- the string "None."
-
getValue
Returns whether this option was present on the command line.- Specified by:
getValuein classOption<Boolean,NullOption> - Returns:
trueif the user specified this option, otherwisefalse.
-
isValid
Always returnstrue, since this option has no parameters and needs no validation.- Specified by:
isValidin classOption<Boolean,NullOption> - Parameters:
value- the parameter string to test- Returns:
trueif valid;falseotherwise
-