クラス RequestBodyAdviceAdapter

java.lang.ObjectSE
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
実装済みのインターフェース一覧:
RequestBodyAdvice
既知の直属サブクラス
ContextClassRequestBodyAdvice, JsonViewRequestBodyAdvice, KotlinRequestBodyAdvice

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

アドバイスがいつ適用されるかに応じて true を返すには、RequestBodyAdvice.supports(MethodParameter, Type, Class) を実装するためにサブクラスが必要です。

導入:
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

      public @Nullable 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