Class KotlinRequestBodyAdvice
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
org.springframework.web.servlet.mvc.method.annotation.KotlinRequestBodyAdvice
- All Implemented Interfaces:
RequestBodyAdvice
A
RequestBodyAdvice implementation that adds support for resolving
Kotlin KType from the parameter and providing it as a hint with a
"kotlin.reflect.KType" key.- Since:
- 7.0
- Author:
- Sebastien Deleuze
- See Also:
-
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 methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) Invoked first to determine if this interceptor applies.Methods inherited from class RequestBodyAdviceAdapter
afterBodyRead, beforeBodyRead, handleEmptyBody
-
Constructor Details
-
KotlinRequestBodyAdvice
public KotlinRequestBodyAdvice()
-
-
Method Details
-
supports
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) Description copied from interface:RequestBodyAdviceInvoked first to determine if this interceptor applies.- Parameters:
methodParameter- 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
-