|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springmodules.validation.bean.conf.loader.xml.AbstractResourceBasedBeanValidationConfigurationLoader org.springmodules.validation.bean.conf.loader.xml.AbstractXmlBeanValidationConfigurationLoader org.springmodules.validation.bean.conf.loader.xml.DefaultXmlBeanValidationConfigurationLoader
public class DefaultXmlBeanValidationConfigurationLoader
The default xml bean validation configuration loader. This loader expects the following xml format:
<validation [package="org.springmodules.validation.sample"]> <class name="Person"> <global> <any/>... </global> <property name="firstName" [valid="true|false"]> <any/>... </property> </class> </validation>Please note the following:
DEFAULT_NAMESPACE_URL
.
DefaultValidationRuleElementHandlerRegistry
.
Field Summary | |
---|---|
static String |
DEFAULT_NAMESPACE_URL
|
Constructor Summary | |
---|---|
DefaultXmlBeanValidationConfigurationLoader()
Constructs a new DefaultXmlBeanValidationConfigurationLoader with the default validation rule element handler registry. |
|
DefaultXmlBeanValidationConfigurationLoader(ValidationRuleElementHandlerRegistry handlerRegistry)
Constructs a new DefaultXmlBeanValidationConfigurationLoader with the given validation rule element handler registry. |
|
DefaultXmlBeanValidationConfigurationLoader(ValidationRuleElementHandlerRegistry handlerRegistry,
ConditionExpressionParser conditionExpressionParser,
FunctionExpressionParser functionExpressionParser)
Constructs a new DefaultXmlBeanValidationConfigurationLoader with the given validation rule element handler registry. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected ErrorArgumentsResolver |
buildErrorArgumentsResolver(String argsString)
|
protected Validator |
constructValidator(String className)
|
protected ValidationMethodValidationRule |
createMethodValidationRule(Class clazz,
String methodName,
String errorCode,
String message,
String argsString,
String contextsString,
String applyIfString)
|
protected PropertyValidationRule |
createPropertyRule(String propertyName,
ValidationRule rule)
|
protected void |
findConditionExpressionParserInApplicationContext()
|
protected void |
findFunctionExpressionParserInApplicationContext()
|
ValidationRuleElementHandlerRegistry |
getElementHandlerRegistry()
Returns the element handler registry used by this loader. |
BeanValidationConfiguration |
handleClassDefinition(Class clazz,
Element element)
Creates and builds a bean validation configuration based for the given class, based on the given <class> element. |
protected void |
handleGlobalDefinition(Element globalDefinition,
Class clazz,
MutableBeanValidationConfiguration configuration)
Handles the <global> element and updates the given configuration with the global validation rules. |
protected void |
handleMethodDefinition(Element methodDefinition,
Class clazz,
MutableBeanValidationConfiguration configuration)
|
protected void |
handlePropertyDefinition(Element propertyDefinition,
Class clazz,
MutableBeanValidationConfiguration configuration)
Handles the given <property> element and updates the given bean validation configuration with the property validation rules. |
protected void |
handleValidatorBeanDefinition(Element definition,
Class clazz,
MutableBeanValidationConfiguration configuration)
|
protected void |
handleValidatorDefinition(Element validatorDefinition,
Class clazz,
MutableBeanValidationConfiguration configuration)
|
protected void |
initContext(Object object)
|
protected Map |
loadConfigurations(Document document,
String resourceName)
Loads the validation configuration from the given document that was created from the given resource. |
void |
setApplicationContext(ApplicationContext applicationContext)
|
void |
setConditionExpressionParser(ConditionExpressionParser conditionExpressionParser)
Sets the condition expression parser to be used when parsing the condition expression. |
void |
setElementHandlerRegistry(ValidationRuleElementHandlerRegistry registry)
Sets the element handler registry this loader will use to fetch the handlers while loading validation configuration. |
void |
setFunctionExpressionParser(FunctionExpressionParser functionExpressionParser)
Sets the function expression parser to be used when parsing the function expressions. |
protected void |
validatePropertyExists(Class clazz,
String property)
|
Methods inherited from class org.springmodules.validation.bean.conf.loader.xml.AbstractXmlBeanValidationConfigurationLoader |
---|
loadConfigurations |
Methods inherited from class org.springmodules.validation.bean.conf.loader.xml.AbstractResourceBasedBeanValidationConfigurationLoader |
---|
createDefaultConfigurationFileName, getResource, getResources, loadConfiguration, loadDefaultConfiguration, setResource, setResources, supports |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_NAMESPACE_URL
Constructor Detail |
---|
public DefaultXmlBeanValidationConfigurationLoader()
public DefaultXmlBeanValidationConfigurationLoader(ValidationRuleElementHandlerRegistry handlerRegistry)
handlerRegistry
- The validation rule element handler registry that will be used by this loader.public DefaultXmlBeanValidationConfigurationLoader(ValidationRuleElementHandlerRegistry handlerRegistry, ConditionExpressionParser conditionExpressionParser, FunctionExpressionParser functionExpressionParser)
handlerRegistry
- The validation rule element handler registry that will be used by this loader.conditionExpressionParser
- The condition parser this loader should use to parse the cascade validation conditions.functionExpressionParser
- The function parser this loader should use to parse the error arguments.Method Detail |
---|
protected Map loadConfigurations(Document document, String resourceName)
loadConfigurations
in class AbstractXmlBeanValidationConfigurationLoader
AbstractXmlBeanValidationConfigurationLoader.loadConfigurations(org.w3c.dom.Document, String)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractResourceBasedBeanValidationConfigurationLoader
Exception
InitializingBean.afterPropertiesSet()
public void setElementHandlerRegistry(ValidationRuleElementHandlerRegistry registry)
registry
- The element handler registry to be used by this loader.public ValidationRuleElementHandlerRegistry getElementHandlerRegistry()
public void setConditionExpressionParser(ConditionExpressionParser conditionExpressionParser)
ConditionExpressionBased
setConditionExpressionParser
in interface ConditionExpressionBased
conditionExpressionParser
- The condition expression parser to be used.ConditionExpressionBased.setConditionExpressionParser(org.springmodules.validation.util.cel.ConditionExpressionParser)
public void setFunctionExpressionParser(FunctionExpressionParser functionExpressionParser)
FunctionExpressionBased
setFunctionExpressionParser
in interface FunctionExpressionBased
functionExpressionParser
- The function expression parser to be used.FunctionExpressionBased.setFunctionExpressionParser(org.springmodules.validation.util.fel.FunctionExpressionParser)
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext
in interface ApplicationContextAware
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
protected void initContext(Object object) throws Exception
Exception
public BeanValidationConfiguration handleClassDefinition(Class clazz, Element element)
element
- The <class> element.clazz
- The class for which the validation configuration is being loaded.
protected void handleValidatorDefinition(Element validatorDefinition, Class clazz, MutableBeanValidationConfiguration configuration)
protected void handleValidatorBeanDefinition(Element definition, Class clazz, MutableBeanValidationConfiguration configuration)
protected void handleGlobalDefinition(Element globalDefinition, Class clazz, MutableBeanValidationConfiguration configuration)
globalDefinition
- The <global> element.clazz
- The validated class.configuration
- The bean validation configuration to update.protected void handleMethodDefinition(Element methodDefinition, Class clazz, MutableBeanValidationConfiguration configuration)
protected ValidationMethodValidationRule createMethodValidationRule(Class clazz, String methodName, String errorCode, String message, String argsString, String contextsString, String applyIfString)
protected ErrorArgumentsResolver buildErrorArgumentsResolver(String argsString)
protected void handlePropertyDefinition(Element propertyDefinition, Class clazz, MutableBeanValidationConfiguration configuration)
propertyDefinition
- The <property> element.clazz
- The validated class.configuration
- The bean validation configuration to update.protected PropertyValidationRule createPropertyRule(String propertyName, ValidationRule rule)
protected Validator constructValidator(String className)
protected void findConditionExpressionParserInApplicationContext()
protected void findFunctionExpressionParserInApplicationContext()
protected void validatePropertyExists(Class clazz, String property)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |