X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fcommons%2Fcommandline%2Fparameterparser%2Ftype%2FNonExistingFile.java;fp=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fcommons%2Fcommandline%2Fparameterparser%2Ftype%2FNonExistingFile.java;h=f3e441e77a489158fb0117629f99fb563f541c5f;hb=5fecd6b03f114cab04e0389bd1900b27726c73ea;hp=0000000000000000000000000000000000000000;hpb=8c722730b63b53a6d5110d9c1bea38b63dc72675;p=svjatoslav_commons.git diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java new file mode 100755 index 0000000..f3e441e --- /dev/null +++ b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java @@ -0,0 +1,31 @@ +/* + * Svjatoslav Commons - shared library of common functionality. + * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public License + * as published by the Free Software Foundation. + */ + +package eu.svjatoslav.commons.commandline.parameterparser.type; + +import java.io.File; + +import eu.svjatoslav.commons.commandline.parameterparser.Argument; + +public class NonExistingFile implements Argument { + + @Override + public java.lang.String describeFormat() { + return "non existing file"; + } + + @Override + public boolean validate(final java.lang.String value) { + final File file3 = new File(value); + if (!file3.exists()) + return true; + return false; + } + +}