Mercurial > repos > timpalpant > java_genomics_toolkit
comparison java-genomics-toolkit/src/edu/unc/genomics/PositiveIntegerValidator.java @ 0:1daf3026d231
Upload alpha version
author | timpalpant |
---|---|
date | Mon, 13 Feb 2012 21:55:55 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1daf3026d231 |
---|---|
1 package edu.unc.genomics; | |
2 | |
3 import com.beust.jcommander.IParameterValidator; | |
4 import com.beust.jcommander.ParameterException; | |
5 | |
6 /** | |
7 * @author timpalpant | |
8 * | |
9 */ | |
10 public class PositiveIntegerValidator implements IParameterValidator { | |
11 | |
12 /* (non-Javadoc) | |
13 * @see com.beust.jcommander.IParameterValidator#validate(java.lang.String, java.lang.String) | |
14 */ | |
15 @Override | |
16 public void validate(String name, String value) throws ParameterException { | |
17 int n = Integer.parseInt(value); | |
18 if (n <= 0) { | |
19 throw new ParameterException("Parameter "+name+" must be > 0 (was "+value+")"); | |
20 } | |
21 } | |
22 | |
23 } |