クラス 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 実装。

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

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

導入:
4.2
作成者:
Sebastien Deleuze
関連事項:
  • JsonView
  • ObjectMapper.readerWithView(Class)
  • コンストラクターの詳細

    • 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
    • determineReadHints

      public @Nullable MapSE<StringSE,ObjectSE> determineReadHints(MethodParameter parameter, TypeSE targetType, ClassSE<? extends SmartHttpMessageConverter<?>> converterType)
      インターフェースからコピーされた説明: RequestBodyAdvice
      コンバーターが SmartHttpMessageConverter の場合に読み取りヒントを決定するために呼び出されます。
      パラメーター:
      parameter - ターゲットメソッドのパラメーター
      targetType - ターゲット型。必ずしもメソッドパラメーター型と同じである必要はありません (例: HttpEntity<String>)。
      converterType - 選択したコンバーター型
      戻り値:
      ヒントはそうでないと決定された null