Class DirectoryOption
java.lang.Object
eu.svjatoslav.commons.cli_helper.parameter_parser.Option<File,DirectoryOption>
eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.DirectoryOption
This class is used to define commandline option which accepts directory as parameter.
-
Field Summary
Fields inherited from class eu.svjatoslav.commons.cli_helper.parameter_parser.Option
description, mandatory, parameters
-
Constructor Summary
Constructors -
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
-
DirectoryOption
Constructor.- Parameters:
description
- Description of the option.
-
-
Method Details
-
describeFormat
- Specified by:
describeFormat
in classOption<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
Retrieves the value of the option as aFile
object.- Specified by:
getValue
in classOption<File,
DirectoryOption> - Returns:
- The value of the option as a
File
object. - Throws:
RuntimeException
- if the option does not have exactly 1 argument.
-
mustExist
This method sets that directory shall exist.- Returns:
- This object.
-
mustNotExist
This method sets that directory shall not exist.- Returns:
- This object.
-
isValid
This method checks if a provided directory path is valid based on the specified existence type.- Specified by:
isValid
in classOption<File,
DirectoryOption> - Parameters:
value
- The directory path to validate.- Returns:
- True if the directory path is valid according to the existence type, otherwise false.
-