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

public class KotlinRequestBodyAdvice extends RequestBodyAdviceAdapter
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 Details

    • KotlinRequestBodyAdvice

      public KotlinRequestBodyAdvice()
  • Method Details

    • supports

      public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
      Description copied from interface: RequestBodyAdvice
      Invoked first to determine if this interceptor applies.
      Parameters:
      methodParameter - 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