public class JsonViewRequestBodyAdvice extends RequestBodyAdviceAdapter
@HttpEntity
または @RequestBody
メソッドパラメーターで宣言された Jackson の @JsonView
アノテーションのサポートを追加する RequestBodyAdvice
実装。 アノテーションで指定された逆直列化ビューは MappingJackson2HttpMessageConverter
に渡され、MappingJackson2HttpMessageConverter
を使用してリクエスト本文が逆直列化されます。
@JsonView
では複数のクラスを指定できるにもかかわらず、リクエストボディアドバイスの使用は、1 つのクラス引数でのみサポートされていることに注意してください。複合インターフェースの使用を検討してください。
JsonView
, ObjectMapper.readerWithView(Class)
コンストラクターと説明 |
---|
JsonViewRequestBodyAdvice() |
修飾子と型 | メソッドと説明 |
---|---|
HttpInputMessage | beforeBodyRead(HttpInputMessage inputMessage, MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> selectedConverterType) デフォルトの実装は、渡された InputMessage を返します。 |
boolean | supports(MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType) このインターセプターが適用されるかどうかを判別するために最初に呼び出されます。 |
afterBodyRead, handleEmptyBody
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public boolean supports(MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType)
RequestBodyAdvice
methodParameter
- メソッドパラメーター targetType
- ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String>
の場合。converterType
- 選択したコンバーター型 public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> selectedConverterType) throws IOExceptionSE
RequestBodyAdviceAdapter
RequestBodyAdvice
の beforeBodyRead
RequestBodyAdviceAdapter
の beforeBodyRead
inputMessage
- リクエスト methodParameter
- ターゲットメソッドのパラメーター targetType
- ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String>
の場合。selectedConverterType
- 本体の逆直列化に使用されるコンバーター null
)IOExceptionSE