Spring Framework

org.springframework.core.convert.converter
Interface ConverterRegistry

All Known Subinterfaces:
ConfigurableConversionService, FormatterRegistry
All Known Implementing Classes:
DefaultConversionService, DefaultFormattingConversionService, FormattingConversionService, GenericConversionService

public interface ConverterRegistry

For registering converters with a type conversion system.

Since:
3.0
Author:
Keith Donald, Juergen Hoeller

Method Summary
 void addConverter(java.lang.Class<?> sourceType, java.lang.Class<?> targetType, Converter<?,?> converter)
          Add a plain converter to this registry.
 void addConverter(Converter<?,?> converter)
          Add a plain converter to this registry.
 void addConverter(GenericConverter converter)
          Add a generic converter to this registry.
 void addConverterFactory(ConverterFactory<?,?> converterFactory)
          Add a ranged converter factory to this registry.
 void removeConvertible(java.lang.Class<?> sourceType, java.lang.Class<?> targetType)
          Remove any converters from sourceType to targetType.
 

Method Detail

addConverter

void addConverter(Converter<?,?> converter)
Add a plain converter to this registry. The convertible sourceType/targetType pair is derived from the Converter's parameterized types.

Throws:
java.lang.IllegalArgumentException - if the parameterized types could not be resolved

addConverter

void addConverter(java.lang.Class<?> sourceType,
                  java.lang.Class<?> targetType,
                  Converter<?,?> converter)
Add a plain converter to this registry. The convertible sourceType/targetType pair is specified explicitly. Allows for a Converter to be reused for multiple distinct pairs without having to create a Converter class for each pair.

Since:
3.1

addConverter

void addConverter(GenericConverter converter)
Add a generic converter to this registry.


addConverterFactory

void addConverterFactory(ConverterFactory<?,?> converterFactory)
Add a ranged converter factory to this registry. The convertible sourceType/rangeType pair is derived from the ConverterFactory's parameterized types.

Throws:
java.lang.IllegalArgumentException - if the parameterized types could not be resolved.

removeConvertible

void removeConvertible(java.lang.Class<?> sourceType,
                       java.lang.Class<?> targetType)
Remove any converters from sourceType to targetType.

Parameters:
sourceType - the source type
targetType - the target type

Spring Framework