java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<File,DirectoryOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.DirectoryOption

public class DirectoryOption extends Option<File,DirectoryOption>
This class is used to define commandline option which accepts directory as parameter.
  • Constructor Details

    • DirectoryOption

      public DirectoryOption(String description)
      Constructor.
      Parameters:
      description - Description of the option.
  • Method Details

    • describeFormat

      public String describeFormat()
      Specified by:
      describeFormat in class Option<File,DirectoryOption>
      Returns:
      Single line parameter type description. For example: "file", "date", "integer", "regular expression", etc..

      Note: for argument purpose description there is Option.description

    • getValue

      public File getValue()
      Retrieves the value of the option as a File object.
      Specified by:
      getValue in class Option<File,DirectoryOption>
      Returns:
      The value of the option as a File object.
      Throws:
      RuntimeException - if the option does not have exactly 1 argument.
    • mustExist

      public DirectoryOption mustExist()
      This method sets that directory shall exist.
      Returns:
      This object.
    • mustNotExist

      public DirectoryOption mustNotExist()
      This method sets that directory shall not exist.
      Returns:
      This object.
    • isValid

      public boolean isValid(String value)
      This method checks if a provided directory path is valid based on the specified existence type.
      Specified by:
      isValid in class Option<File,DirectoryOption>
      Parameters:
      value - The directory path to validate.
      Returns:
      True if the directory path is valid according to the existence type, otherwise false.