クラス JsonViewRequestBodyAdvice
java.lang.ObjectSE
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
org.springframework.web.servlet.mvc.method.annotation.JsonViewRequestBodyAdvice
- 実装済みのインターフェース一覧:
RequestBodyAdvice
Spring MVC
@HttpEntity または @RequestBody メソッドパラメーターで宣言された Jackson の @JsonView アノテーションのサポートを追加する RequestBodyAdvice 実装。アノテーションで指定された逆直列化ビューは Jackson コンバーターに渡され、それを使用してリクエスト本体が逆直列化されます。
@JsonView では複数のクラスを指定できるにもかかわらず、リクエストボディアドバイスの使用は、1 つのクラス引数でのみサポートされていることに注意してください。複合インターフェースの使用を検討してください。
- 導入:
- 4.2
- 作成者:
- Sebastien Deleuze
- 関連事項:
コンストラクター概要
コンストラクター方法の概要
修飾子と型メソッド説明beforeBodyRead(HttpInputMessage inputMessage, MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> selectedConverterType) デフォルトの実装は、渡された InputMessage を返します。determineReadHints(MethodParameter parameter, TypeSE targetType, ClassSE<? extends SmartHttpMessageConverter<?>> converterType) コンバーターがSmartHttpMessageConverterの場合に読み取りヒントを決定するために呼び出されます。booleansupports(MethodParameter methodParameter, TypeSE targetType, ClassSE<? extends HttpMessageConverter<?>> converterType) このインターセプターが適用されるかどうかを判別するために最初に呼び出されます。クラス RequestBodyAdviceAdapter から継承されたメソッド
afterBodyRead, handleEmptyBody
コンストラクターの詳細
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 を返します。- 次で指定:
- インターフェース
RequestBodyAdviceのbeforeBodyRead - オーバーライド:
- クラス
RequestBodyAdviceAdapterのbeforeBodyRead - パラメーター:
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