Package org.springframework.web.bind

Examples of org.springframework.web.bind.WebDataBinder.validate()


          Annotation[] annotations = parameter.getParameterAnnotations();
          for (Annotation annot : annotations) {
            if (annot.annotationType().getSimpleName().startsWith("Valid")) {
              WebDataBinder binder = binderFactory.createBinder(request, arg, partName);
              Object hints = AnnotationUtils.getValue(annot);
              binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
              BindingResult bindingResult = binder.getBindingResult();
              if (bindingResult.hasErrors()) {
                throw new MethodArgumentNotValidException(parameter, bindingResult);
              }
            }
View Full Code Here


    for (Annotation annot : annotations) {
      if (annot.annotationType().getSimpleName().startsWith("Valid")) {
        String name = Conventions.getVariableNameForParameter(parameter);
        WebDataBinder binder = binderFactory.createBinder(webRequest, arg, name);
        Object hints = AnnotationUtils.getValue(annot);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          throw new MethodArgumentNotValidException(parameter, bindingResult);
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.