All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.config.LongRangeValidator Maven / Gradle / Ivy

package com.bigdata.config;

/**
 * Variant that imposes a range constraint on the value.
 * 
 * @author Bryan Thompson
 * @version $Id$
 */
public class LongRangeValidator extends LongValidator {

    final long min;
    final long max;
    
    public LongRangeValidator(long min,long max) {
    
        this.min = min;
        
        this.max = max;
        
    }
    
    /**
     * Accepts all values in the range specified to the ctor.
     */
    public void accept(String key, String val, Long 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