Top Description Fields Constructors Methods
org.springframework.messaging.converter

public Class JsonbMessageConverter

extends AbstractJsonMessageConverter
Class Inheritance
Imports
java.io.Reader, .Writer, java.lang.reflect.ParameterizedType, .Type, jakarta.json.bind.Jsonb, .JsonbBuilder, .JsonbConfig, org.springframework.util.Assert

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

Field Summary

Modifier and TypeField and Description
private Jsonb

Constructor Summary

AccessConstructor and Description
public
JsonbMessageConverter()

Construct a new JsonbMessageConverter with default configuration.

public
JsonbMessageConverter(JsonbConfig
the JsonbConfig for the underlying delegate
config
)

Construct a new JsonbMessageConverter with the given configuration.

public
JsonbMessageConverter(Jsonb
the Jsonb instance to use
jsonb
)

Construct a new JsonbMessageConverter with the given delegate.

Method Summary

Modifier and TypeMethod and Description
protected Object
protected Object
public Jsonb
getJsonb()

Return the configured Jsonb instance for this converter.

public void
setJsonb(Jsonb jsonb)

Set the Jsonb instance to use.

protected void
protected String
Inherited from org.springframework.messaging.converter.AbstractJsonMessageConverter:
convertFromInternalconvertToInternalsupports

Field Detail

jsonbback to summary
private Jsonb jsonb

Constructor Detail

JsonbMessageConverterback to summary
public JsonbMessageConverter()

Construct a new JsonbMessageConverter with default configuration.

JsonbMessageConverterback to summary
public JsonbMessageConverter(JsonbConfig config)

Construct a new JsonbMessageConverter with the given configuration.

Parameters
config:JsonbConfig

the JsonbConfig for the underlying delegate

JsonbMessageConverterback to summary
public JsonbMessageConverter(Jsonb jsonb)

Construct a new JsonbMessageConverter with the given delegate.

Parameters
jsonb:Jsonb

the Jsonb instance to use

Method Detail

fromJsonback to summary
protected Object fromJson(Reader reader, Type resolvedType)

Implements abstract org.springframework.messaging.converter.AbstractJsonMessageConverter.fromJson.

Annotations
@Override
fromJsonback to summary
protected Object fromJson(String payload, Type resolvedType)

Implements abstract org.springframework.messaging.converter.AbstractJsonMessageConverter.fromJson.

Annotations
@Override
getJsonbback to summary
public Jsonb getJsonb()

Return the configured Jsonb instance for this converter.

setJsonbback to summary
public void setJsonb(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
toJsonback to summary
protected void toJson(Object payload, Type resolvedType, Writer writer)

Implements abstract org.springframework.messaging.converter.AbstractJsonMessageConverter.toJson.

Annotations
@Override
toJsonback to summary
protected String toJson(Object payload, Type resolvedType)

Implements abstract org.springframework.messaging.converter.AbstractJsonMessageConverter.toJson.

Annotations
@Override