Add Javadoc comments to enhance code clarity
[cli-helper.git] / src / main / java / eu / svjatoslav / commons / cli_helper / parameter_parser / parameter / FileOptions.java
index 8328bd3..9534224 100755 (executable)
@@ -4,8 +4,8 @@
  */
 package eu.svjatoslav.commons.cli_helper.parameter_parser.parameter;
 
-import eu.svjatoslav.commons.cli_helper.parameter_parser.ParameterCount;
 import eu.svjatoslav.commons.cli_helper.parameter_parser.Option;
+import eu.svjatoslav.commons.cli_helper.parameter_parser.ParameterCount;
 
 import java.io.File;
 import java.util.List;
@@ -13,17 +13,28 @@ import java.util.stream.Collectors;
 
 import static eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.FileOption.validateFile;
 
+/**
+ * This class represents commandline option which accepts one or more parameters
+ * which are files.
+ */
 public class FileOptions extends Option<List<File>, FileOptions> {
 
     private ExistenceType existenceType = ExistenceType.DOES_NOT_MATTER;
 
     public FileOptions(final String description) {
-        super(description, ParameterCount.MULTI);
+        super(description, ParameterCount.ONE_OR_MORE);
     }
 
     @Override
     public String describeFormat() {
-        return existenceType.description + " files";
+        switch (existenceType) {
+            case MUST_EXIST:
+                return "One to many existing files.";
+            case MUST_NOT_EXIST:
+                return "One to many non-existing files.";
+            default:
+                return "One to many files.";
+        }
     }
 
     @Override
@@ -31,11 +42,21 @@ public class FileOptions extends Option<List<File>, FileOptions> {
         return parameters.stream().map(File::new).collect(Collectors.toList());
     }
 
+    /**
+     * This method is used to define that file shall exist in filesystem.
+     *
+     * @return This object.
+     */
     public FileOptions mustExist() {
         existenceType = ExistenceType.MUST_EXIST;
         return this;
     }
 
+    /**
+     * This method is used to define that file shall not exist in filesystem.
+     *
+     * @return This object.
+     */
     public FileOptions mustNotExist() {
         existenceType = ExistenceType.MUST_NOT_EXIST;
         return this;