public class DefaultValidationProvider extends Object implements ValidationProvider
ValidationProvider implementation.| Constructor and Description |
|---|
DefaultValidationProvider()
Creates a new
DefaultValidationProvider using the MessageInterpolator returned from
ValidatorFactory.getMessageInterpolator(). |
DefaultValidationProvider(javax.validation.MessageInterpolator messageInterpolator,
org.springframework.context.MessageSource messageSource,
Locale locale)
Creates a new
DefaultValidationProvider. |
DefaultValidationProvider(javax.validation.MessageInterpolator messageInterpolator,
org.springframework.context.MessageSource messageSource,
Locale locale,
boolean contraintsAsRule)
Creates a new
DefaultValidationProvider. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMessage(FieldDef field,
ValidationRule validationRule,
String messageTemplate,
String messageText) |
void |
addValidationMetaData(MetaData metaData,
ClassLoader classLoader,
Class<?>... groups)
Based on the JSR-303 annotations of the
MetaData's bindclass, this method adds the Validation to
the FieldDefinitions. |
protected Rule |
getRule(Annotation annotation,
String type) |
void |
validateBean(Object bean,
FieldProcessor fp,
Class<?>... groups)
Validates the given bean by adding error-messages to the
FieldDef initions, using
FieldProcessor.addErrorMessage(FieldDef, String). |
void |
validateBean(Object bean,
FieldProcessor fp,
String[] excludeBindings,
Class<?>... groups)
Validates the given bean by adding error-messages to the
FieldDef initions, using
FieldProcessor.addErrorMessage(FieldDef, String). |
void |
validateField(Object bean,
FieldProcessor fp,
String fieldBinding,
Class<?>... groups)
Validates a single
FieldDef by adding error-messages to it, using
FieldProcessor.addErrorMessage(FieldDef, String). |
public DefaultValidationProvider(javax.validation.MessageInterpolator messageInterpolator,
org.springframework.context.MessageSource messageSource,
Locale locale)
DefaultValidationProvider.messageInterpolator - the MessageInterpolator used when adding validation messagesmessageSource - the MessageSource used when adding validation messageslocale - the Locale used when adding validation messagespublic DefaultValidationProvider(javax.validation.MessageInterpolator messageInterpolator,
org.springframework.context.MessageSource messageSource,
Locale locale,
boolean contraintsAsRule)
DefaultValidationProvider.messageInterpolator - the MessageInterpolator used when adding validation messagesmessageSource - the MessageSource used when adding validation messageslocale - the Locale used when adding validation messagescontraintsAsRule - whether validation constraints should be added as a Rule to the
FieldDefs Validationpublic DefaultValidationProvider()
DefaultValidationProvider using the MessageInterpolator returned from
ValidatorFactory.getMessageInterpolator().public void addValidationMetaData(MetaData metaData, ClassLoader classLoader, Class<?>... groups) throws ClassNotFoundException
ValidationProviderMetaData's bindclass, this method adds the Validation to
the FieldDefinitions.addValidationMetaData in interface ValidationProvidermetaData - the MetaData to add the Validations toclassLoader - the ClassLoader to load the MetaDatas bindClassgroups - the JSR-303 validation groups to useClassNotFoundException - if the bindClass can not be loadedMin,
Max,
Size,
Digits,
NotNull,
Future,
Past,
Type,
Pattern,
FileUploadprotected Rule getRule(Annotation annotation, String type)
protected void addMessage(FieldDef field, ValidationRule validationRule, String messageTemplate, String messageText)
public void validateBean(Object bean, FieldProcessor fp, Class<?>... groups)
ValidationProviderFieldDef initions, using
FieldProcessor.addErrorMessage(FieldDef, String).validateBean in interface ValidationProviderbean - the bean to validatefp - the FieldProcessor containing the MetaData for the beangroups - the JSR-303 validation groups to useFieldProcessor.addErrorMessage(FieldDef, String)public void validateBean(Object bean, FieldProcessor fp, String[] excludeBindings, Class<?>... groups)
ValidationProviderFieldDef initions, using
FieldProcessor.addErrorMessage(FieldDef, String).validateBean in interface ValidationProviderbean - the bean to validatefp - the FieldProcessor containing the MetaData for the beanexcludeBindings - an array of field-bindings to ignore during validationgroups - the JSR-303 validation groups to useFieldProcessor.addErrorMessage(FieldDef, String)public void validateField(Object bean, FieldProcessor fp, String fieldBinding, Class<?>... groups)
ValidationProviderFieldDef by adding error-messages to it, using
FieldProcessor.addErrorMessage(FieldDef, String).validateField in interface ValidationProviderbean - the bean to validatefp - the FieldProcessor containing the MetaData for the beanfieldBinding - the binding of the FieldDef to validategroups - the JSR-303 validation groups to useFieldProcessor.addErrorMessage(FieldDef, String)Copyright © 2011–2021 aiticon GmbH. All rights reserved.