initial commit
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / commandline / parameterparser / arguments / ExistingDirectory.java
1 /*
2  * Svjatoslav Commons - shared library of common functionality.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.commons.commandline.parameterparser.arguments;
11
12 import java.io.File;
13
14 import eu.svjatoslav.commons.commandline.parameterparser.Argument;
15
16 public class ExistingDirectory implements Argument {
17
18         @Override
19         public java.lang.String describeFormat() {
20                 return "existing directory";
21         }
22
23         @Override
24         public boolean validate(final java.lang.String value) {
25                 final File file2 = new File(value);
26                 if (file2.exists() && file2.isDirectory())
27                         return true;
28                 return false;
29         }
30
31 }