Add Javadoc comments to enhance code clarity
[cli-helper.git] / src / main / java / eu / svjatoslav / commons / cli_helper / parameter_parser / parameter / DirectoryOptions.java
index 6a84919..d012cf9 100755 (executable)
@@ -11,19 +11,49 @@ 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<List<File>, DirectoryOptions> {
 
+    /**
+     * This enum is used to define if resource denoted by particular option parameter shall exist or not.
+     * <p>
+     * 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.MULTI);
+        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() {
-        return existenceType.description + " directories";
+        switch (existenceType) {
+            case MUST_EXIST:
+                return "One to many existing directories.";
+            case MUST_NOT_EXIST:
+                return "One to many non-existing directories.";
+            default:
+                return "One to many directories.";
+        }
     }
 
+    /**
+     * 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<File> getValue() {
         return parameters.stream().map(File::new).collect(Collectors.toList());
@@ -39,6 +69,7 @@ public class DirectoryOptions extends Option<List<File>, DirectoryOptions> {
         return this;
     }
 
+
     @Override
     public boolean isValid(final String value) {
         final File file = new File(value);