クラス JsonViewRequestBodyAdvice

java.lang.ObjectSE
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
org.springframework.web.servlet.mvc.method.annotation.JsonViewRequestBodyAdvice
実装されたすべてのインターフェース:
RequestBodyAdvice

public class JsonViewRequestBodyAdvice extends RequestBodyAdviceAdapter
Spring MVC @HttpEntity または @RequestBody メソッドパラメーターで宣言された Jackson の @JsonView アノテーションのサポートを追加する RequestBodyAdvice 実装。

アノテーションで指定された逆直列化ビューは MappingJackson2HttpMessageConverter に渡され、MappingJackson2HttpMessageConverter を使用してリクエスト本文が逆直列化されます。

@JsonView では複数のクラスを指定できるにもかかわらず、リクエストボディアドバイスの使用は、1 つのクラス引数でのみサポートされていることに注意してください。複合インターフェースの使用を検討してください。

導入:
4.2
作成者:
Sebastien Deleuze
関連事項:
  • コンストラクターの詳細

    • JsonViewRequestBodyAdvice

      public JsonViewRequestBodyAdvice()
  • メソッドの詳細

    • supports

      public boolean supports(MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType)
      インターフェースからコピーされた説明: RequestBodyAdvice
      このインターセプターが適用されるかどうかを判別するために最初に呼び出されます。
      パラメーター:
      methodParameter - メソッドパラメーター
      targetType - ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String> の場合。
      converterType - 選択したコンバーター型
      戻り値:
      このインターセプターを呼び出すかどうか
    • beforeBodyRead

      public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> selectedConverterType) throws IOExceptionSE
      クラスからコピーされた説明: RequestBodyAdviceAdapter
      デフォルトの実装は、渡された InputMessage を返します。
      次で指定:
      インターフェース RequestBodyAdvicebeforeBodyRead 
      オーバーライド:
      クラス RequestBodyAdviceAdapterbeforeBodyRead 
      パラメーター:
      inputMessage - リクエスト
      methodParameter - ターゲットメソッドのパラメーター
      targetType - ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String> の場合。
      selectedConverterType - 本体の逆直列化に使用されるコンバーター
      戻り値:
      入力リクエストまたは新しいインスタンス (非 null)
      例外:
      IOExceptionSE