Class ContextClassRequestBodyAdvice

java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
org.springframework.web.servlet.mvc.method.annotation.ContextClassRequestBodyAdvice
All Implemented Interfaces:
RequestBodyAdvice

public class ContextClassRequestBodyAdvice extends RequestBodyAdviceAdapter
A RequestBodyAdvice implementation that adds a "contextClass" hint for Optional, HttpEntity and ServerSentEvent container types.
Since:
7.0.3
Author:
Sebastien Deleuze
  • Constructor Details

    • ContextClassRequestBodyAdvice

      public ContextClassRequestBodyAdvice()
  • Method Details

    • supports

      public boolean supports(MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
      Description copied from interface: RequestBodyAdvice
      Invoked first to determine if this interceptor applies.
      Parameters:
      parameter - the method parameter
      targetType - the target type, not necessarily the same as the method parameter type, for example, for HttpEntity<String>.
      converterType - the selected converter type
      Returns:
      whether this interceptor should be invoked or not
    • determineReadHints

      public @Nullable Map<String,Object> determineReadHints(MethodParameter parameter, Type targetType, Class<? extends SmartHttpMessageConverter<?>> converterType)
      Description copied from interface: RequestBodyAdvice
      Invoked to determine read hints if the converter is a SmartHttpMessageConverter.
      Parameters:
      parameter - the target method parameter
      targetType - the target type, not necessarily the same as the method parameter type, for example, for HttpEntity<String>.
      converterType - the selected converter type
      Returns:
      the hints determined otherwise null