Class GsonDecoder

All Implemented Interfaces:
Decoder<Object>

public class GsonDecoder extends AbstractDataBufferDecoder<Object>
Decoder that reads a byte stream into JSON and converts it to Objects with Google Gson.

Flux<*> target types are not available because non-blocking parsing is not supported, so this decoder targets only Mono<*> types. Attempting to decode to a Flux<*> will result in a UnsupportedOperationException being thrown at runtime.

Since:
7.0
Author:
Brian Clozel
  • Constructor Details

    • GsonDecoder

      public GsonDecoder()
      Construct a new decoder using a default Gson instance and the "application/json" and "application/*+json" MIME types.
    • GsonDecoder

      public GsonDecoder(com.google.gson.Gson gson, MimeType... mimeTypes)
      Construct a new decoder using the given Gson instance and the provided MIME types.
      Parameters:
      gson - the gson instance to use
      mimeTypes - the mime types the decoder should support
  • Method Details