Examples of CascadeValidation


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

     * @param configuration The bean validation configuration to manipulate.
     */
    public void handleAnnotation(Annotation annotation, Class clazz, PropertyDescriptor descriptor, MutableBeanValidationConfiguration configuration) {

        if (annotation instanceof Valid) {
            configuration.addCascadeValidation(new CascadeValidation(descriptor.getName()));
            return;
        }

        Class annotationClass = annotation.annotationType();
        ValidatorClass validatorClassAnnotation = (ValidatorClass)annotationClass.getAnnotation(ValidatorClass.class);
View Full Code Here

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

            logger.error("Property '" + propertyName + "' does not exist in class '" + clazz.getName() + "'");
        }

        if (propertyDefinition.hasAttribute(CASCADE_ATTR) && "true".equals(propertyDefinition.getAttribute(CASCADE_ATTR)))
        {
            CascadeValidation cascadeValidation = new CascadeValidation(propertyName);
            if (propertyDefinition.hasAttribute(CASCADE_CONDITION_ATTR)) {
                String conditionExpression = propertyDefinition.getAttribute(CASCADE_CONDITION_ATTR);
                cascadeValidation.setApplicabilityCondition(conditionExpressionParser.parse(conditionExpression));
            }
            configuration.addCascadeValidation(cascadeValidation);
        }

        NodeList nodes = propertyDefinition.getChildNodes();
View Full Code Here

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

        // after all the validation rules where applied, checking what properties of the object require their own
        // validation and recursively calling this method on them.
        CascadeValidation[] cascadeValidations = configuration.getCascadeValidations();
        BeanWrapper wrapper = wrapBean(obj);
        for (int i = 0; i < cascadeValidations.length; i++) {
            CascadeValidation cascadeValidation = cascadeValidations[i];
            Condition applicabilityCondition = cascadeValidation.getApplicabilityCondition();

            if (!applicabilityCondition.check(obj)) {
                continue;
            }

            String propertyName = cascadeValidation.getPropertyName();
            Class propertyType = wrapper.getPropertyType(propertyName);
            Object propertyValue = wrapper.getPropertyValue(propertyName);

            // if the property value is not there nothing to validate.
            if (propertyValue == null) {
View Full Code Here

Examples of org.springmodules.validation.bean.conf.loader.annotation.handler.CascadeValidation

    public String convertToValang(String fieldName, Annotation a, MessageSourceAccessor messages) {
        throw new UnsupportedOperationException("this class only does delegate annotation work");
    }

    public Annotation[] getDelegateAnnotations(Object commandObj, String fieldName, Annotation a) {
        CascadeValidation annotation = (CascadeValidation) a;

        Class clazz = commandObj.getClass();
        Field[] declaredFields = clazz.getDeclaredFields();
        //TODO ?
        return null;// annotation.value(); // all sub-annotations
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.