Title: IntegerValidator Description: Validator for integers
| 196 | * <p>Description: Validator for integers</p> |
| 197 | */ |
| 198 | public static class IntegerValidator implements ArgValueValidator { |
| 199 | private final int min; |
| 200 | /** |
| 201 | * Creates a new IntegerValidator |
| 202 | * @param min The minumum value of the integer |
| 203 | */ |
| 204 | public IntegerValidator(final int min) { |
| 205 | this.min = min; |
| 206 | } |
| 207 | /** |
| 208 | * {@inheritDoc} |
| 209 | * @see net.opentsdb.tools.ArgValueValidator#validate(net.opentsdb.tools.ConfigArgP.ConfigurationItem) |
| 210 | */ |
| 211 | @Override |
| 212 | public void validate(final ConfigurationItem citem) { |
| 213 | try { |
| 214 | int i = Integer.parseInt(citem.getValue()); |
| 215 | if(i < min) throw EX; |
| 216 | } catch (Exception ex) { |
| 217 | throw new IllegalArgumentException("Invalid Integer value [" + citem.getValue() + "] for " + citem.getName()); |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * <p>Title: BooleanValidator</p> |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…