Class FloatOption
java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<Float,FloatOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.FloatOption
Represents a command-line option that accepts exactly one floating-point parameter.
-
Field Summary
Fields inherited from class eu.svjatoslav.commons.cli_helper.parameter_parser.Option
description, mandatory, parameters
-
Constructor Summary
ConstructorsConstructorDescriptionFloatOption
(String description) Constructs a FloatOption with a brief description and exactly one parameter. -
Method Summary
Methods inherited from class eu.svjatoslav.commons.cli_helper.parameter_parser.Option
addAliases, addParameter, getAliasesAsString, getHelp, isMandatory, isPresent, matchesAlias, noMoreArguments, setMandatory, setPresent
-
Constructor Details
-
FloatOption
Constructs a FloatOption with a brief description and exactly one parameter.- Parameters:
description
- a brief description of the option (e.g., "Scale factor").
-
-
Method Details
-
describeFormat
Describes the expected format ("Floating point number").- Specified by:
describeFormat
in classOption<Float,
FloatOption> - Returns:
- a short string describing the parameter format
-
getValue
Returns the float value specified by the user.- Specified by:
getValue
in classOption<Float,
FloatOption> - Returns:
- the parsed value as the generic type T.
- Throws:
RuntimeException
- if the user did not provide exactly one parameter.
-
isValid
Checks if the given string can be parsed as a float.- Specified by:
isValid
in classOption<Float,
FloatOption> - Parameters:
value
- the string to validate- Returns:
true
if the string is a valid float, otherwisefalse
-