Class RequestValidatorRequestBodyAdvice

java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
com.broadleafcommerce.cartoperation.web.advice.RequestValidatorRequestBodyAdvice
All Implemented Interfaces:
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice

@ControllerAdvice public class RequestValidatorRequestBodyAdvice extends org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
Applies request validator validation to request bodies marked with a Validated annotation.
Author:
Jacob Mitash
  • Constructor Details

    • RequestValidatorRequestBodyAdvice

      public RequestValidatorRequestBodyAdvice(Set<RequestValidator> requestValidators)
  • Method Details

    • supports

      public boolean supports(@NonNull org.springframework.core.MethodParameter methodParameter, @NonNull Type targetType, @NonNull Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
    • afterBodyRead

      @NonNull public Object afterBodyRead(@NonNull Object body, @NonNull org.springframework.http.HttpInputMessage inputMessage, @NonNull org.springframework.core.MethodParameter parameter, @NonNull Type targetType, @NonNull Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
      Specified by:
      afterBodyRead in interface org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
      Overrides:
      afterBodyRead in class org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
    • findCompatibleValidators

      protected Set<RequestValidator> findCompatibleValidators(Class<?> clazz)
      Finds compatible request validators for a given type.
      Parameters:
      clazz - the type to test support of
      Returns:
      the compatible validators