All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springmodules.validation.bean.conf.BeanValidationConfiguration Maven / Gradle / Ivy

/*
 * Copyright 2004-2005 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springmodules.validation.bean.conf;

import org.springframework.validation.Validator;
import org.springmodules.validation.bean.rule.ValidationRule;

/**
 * Holds the various validatoin rules of a bean. This configuration is made out of the following configuration rules:
 * 
    *
  • * Global Rules - Rules that are associated with the bean itself. Validation error of this rule will * be associated with the bean as well (see {@link org.springframework.validation.Errors#getGlobalError()}). *
  • *
  • * Property Rules - Rules that are associated with a specific property of the bean. Validation error * of this rule will be associated with the property as well * (see {@link org.springframework.validation.Errors#getFieldError(String)}). Note that the condition of these * rules however sould still be applied on the bean itself. *
  • *
  • * Custom Validator - This is not a validation rule per se, but a custom validator that can be * associated with the bean. This enables associating already exsiting or perhaps very complex validators with * the bean. *
  • *
  • * Required Validatable Properties - These are all the bean properties that need to be valid on their * own in order for the bean itself to be valid. A simple example can be a collection property, where in order * for the bean to be valid, all elements in the collection need to be valid as well. *
  • *
* * @author Uri Boness */ public interface BeanValidationConfiguration { /** * Returns the global validation rules for the bean. This method never returns null. If no global rule * is defined, an empty array is returned. * * @return The global validation rules for the bean. */ ValidationRule[] getGlobalRules(); /** * Returns the property validation rules for the bean that are associated with the given property name. This method * never returns null. If no rule is associated with the given property, an empty array is returned. * * @param propertyName The name of the bean property. * @return The property validation rules for the bean. */ ValidationRule[] getPropertyRules(String propertyName); /** * Returns a list of all properties that are associated with validation rules. * * @return A list of all properties that are associated with validation rules. */ String[] getValidatedProperties(); /** * Returns the custom validator associated with this configuration, null if no custom validator * is associated. * * @return The customer validator associated with this configuration. */ Validator getCustomValidator(); /** * Returns the configured cascade validations. * * @return The configured cascade validations. */ CascadeValidation[] getCascadeValidations(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy