X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=cli-helper.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fcommons%2Fcli_helper%2Fparameter_parser%2Fparameter%2FDirectoryOptions.java;fp=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fcommons%2Fcli_helper%2Fparameter_parser%2Fparameter%2FDirectoryOptions.java;h=d012cf9598d360c080242b24c37974e1016be0bc;hp=26321743abced8ccadba213945cdbe21348528bd;hb=b4b3152b0012f4e0b0b5d3e98cc8a7e4a12e8c18;hpb=e8f029969d48634280dc5ad9d9c43ba4c0699cd9 diff --git a/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java b/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java index 2632174..d012cf9 100755 --- a/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java +++ b/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java @@ -11,14 +11,32 @@ import java.io.File; import java.util.List; import java.util.stream.Collectors; +/** + * DirectoryOptions class represents a command-line option for one or more directories. + */ public class DirectoryOptions extends Option, DirectoryOptions> { + /** + * This enum is used to define if resource denoted by particular option parameter shall exist or not. + *

+ * This allows to specify for example if directory shall exist or not. + */ private ExistenceType existenceType = ExistenceType.DOES_NOT_MATTER; + /** + * Creates a new DirectoryOptions object with the given description. + * + * @param description The description of the directory options. + */ public DirectoryOptions(final String description) { super(description, ParameterCount.ONE_OR_MORE); } + /** + * Returns a string describing the format of the option. + * + * @return A string describing the format of the option. + */ @Override public String describeFormat() { switch (existenceType) { @@ -31,6 +49,11 @@ public class DirectoryOptions extends Option, DirectoryOptions> { } } + /** + * Returns the value of the option as a list of File objects. + * + * @return The value of the option as a list of File objects. + */ @Override public List getValue() { return parameters.stream().map(File::new).collect(Collectors.toList()); @@ -46,6 +69,7 @@ public class DirectoryOptions extends Option, DirectoryOptions> { return this; } + @Override public boolean isValid(final String value) { final File file = new File(value);