Package org.springmodules.validation.bean.conf

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


    }

    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

            Element ruleDefinition = (Element) node;
            ClassValidationElementHandler handler = handlerRegistry.findClassHandler(ruleDefinition, clazz);
            if (handler == null) {
                logger.error("Could not handle element '" + ruleDefinition.getTagName() +
                    "'. Please make sure the proper validation rule definition handler is registered");
                throw new ValidationConfigurationException("Could not handler element '" + ruleDefinition.getTagName() + "'");
            }
            handler.handle(ruleDefinition, configuration);
        }
    }
View Full Code Here

    protected void handleMethodDefinition(Element methodDefinition, Class clazz, MutableBeanValidationConfiguration configuration) {
        String methodName = methodDefinition.getAttribute(NAME_ATTR);
        if (!StringUtils.hasText(methodName)) {
            logger.error("Could not parse method element. Missing or empty 'name' attribute");
            throw new ValidationConfigurationException("Could not parse method element. Missing 'name' attribute");
        }

        String errorCode = methodDefinition.getAttribute(CODE_ATTR);
        String message = methodDefinition.getAttribute(MESSAGE_ATTR);
        String argsString = methodDefinition.getAttribute(ARGS_ATTR);
View Full Code Here

        String contextsString,
        String applyIfString) {

        Method method = ReflectionUtils.findMethod(clazz, methodName);
        if (method == null) {
            throw new ValidationConfigurationException("Method named '" + methodName +
                "' was not found in class hierarchy of '" + clazz.getName() + "'.");
        }

        if (!StringUtils.hasText(errorCode)) {
            errorCode = methodName + "()";
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.