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
A
RequestBodyAdvice implementation that adds a "contextClass" hint for Optional,
HttpEntity and ServerSentEvent container types.- Since:
- 7.0.3
- Author:
- Sebastien Deleuze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetermineReadHints(MethodParameter parameter, Type targetType, Class<? extends SmartHttpMessageConverter<?>> converterType) Invoked to determine read hints if the converter is aSmartHttpMessageConverter.booleansupports(MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) Invoked first to determine if this interceptor applies.Methods inherited from class RequestBodyAdviceAdapter
afterBodyRead, beforeBodyRead, handleEmptyBody
-
Constructor Details
-
ContextClassRequestBodyAdvice
public ContextClassRequestBodyAdvice()
-
-
Method Details
-
supports
public boolean supports(MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) Description copied from interface:RequestBodyAdviceInvoked first to determine if this interceptor applies.- Parameters:
parameter- the method parametertargetType- the target type, not necessarily the same as the method parameter type, for example, forHttpEntity<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:RequestBodyAdviceInvoked to determine read hints if the converter is aSmartHttpMessageConverter.- Parameters:
parameter- the target method parametertargetType- the target type, not necessarily the same as the method parameter type, for example, forHttpEntity<String>.converterType- the selected converter type- Returns:
- the hints determined otherwise
null
-