クラス GsonDecoder
java.lang.ObjectSE
org.springframework.core.codec.AbstractDecoder<ObjectSE>
org.springframework.core.codec.AbstractDataBufferDecoder<ObjectSE>
org.springframework.http.codec.json.GsonDecoder
バイトストリームを JSON に読み取り、Google グソンを使用してオブジェクトに変換する
Decoder。 ノンブロッキング解析がサポートされていないため、Flux<*> ターゲット型は使用できません。そのため、このデコーダーは Mono<*> 型のみをターゲットとします。Flux<*> へのデコードを試みると、実行時に UnsupportedOperationExceptionSE がスローされます。
- 導入:
- 7.0
- 作成者:
- Brian Clozel
フィールドのサマリー
クラス AbstractDecoder から継承されたフィールド
loggerコンストラクターの概要
コンストラクターコンストラクター説明デフォルトのGsonインスタンスと"application/json"および"application/*+json"MIME 型を使用して新しいデコーダーを構築します。GsonDecoder(com.google.gson.Gson gson, MimeType... mimeTypes) 指定されたGsonインスタンスと提供された MIME 型を使用して新しいデコーダーを構築します。メソッドのサマリー
修飾子と型メソッド説明booleancanDecode(ResolvableType elementType, @Nullable MimeType mimeType) デコーダーが特定のターゲット要素型とソースストリームの MIME 型をサポートするかどうか。reactor.core.publisher.Flux<ObjectSE> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) DataBuffer入力ストリームをTの Flux にデコードします。decode(DataBuffer buffer, ResolvableType targetType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) データバッファを型 T のオブジェクトにデコードします。クラス AbstractDataBufferDecoder から継承されたメソッド
decodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySizeクラス AbstractDecoder から継承されたメソッド
getDecodableMimeTypes, getLogger, setLoggerクラス ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSEインターフェース Decoder から継承されたメソッド
getDecodableMimeTypes
コンストラクターの詳細
GsonDecoder
public GsonDecoder()デフォルトのGsonインスタンスと"application/json"および"application/*+json"MIME 型を使用して新しいデコーダーを構築します。GsonDecoder
指定されたGsonインスタンスと提供された MIME 型を使用して新しいデコーダーを構築します。- パラメーター:
gson- 使用する gson インスタンスmimeTypes- デコーダーがサポートする MIME 型
メソッドの詳細
canDecode
インターフェースからコピーされた説明:Decoderデコーダーが特定のターゲット要素型とソースストリームの MIME 型をサポートするかどうか。decode
public reactor.core.publisher.Flux<ObjectSE> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) インターフェースからコピーされた説明:DecoderDataBuffer入力ストリームをTの Flux にデコードします。- 次で指定:
- インターフェース
Decoder<ObjectSE>のdecode - オーバーライド:
- クラス
AbstractDataBufferDecoder<ObjectSE>のdecode - パラメーター:
inputStream- デコードするDataBuffer入力ストリームelementType- 出力ストリーム内の要素の予想される型。この型は、事前にDecoder.canDecode(ResolvableType, MimeType)メソッドに渡されている必要があり、trueを返している必要があります。mimeType- 入力ストリームに関連付けられた MIME 型 (オプション)hints- デコード方法に関する追加情報- 戻り値:
- デコードされた要素を含む出力ストリーム
decode
public @Nullable ObjectSE decode(DataBuffer buffer, ResolvableType targetType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) throws DecodingExceptionインターフェースからコピーされた説明:Decoderデータバッファーを型 T のオブジェクトにデコードします。これは、個別のメッセージ(またはイベント)が完全に集約された形式で個別にデコードおよび処理されるシナリオで役立ちます。- パラメーター:
buffer- デコードするDataBuffertargetType- 予想される出力型mimeType- データに関連付けられた MIME 型hints- デコード方法に関する追加情報- 戻り値:
- デコードされた値、おそらく
null - 例外:
DecodingException