org.springmodules.validation.bean.conf
Class DefaultBeanValidationConfiguration

java.lang.Object
  extended by org.springmodules.validation.bean.conf.DefaultBeanValidationConfiguration
All Implemented Interfaces:
BeanValidationConfiguration, MutableBeanValidationConfiguration

public class DefaultBeanValidationConfiguration
extends Object
implements MutableBeanValidationConfiguration

A default implementation of BeanValidationConfiguration.

Author:
Uri Boness

Constructor Summary
DefaultBeanValidationConfiguration()
          Constructs a new DefaultBeanValidationConfiguration with no rules, validatable properties, or custom validator.
 
Method Summary
 void addCascadeValidation(CascadeValidation cascadeValidation)
          Adds the given cascade validation to this configuration.
 void addCascadeValidations(CascadeValidation[] cascadeValidations)
          Adds the given cascade validations to this configuration.
 void addCustomValidator(Validator validator)
          Adds the given validator to the custom validator of this configuration.
 void addCustomValidators(Validator[] validators)
          Adds the given validators to the custom validator of this configuration.
 void addGlobalRule(ValidationRule globalRule)
          Adds the given rule as global rules for this configuration.
 void addGlobalRules(ValidationRule[] globalRules)
          Adds the given rules as global rules for this configuration.
 void addPropertyRule(String propertyName, ValidationRule rule)
          Adds the given validation rule to the given property.
 void addPropertyRules(String propertyName, ValidationRule[] extraRules)
          Adds the given validation rules to the given property.
 CascadeValidation[] getCascadeValidations()
          Returns the configured cascade validations.
 Validator getCustomValidator()
          Returns the custom validator associated with this configuration, null if no custom validator is associated.
 ValidationRule[] getGlobalRules()
          Returns the global validation rules for the bean.
 ValidationRule[] getPropertyRules(String propertyName)
          Returns the property validation rules for the bean that are associated with the given property name.
 String[] getValidatedProperties()
          Returns a list of all properties that are associated with validation rules.
 void setCascadeValidations(CascadeValidation[] cascadeValidations)
          Sets the cascade validations of this configuration.
 void setCustomValidator(Validator validator)
          Sets the custom validator for this configuration.
 void setCustomValidators(Validator[] validators)
          Sets the custom validator for this configuration.
 void setGlobalRules(ValidationRule[] globalRules)
          Sets the global rules for this configuration.
 void setPropertyRules(String propertyName, ValidationRule[] rules)
          Sets the property validation rules for the given property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBeanValidationConfiguration

public DefaultBeanValidationConfiguration()
Constructs a new DefaultBeanValidationConfiguration with no rules, validatable properties, or custom validator.

Method Detail

getGlobalRules

public ValidationRule[] getGlobalRules()
Description copied from 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.

Specified by:
getGlobalRules in interface BeanValidationConfiguration
Returns:
The global validation rules for the bean.
See Also:
BeanValidationConfiguration.getGlobalRules()

setGlobalRules

public void setGlobalRules(ValidationRule[] globalRules)
Sets the global rules for this configuration.

Specified by:
setGlobalRules in interface MutableBeanValidationConfiguration
Parameters:
globalRules - The global rules for this configuration

addGlobalRule

public void addGlobalRule(ValidationRule globalRule)
Adds the given rule as global rules for this configuration.

Specified by:
addGlobalRule in interface MutableBeanValidationConfiguration
Parameters:
globalRule - The rule to be added as global rules for this configuration.

addGlobalRules

public void addGlobalRules(ValidationRule[] globalRules)
Adds the given rules as global rules for this configuration.

Specified by:
addGlobalRules in interface MutableBeanValidationConfiguration
Parameters:
globalRules - The rules to be added as global rules for this configuration.

getPropertyRules

public ValidationRule[] getPropertyRules(String propertyName)
Description copied from interface: BeanValidationConfiguration
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.

Specified by:
getPropertyRules in interface BeanValidationConfiguration
Parameters:
propertyName - The name of the bean property.
Returns:
The property validation rules for the bean.
See Also:
BeanValidationConfiguration.getPropertyRules(String).

