MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / IntegerValidator

Class IntegerValidator

src/tools/ConfigMetaType.java:198–220  ·  view source on GitHub ↗

Title: IntegerValidator Description: Validator for integers

Source from the content-addressed store, hash-verified

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>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…