public class ValidationHelper
extends java.lang.Object
Constructor and Description |
---|
ValidationHelper(java.lang.Object model,
RequestContext requestContext,
java.lang.String eventId,
java.lang.String modelName,
ExpressionParser expressionParser,
org.springframework.validation.MessageCodesResolver messageCodesResolver,
MappingResults mappingResults)
An alternative constructor that creates an instance of
BeanValidationHintResolver . |
ValidationHelper(java.lang.Object model,
RequestContext requestContext,
java.lang.String eventId,
java.lang.String modelName,
ExpressionParser expressionParser,
org.springframework.validation.MessageCodesResolver messageCodesResolver,
MappingResults mappingResults,
ValidationHintResolver hintResolver)
Create a throwaway validation helper object.
|
Modifier and Type | Method and Description |
---|---|
void |
setValidationHints(java.lang.Object[] validationHints)
Provide validation hints (e.g.
|
void |
setValidator(org.springframework.validation.Validator validator)
Configure a
Validator to apply to the model. |
void |
validate()
Invoke the validators available by convention.
|
public ValidationHelper(java.lang.Object model, RequestContext requestContext, java.lang.String eventId, java.lang.String modelName, ExpressionParser expressionParser, org.springframework.validation.MessageCodesResolver messageCodesResolver, MappingResults mappingResults, ValidationHintResolver hintResolver)
validate()
method.
Validation methods invoked include a validation method on the model object or a validator bean. The method name on either object is in the form of validate[viewStateId]. A ValidationContext is passed in the method signature along with the model object for validator beans. A MessageContext can be substituted for the ValidationContext.
For example: model.validateEnterBookingDetails(VaticationContext)
or
context.getBean("modelValidator").validateEnterBookingDetails(model, VaticationContext)
model
- the object to validaterequestContext
- the context for the requesteventId
- the event triggering validationmodelName
- the name of the model objectexpressionParser
- the expression parsermappingResults
- object mapping resultspublic ValidationHelper(java.lang.Object model, RequestContext requestContext, java.lang.String eventId, java.lang.String modelName, ExpressionParser expressionParser, org.springframework.validation.MessageCodesResolver messageCodesResolver, MappingResults mappingResults)
BeanValidationHintResolver
.public void setValidator(org.springframework.validation.Validator validator)
Validator
to apply to the model.public void setValidationHints(java.lang.Object[] validationHints)
public void validate()