getValidatedProperties

public String[] getValidatedProperties()
Description copied from interface: BeanValidationConfiguration
Returns a list of all properties that are associated with validation rules.

Specified by:
getValidatedProperties in interface BeanValidationConfiguration
Returns:
A list of all properties that are associated with validation rules.
See Also:
BeanValidationConfiguration.getValidatedProperties()

setPropertyRules

public void setPropertyRules(String propertyName,
                             ValidationRule[] rules)
Sets the property validation rules for the given property.

Specified by:
setPropertyRules in interface MutableBeanValidationConfiguration
Parameters:
propertyName - The name of the property.
rules - The validation rules for the given property.

addPropertyRule

public void addPropertyRule(String propertyName,
                            ValidationRule rule)
Adds the given validation rule to the given property.

Specified by:
addPropertyRule in interface MutableBeanValidationConfiguration
Parameters:
propertyName - The name of the property.
rule - The validation rule to be added to the given property.

addPropertyRules

public void addPropertyRules(String propertyName,
                             ValidationRule[] extraRules)
Adds the given validation rules to the given property.

Specified by:
addPropertyRules in interface MutableBeanValidationConfiguration
Parameters:
propertyName - The name of the property.
extraRules - The extra validation rules that will be added to the given property.

getCustomValidator

public Validator getCustomValidator()
Description copied from interface: BeanValidationConfiguration
Returns the custom validator associated with this configuration, null if no custom validator is associated.

Specified by:
getCustomValidator in interface BeanValidationConfiguration
Returns:
The customer validator associated with this configuration.
See Also:
BeanValidationConfiguration.getCustomValidator()

getCascadeValidations

public CascadeValidation[] getCascadeValidations()
Description copied from interface: BeanValidationConfiguration
Returns the configured cascade validations.

Specified by:
getCascadeValidations in interface BeanValidationConfiguration
Returns:
The configured cascade validations.
See Also:
BeanValidationConfiguration.getCascadeValidations()

setCustomValidator

public void setCustomValidator(Validator validator)
Sets the custom validator for this configuration.

Specified by:
setCustomValidator in interface MutableBeanValidationConfiguration
Parameters:
validator - The custom validator for this configuration.

setCustomValidators

public void setCustomValidators(Validator[] validators)
Sets the custom validator for this configuration. The custom validator will be compound with the given validators.

Specified by:
setCustomValidators in interface MutableBeanValidationConfiguration
Parameters:
validators - The validators that will make the custom validator of this configuration.

addCustomValidator

public void addCustomValidator(Validator validator)
Adds the given validator to the custom validator of this configuration.

Specified by:
addCustomValidator in interface MutableBeanValidationConfiguration
Parameters:
validator - The validator to be added to the custom validator of this configuration.

addCustomValidators

public void addCustomValidators(Validator[] validators)
Adds the given validators to the custom validator of this configuration.

Specified by:
addCustomValidators in interface MutableBeanValidationConfiguration
Parameters:
validators - The validators to be added to the custom validator of this configuration.

setCascadeValidations

public void setCascadeValidations(CascadeValidation[] cascadeValidations)
Sets the cascade validations of this configuration.

param cascadeValidations The cascade validations of this configuration.

Specified by:
setCascadeValidations in interface MutableBeanValidationConfiguration

addCascadeValidation

public void addCascadeValidation(CascadeValidation cascadeValidation)
Adds the given cascade validation to this configuration.

Specified by:
addCascadeValidation in interface MutableBeanValidationConfiguration
Parameters:
cascadeValidation - The cascase validation to be added to this configuration.

addCascadeValidations

public void addCascadeValidations(CascadeValidation[] cascadeValidations)
Adds the given cascade validations to this configuration.

Specified by:
addCascadeValidations in interface MutableBeanValidationConfiguration
Parameters:
cascadeValidations - The cascade validation to be added to this configuration.


Copyright © 2009. All Rights Reserved.