org.springframework.messaging.converter

## Class JsonbMessageConverter

- java.lang.Object
- - org.springframework.messaging.converter.AbstractMessageConverter
  - - org.springframework.messaging.converter.AbstractJsonMessageConverter
    - - org.springframework.messaging.converter.JsonbMessageConverter

- All Implemented Interfaces:
    MessageConverter, SmartMessageConverter

      public class JsonbMessageConverter
      extends AbstractJsonMessageConverter

  Implementation of `MessageConverter` that can read and write JSON using the JSON Binding API.
  Since:
    5.3
  Author:
    Juergen Hoeller
  See Also:
    `Jsonb`, `JsonbBuilder`, `setJsonb(javax.json.bind.Jsonb)`

- - ### Field Summary

    - ### Fields inherited from class org.springframework.messaging.converter.AbstractMessageConverter

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonbMessageConverter()` Construct a new `JsonbMessageConverter` with default configuration.
    `JsonbMessageConverter(javax.json.bind.Jsonb jsonb)` Construct a new `JsonbMessageConverter` with the given delegate.
    `JsonbMessageConverter(javax.json.bind.JsonbConfig config)` Construct a new `JsonbMessageConverter` with the given configuration.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `fromJson(Reader reader, Type resolvedType)`
    `protected Object` | `fromJson(String payload, Type resolvedType)`
    `javax.json.bind.Jsonb` | `getJsonb()` Return the configured `Jsonb` instance for this converter.
    `void` | `setJsonb(javax.json.bind.Jsonb jsonb)` Set the `Jsonb` instance to use.
    `protected String` | `toJson(Object payload, Type resolvedType)`
    `protected void` | `toJson(Object payload, Type resolvedType, Writer writer)`

    - ### Methods inherited from class org.springframework.messaging.converter.AbstractJsonMessageConverter

      `convertFromInternal, convertToInternal, supports`

    - ### Methods inherited from class org.springframework.messaging.converter.AbstractMessageConverter

      `addSupportedMimeTypes, canConvertFrom, canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JsonbMessageConverter

          public JsonbMessageConverter()

      Construct a new `JsonbMessageConverter` with default configuration.

    - #### JsonbMessageConverter

          public JsonbMessageConverter(javax.json.bind.JsonbConfig config)

      Construct a new `JsonbMessageConverter` with the given configuration.
      Parameters:
        `config` - the `JsonbConfig` for the underlying delegate

    - #### JsonbMessageConverter

          public JsonbMessageConverter(javax.json.bind.Jsonb jsonb)

      Construct a new `JsonbMessageConverter` with the given delegate.
      Parameters:
        `jsonb` - the Jsonb instance to use

  - ### Method Detail

    - #### setJsonb

          public void setJsonb(javax.json.bind.Jsonb jsonb)

      Set the `Jsonb` instance to use. If not set, a default `Jsonb` instance will be created.

      Setting a custom-configured `Jsonb` is one way to take further control of the JSON serialization process.

      See Also:
        `JsonbMessageConverter(Jsonb)`, `JsonbMessageConverter(JsonbConfig)`, `JsonbBuilder`

    - #### getJsonb

          public javax.json.bind.Jsonb getJsonb()

      Return the configured `Jsonb` instance for this converter.

    - #### fromJson

          protected Object fromJson(Reader reader,
                                    Type resolvedType)

      Specified by:
        `fromJson` in class `AbstractJsonMessageConverter`

    - #### fromJson

          protected Object fromJson(String payload,
                                    Type resolvedType)

      Specified by:
        `fromJson` in class `AbstractJsonMessageConverter`

    - #### toJson

          protected void toJson(Object payload,
                                Type resolvedType,
                                Writer writer)

      Specified by:
        `toJson` in class `AbstractJsonMessageConverter`

    - #### toJson

          protected String toJson(Object payload,
                                  Type resolvedType)

      Specified by:
        `toJson` in class `AbstractJsonMessageConverter`