クラス RequestBodyAdviceAdapter

java.lang.ObjectSE
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
実装されたすべてのインターフェース:
RequestBodyAdvice
既知の直属サブクラス
JsonViewRequestBodyAdvice

public abstract class RequestBodyAdviceAdapter extends ObjectSE implements RequestBodyAdvice
デフォルトのメソッド実装で RequestBodyAdvice を実装するための便利な出発点。

アドバイスがいつ適用されるかに応じて true を返すには、RequestBodyAdvice.supports(org.springframework.core.MethodParameter, java.lang.reflect.Type, java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>>) を実装するためにサブクラスが必要です。

導入:
4.2
作成者:
Rossen Stoyanchev
  • コンストラクターの詳細

    • RequestBodyAdviceAdapter

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

    • beforeBodyRead

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

      public ObjectSE afterBodyRead(ObjectSE body, HttpInputMessage inputMessage, MethodParameter parameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType)
      デフォルトの実装は、渡された本体を返します。
      次で指定:
      インターフェース RequestBodyAdviceafterBodyRead 
      パラメーター:
      body - 最初のアドバイスが呼び出される前にコンバーターオブジェクトに設定されます
      inputMessage - リクエスト
      parameter - ターゲットメソッドのパラメーター
      targetType - ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String> の場合。
      converterType - 本体の逆直列化に使用されるコンバーター
      戻り値:
      同じ本体または新しいインスタンス
    • handleEmptyBody

      @Nullable public ObjectSE handleEmptyBody(@Nullable ObjectSE body, HttpInputMessage inputMessage, MethodParameter parameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType)
      デフォルトの実装は、渡された本体を返します。
      次で指定:
      インターフェース RequestBodyAdvicehandleEmptyBody 
      パラメーター:
      body - 通常、最初のアドバイスが呼び出される前に null に設定されます
      inputMessage - リクエスト
      parameter - メソッドパラメーター
      targetType - ターゲットの型。必ずしもメソッドのパラメーターの型と同じではありません。HttpEntity<String> の場合。
      converterType - 選択したコンバーター型
      戻り値:
      使用する値、または引数が必要な場合に HttpMessageNotReadableException を発生させる可能性のある null