java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<Float,FloatOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.FloatOption

public class FloatOption extends Option<Float,FloatOption>
Represents a command-line option that accepts exactly one floating-point parameter.
  • Constructor Details

    • FloatOption

      public FloatOption(String description)
      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

      public String describeFormat()
      Describes the expected format ("Floating point number").
      Specified by:
      describeFormat in class Option<Float,FloatOption>
      Returns:
      a short string describing the parameter format
    • getValue

      public Float getValue()
      Returns the float value specified by the user.
      Specified by:
      getValue in class Option<Float,FloatOption>
      Returns:
      the parsed value as the generic type T.
      Throws:
      RuntimeException - if the user did not provide exactly one parameter.
    • isValid

      public boolean isValid(String value)
      Checks if the given string can be parsed as a float.
      Specified by:
      isValid in class Option<Float,FloatOption>
      Parameters:
      value - the string to validate
      Returns:
      true if the string is a valid float, otherwise false