com.bigdata.config.IntegerRangeValidator Maven / Gradle / Ivy
package com.bigdata.config;
/**
* Variant that imposes a range constraint on the value.
*
* @author Bryan Thompson
* @version $Id$
*/
public class IntegerRangeValidator extends IntegerValidator {
final int min;
final int max;
public IntegerRangeValidator(int min,int max) {
this.min = min;
this.max = max;
}
/**
* Accepts all values in the range specified to the ctor.
*/
public void accept(String key, String val, Integer arg)
throws ConfigurationException {
if (arg < min || arg > max) {
throw new ConfigurationException(key, val, "Must be in [" + min
+ ":" + max + "]");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy