addMapConverters static method

void addMapConverters(
  1. ConverterRegistry registry
)

Registers converters for Map types into the given ConverterRegistry.

This allows automatic conversion between maps and strings, as well as generic map-to-map transformations, using the provided ConversionService.

Example:

final registry = ConversionService();
ConversionServiceConfiguration.addMapConverters(registry);

After this, the conversion service can handle:

  • Converting String to Map<K, V>
  • Converting Map<K, V> to String
  • Converting between map types (Map<K1, V1> to Map<K2, V2>)

Implementation

static void addMapConverters(ConverterRegistry registry) {
  final conversionService = registry as ConversionService;

  registry.addPairedConverter(StringToMapGenericConverter(conversionService));
  registry.addPairedConverter(MapToStringGenericConverter(conversionService));
  registry.addPairedConverter(MapToMapGenericConverter(conversionService));
}