Class ValidationHelper

java.lang.Object
org.springframework.webflow.validation.ValidationHelper

public class ValidationHelper extends Object
A helper class the encapsulates conventions to invoke validation logic.
Author:
Scott Andrews, Canny Duck, Jeremy Grelle
  • Constructor Details

    • ValidationHelper

      public ValidationHelper(Object model, RequestContext requestContext, String eventId, String modelName, ExpressionParser expressionParser, org.springframework.validation.MessageCodesResolver messageCodesResolver, MappingResults mappingResults, ValidationHintResolver hintResolver)
      Create a throwaway validation helper object. Validation is invoked by the 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)

      Parameters:
      model - the object to validate
      requestContext - the context for the request
      eventId - the event triggering validation
      modelName - the name of the model object
      expressionParser - the expression parser
      mappingResults - object mapping results
    • ValidationHelper

      public ValidationHelper(Object model, RequestContext requestContext, String eventId, String modelName, ExpressionParser expressionParser, org.springframework.validation.MessageCodesResolver messageCodesResolver, MappingResults mappingResults)
      An alternative constructor that creates an instance of BeanValidationHintResolver.
  • Method Details

    • setValidator

      public void setValidator(org.springframework.validation.Validator validator)
      Configure a Validator to apply to the model.
    • setValidationHints

      public void setValidationHints(Object[] validationHints)
      Provide validation hints (e.g. JSR-303 validation groups). Note that the constructor automatically detects validation hints specified on a view state or a transition. Therefore use of this method should not be needed.
    • validate

      public void validate()
      Invoke the validators available by convention.