Added special commandline argument type to support multiple strings.
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / commandline / parameterparser / parameter / FileParameter.java
old mode 100644 (file)
new mode 100755 (executable)
index 7a48e2c..98a9b42
@@ -1,31 +1,39 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ */
+
 package eu.svjatoslav.commons.commandline.parameterparser.parameter;
 
 import java.io.File;
 
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
 import eu.svjatoslav.commons.commandline.parameterparser.ArgumentCount;
 import eu.svjatoslav.commons.commandline.parameterparser.Parameter;
-import eu.svjatoslav.commons.commandline.parameterparser.type.StringArgument;
 
-public class FileParameter extends Parameter implements Argument {
+public class FileParameter extends Parameter {
 
        private ExistanceType existanceType = ExistanceType.DOES_NOT_MATTER;
 
        public FileParameter(final String description) {
-               super(new StringArgument(), description, ArgumentCount.SINGLE);
+               super(description, ArgumentCount.SINGLE);
        }
 
        @Override
        public FileParameter addAliases(final String... aliasArray) {
-               super.addAliases(aliasArray);
+               super.addAliasesProtected(aliasArray);
                return this;
        }
 
        @Override
        public java.lang.String describeFormat() {
-               return existanceType.description + "file";
+               return existanceType.description + " file";
        }
 
+       @Override
        public File getValue() {
 
                if (arguments.size() != 1)
@@ -47,7 +55,7 @@ public class FileParameter extends Parameter implements Argument {
 
        @Override
        public FileParameter setMandatory() {
-               mandatory = true;
+               setMandatoryProtected();
                return this;
        }