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 Details

    • addConverter

      void&nbsp;addConverter(Converter<?,?>&nbsp;converter)
      Add a plain converter to this registry. The convertible source/target type pair is derived from the Converter's parameterized types.
      Throws:
      IllegalArgumentException - if the parameterized types could not be resolved
    • addConverter

      <s,T>&nbsp;void&nbsp;addConverter(Class<s>&nbsp;sourceType, Class<T>&nbsp;targetType, Converter<? super s, ? extends T>&nbsp;converter)
      Add a plain converter to this registry. The convertible source/target type 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&nbsp;addConverter(GenericConverter&nbsp;converter)
      Add a generic converter to this registry.
    • addConverterFactory

      void&nbsp;addConverterFactory(ConverterFactory<?,?>&nbsp;factory)
      Add a ranged converter factory to this registry. The convertible source/target type pair is derived from the ConverterFactory's parameterized types.
      Throws:
      IllegalArgumentException - if the parameterized types could not be resolved
    • removeConvertible

      void&nbsp;removeConvertible(Class<?>&nbsp;sourceType, Class<?>&nbsp;targetType)
      Remove any converters from sourceType to targetType.
      Parameters:
      sourceType - the source type
      targetType - the target type