java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<Boolean,NullOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.NullOption

public class NullOption extends Option<Boolean,NullOption>
Represents a command-line option that accepts exactly zero parameters. Often used for flags that are either present or absent.
  • Constructor Details

    • NullOption

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

      public String describeFormat()
      Describes the expected format of this option (i.e., no parameters).
      Specified by:
      describeFormat in class Option<Boolean,NullOption>
      Returns:
      the string "None."
    • getValue

      public Boolean getValue()
      Returns whether this option was present on the command line.
      Specified by:
      getValue in class Option<Boolean,NullOption>
      Returns:
      true if the user specified this option, otherwise false.
    • isValid

      public boolean isValid(String value)
      Always returns true, since this option has no parameters and needs no validation.
      Specified by:
      isValid in class Option<Boolean,NullOption>
      Parameters:
      value - the parameter string to test
      Returns:
      true if valid; false otherwise