public Object validate()

in src/main/java/org/apache/commons/validator/routines/CodeValidator.java [248:280]


    public Object validate(final String input) {

        if (input == null) {
            return null;
        }

        String code = input.trim();
        if (code.isEmpty()) {
            return null;
        }

        // validate/reformat using regular expression
        if (regexValidator != null) {
            code = regexValidator.validate(code);
            if (code == null) {
                return null;
            }
        }

        // check the length (must be done after validate as that can change the code)
        if ((minLength >= 0 && code.length() < minLength) ||
            (maxLength >= 0 && code.length() > maxLength)) {
            return null;
        }

        // validate the check digit
        if (checkdigit != null && !checkdigit.isValid(code)) {
            return null;
        }

        return code;

    }