Package org.springmodules.validation.bean.conf

Examples of org.springmodules.validation.bean.conf.ValidationConfigurationException


            if (isFunctionDefinition(child)) {
                registerFunction(child, functionByName);
            } else if (isDateParserDefinition(child)) {
                registerDateParser(child, dateParsers);
            } else {
                throw new ValidationConfigurationException("unknown element '" + child.getTagName() + "'");
            }
        }

        builder.addPropertyValue("customFunctions", functionByName);
        builder.addPropertyValue("dateParsers", dateParsers);
View Full Code Here


    protected void registerFunction(Element functionDefinition, Map functionByName) {
        String name = functionDefinition.getAttribute(NAME_ATTR);
        String className = functionDefinition.getAttribute(CLASS_ATTR);
        if (!StringUtils.hasText(name) || !StringUtils.hasText(className)) {
            throw new ValidationConfigurationException("Both '" + NAME_ATTR + "' and '" + CLASS_ATTR +
                "' attributes of element '" + FUNCTION_ELEMENT + "' are required");
        }
        functionByName.put(name, className);
    }
View Full Code Here

    protected void registerDateParser(Element dateParserDefinition, Map patternByRegexp) {
        String regexp = dateParserDefinition.getAttribute(REGEXP_ATTR);
        String pattern = dateParserDefinition.getAttribute(PATTERN_ATTR);
        if (!StringUtils.hasText(regexp) || !StringUtils.hasText(pattern)) {
            throw new ValidationConfigurationException("Both '" + REGEXP_ATTR + "' and '" +
                PATTERN_ATTR + "' attributes of element '" + DATE_PARSER_ELEMENT + "' are required");
        }
        patternByRegexp.put(regexp, pattern);
    }
View Full Code Here

    }

    protected AbstractValidationRule createValidationRule(Element element) {
        String expression = element.getAttribute(CONDITION_ATTR);
        if (!StringUtils.hasText(expression)) {
            throw new ValidationConfigurationException("Element '" + ELEMENT_NAME + "' must have a '" + CONDITION_ATTR + "' attribute");
        }
        return new ExpressionValidationRule(getConditionExpressionParser(), expression);
    }
View Full Code Here

    }

    protected AbstractValidationRule createValidationRule(Element element) {
        String expression = element.getAttribute(EXPRESSION_ATTR);
        if (!StringUtils.hasText(expression)) {
            throw new ValidationConfigurationException("Element '" + ELEMENT_NAME + "' must have an 'expression' attribute");
        }
        return new RegExpValidationRule(expression);
    }
View Full Code Here

        if (max != null) {
            return new MaxValidationRule(max);
        }

        throw new ValidationConfigurationException("Element '" + ELEMENT_NAME +
            "' must have either 'min' attribute, 'max' attribute, or both");
    }
View Full Code Here

        if (max != null) {
            return new MaxLengthValidationRule(max.intValue());
        }

        throw new ValidationConfigurationException("Element '" + ELEMENT_NAME +
            "' must have either 'min' attribute, 'max' attribute, or both");
    }
View Full Code Here

        if (max != null) {
            return new MaxSizeValidationRule(max.intValue());
        }

        throw new ValidationConfigurationException("Element '" + ELEMENT_NAME +
            "' must have either 'min' attribute, 'max' attribute, or both");

    }
View Full Code Here

    }

    protected AbstractValidationRule createValidationRule(Element element) {
        String expression = element.getAttribute(CONDITION_ATTR);
        if (!StringUtils.hasText(expression)) {
            throw new ValidationConfigurationException("Element '" + ELEMENT_NAME + "' must have a '" + CONDITION_ATTR + "' attribute");
        }
        return new ExpressionValidationRule(getConditionExpressionParser(), expression);
    }
View Full Code Here

            return true;
        }
        if (PROPERTY_SCOPE_VALUE.equals(value)) {
            return false;
        }
        throw new ValidationConfigurationException("Unknown value '" + value + "' for attribute '" + SCOPE_ATTR + "'");
    }
View Full Code Here

TOP

Related Classes of org.springmodules.validation.bean.conf.ValidationConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.