initial commit
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / commandline / parameterparser / arguments / IntegerArgument.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 eu.svjatoslav.commons.commandline.parameterparser.Argument;
13
14 public class IntegerArgument implements Argument {
15
16         @Override
17         public java.lang.String describeFormat() {
18                 return "integer";
19         }
20
21         @Override
22         public boolean validate(final java.lang.String value) {
23                 try {
24                         java.lang.Integer.valueOf(value);
25                         return true;
26                 } catch (final NumberFormatException e) {
27                         return false;
28                 }
29         }
30
31 }