类 JsonViewRequestBodyAdvice
java.lang.Object
cn.taketoday.web.handler.method.JsonViewRequestBodyAdvice
- 所有已实现的接口:
RequestBodyAdvice
A
RequestBodyAdvice implementation that adds support for Jackson's
@JsonView annotation declared on MVC @HttpEntity or
@RequestBody method parameter.
The deserialization view specified in the annotation will be passed in to the
MappingJackson2HttpMessageConverter
which will then use it to deserialize the request body with.
Note that despite @JsonView allowing for more than one class to
be specified, the use for a request body advice is only supported with
exactly one class argument. Consider the use of a composite interface.
- 从以下版本开始:
- 4.0 2022/2/11 21:08
- 作者:
- Sebastien Deleuze, Harry Yang
- 另请参阅:
-
JsonViewObjectMapper.readerWithView(Class)
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明beforeBodyRead(HttpInputMessage request, cn.taketoday.core.MethodParameter methodParameter, Type targetType, HttpMessageConverter<?> selectedConverterType) Invoked second before the request body is read and converted.booleansupports(cn.taketoday.core.MethodParameter methodParameter, Type targetType, HttpMessageConverter<?> converter) Invoked first to determine if this interceptor applies.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.web.handler.method.RequestBodyAdvice
afterBodyRead, handleEmptyBody
-
构造器详细资料
-
JsonViewRequestBodyAdvice
public JsonViewRequestBodyAdvice()
-
-
方法详细资料
-
supports
public boolean supports(cn.taketoday.core.MethodParameter methodParameter, Type targetType, HttpMessageConverter<?> converter) 从接口复制的说明:RequestBodyAdviceInvoked first to determine if this interceptor applies.- 指定者:
supports在接口中RequestBodyAdvice- 参数:
methodParameter- the method parametertargetType- the target type, not necessarily the same as the method parameter type, e.g. forHttpEntity<String>.converter- the selected converter- 返回:
- whether this interceptor should be invoked or not
-
beforeBodyRead
public HttpInputMessage beforeBodyRead(HttpInputMessage request, cn.taketoday.core.MethodParameter methodParameter, Type targetType, HttpMessageConverter<?> selectedConverterType) throws IOException 从接口复制的说明:RequestBodyAdviceInvoked second before the request body is read and converted.- 指定者:
beforeBodyRead在接口中RequestBodyAdvice- 参数:
request- the requestmethodParameter- the target method parametertargetType- the target type, not necessarily the same as the method parameter type, e.g. forHttpEntity<String>.selectedConverterType- the converter used to deserialize the body- 返回:
- the input request or a new instance (never
null) - 抛出:
IOException
-