@@ -0,0 +1,1801 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0A%0Apackage com.dmdirc.util.validators;%0A%0A/**%0A * Validates that a number is within certain bounds.%0A */%0Apublic class IntegerValidator implements Validator%3CInteger%3E %7B%0A%0A    /**%0A     * The minimum value for this number.%0A     */%0A    protected final int min;%0A%0A    /**%0A     * The maximum value for this number.%0A     */%0A    protected final int max;%0A%0A    /**%0A     * Creates a new numerical validator with the specified bounds.%0A     *%0A     * @param min The minimum value for the number, or -1 for unlimited.%0A     * @param max The maximum value for the number, or -1 for unlimited.%0A     */%0A    public IntegerValidator(final int min, final int max) %7B%0A        this.max = max == -1 ? Integer.MAX_VALUE : max;%0A        this.min = min == -1 ? Integer.MIN_VALUE : min;%0A        if (this.min %3E this.max) %7B%0A            throw new IllegalArgumentException(%22min must be less than max.%22);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Retrieves the maximum value that this validator will allow.%0A     *%0A     * @return This validator's maximum value%0A     */%0A    public int getMax() %7B%0A        return max;%0A    %7D%0A%0A    /**%0A     * Retrieves the minimum value that this validator will allow.%0A     *%0A     * @return This validator's minimum value%0A     */%0A    public int getMin() %7B%0A        return min;%0A    %7D%0A%0A    @Override%0A    public ValidationResponse validate(final Integer object) %7B%0A%0A        if (object %3C min) %7B%0A            return new ValidationResponse(%22Must be at least %22 + min);%0A        %7D else if (object %3E max) %7B%0A            return new ValidationResponse(%22Must be at most %22 + max);%0A        %7D else %7B%0A            return new ValidationResponse();%0A        %7D%0A    %7D%0A%0A%7D%0A

Add integer validator.